mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-29 05:28:53 +03:00
feat: auto refresh peers
auto refresh peers
This commit is contained in:
parent
664e4dbe2f
commit
dfd10beeab
1 changed files with 16 additions and 4 deletions
|
@ -2,11 +2,12 @@
|
|||
<perfect-scrollbar>
|
||||
<v-data-table
|
||||
v-if="peers"
|
||||
dense
|
||||
:headers="headers"
|
||||
:items="peers"
|
||||
:items-per-page="-1"
|
||||
:hide-default-footer="true"
|
||||
:style="{ minHeight: phoneLayout ? '' : '75vh', maxHeight: '75vh'}"
|
||||
mobile-breakpoint="0"
|
||||
>
|
||||
<template #item="row">
|
||||
<tr>
|
||||
|
@ -56,6 +57,7 @@ export default {
|
|||
mixins: [FullScreenModal],
|
||||
props: { hash: String, isActive: Boolean },
|
||||
data: () => ({
|
||||
refreshTimer: '',
|
||||
headers: [
|
||||
{ text: 'IP', value: 'ip' },
|
||||
{ text: 'Connection', value: 'connection' },
|
||||
|
@ -93,6 +95,9 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.getTorrentPeers()
|
||||
this.refreshTimer = setInterval(function(){
|
||||
this.getTorrentPeers()
|
||||
}.bind(this), 2000)
|
||||
},
|
||||
methods: {
|
||||
codeToFlag(val) {
|
||||
|
@ -111,6 +116,9 @@ export default {
|
|||
|
||||
this.peersObj = data.peers
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearTimeout(this.refreshTimer)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -131,11 +139,9 @@ export default {
|
|||
|
||||
::v-deep .v-data-table thead th,
|
||||
::v-deep .v-data-table tbody td {
|
||||
padding: 0 2px !important;
|
||||
padding: 0 3px !important;
|
||||
height: auto;
|
||||
|
||||
white-space: nowrap;
|
||||
|
||||
&:first-child {
|
||||
padding: 0 0 0 8px !important;
|
||||
}
|
||||
|
@ -143,4 +149,10 @@ export default {
|
|||
padding-right: 8px !important;
|
||||
}
|
||||
}
|
||||
::v-deep .v-data-table-header {
|
||||
white-space: nowrap;
|
||||
}
|
||||
::v-deep td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue