Tabs Trackers, Peers & Content are empty #43 && Fix global pause/resume

This commit is contained in:
Daan 2020-10-03 08:42:07 +02:00
parent 8bc97073be
commit 2cdbc5b2a4
7 changed files with 119 additions and 115 deletions

6
package-lock.json generated
View file

@ -12104,9 +12104,9 @@
}
},
"vuetify": {
"version": "2.3.10",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.3.10.tgz",
"integrity": "sha512-KzL/MhZ7ajubm9kwbdCoA/cRV50RX+a5Hcqiwt7Am1Fni2crDtl2no05UNwKroTfscrYYf07gq3WIFSurPsnCA=="
"version": "2.3.12",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.3.12.tgz",
"integrity": "sha512-FSt1pzpf0/Lh0xuctAPB7RiLbUl7bzVc7ejbXLLhfmgm7zD7yabuhVYuyVda/SzokjZMGS3j1lNu2lLfdrz0oQ=="
},
"vuex": {
"version": "3.5.1",

View file

@ -1,6 +1,6 @@
{
"name": "vuetorrent",
"version": "0.3.5",
"version": "0.3.6",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
@ -25,7 +25,7 @@
"vue-router": "^3.4.5",
"vue-toastification": "^1.7.8",
"vue2-perfect-scrollbar": "^1.5.0",
"vuetify": "^2.3.4",
"vuetify": "^2.3.12",
"vuex": "^3.5.1",
"vuex-persist": "^3.1.3"
},

View file

@ -65,6 +65,9 @@ export default {
this.getTorrentFiles()
}
}
},
created() {
this.getTorrentFiles()
}
}
</script>

View file

@ -1,103 +1,108 @@
<template>
<v-card flat>
<v-card-text class="pa-0" style="font-size: 1.1em">
<v-simple-table>
<tbody>
<tr>
<td class="grey--text">Torrent title</td>
<td class="torrentmodaltext--text">
{{ torrent.name }}
</td>
</tr>
<tr style="margin-top: 10px !important">
<td class="grey--text">hash</td>
<td class="torrentmodaltext--text">
{{ torrent.hash }}
</td>
</tr>
<tr>
<td class="grey--text">Size</td>
<td class="torrentmodaltext--text">
{{ torrent.size }}
</td>
</tr>
<tr>
<td class="grey--text">Done:</td>
<td class="torrentmodaltext--text">
{{ torrent.dloaded }}
</td>
</tr>
<tr>
<td class="grey--text">Download</td>
<td class="torrentmodaltext--text">
{{ torrent.dlspeed }}
</td>
</tr>
<tr>
<td class="grey--text">Upload</td>
<td class="torrentmodaltext--text">
{{ torrent.upspeed }}
</td>
</tr>
<tr>
<td class="grey--text">ETA</td>
<td class="torrentmodaltext--text">
{{ torrent.eta }}
</td>
</tr>
<tr>
<td class="grey--text">Peers</td>
<td class="torrentmodaltext--text">
{{ torrent.num_leechs
}}<span class="grey--text"
>/{{ torrent.available_peers }}</span
<perfect-scrollbar>
<v-card-text
class="pa-0"
style="font-size: 1.1em; max-height: 500px; min-height: 400px"
>
<v-simple-table>
<tbody>
<tr>
<td class="grey--text">Torrent title</td>
<td class="torrentmodaltext--text">
{{ torrent.name }}
</td>
</tr>
<tr style="margin-top: 10px !important">
<td class="grey--text">hash</td>
<td class="torrentmodaltext--text">
{{ torrent.hash }}
</td>
</tr>
<tr>
<td class="grey--text">Size</td>
<td class="torrentmodaltext--text">
{{ torrent.size }}
</td>
</tr>
<tr>
<td class="grey--text">Done:</td>
<td class="torrentmodaltext--text">
{{ torrent.dloaded }}
</td>
</tr>
<tr>
<td class="grey--text">Download</td>
<td class="torrentmodaltext--text">
{{ torrent.dlspeed }}
</td>
</tr>
<tr>
<td class="grey--text">Upload</td>
<td class="torrentmodaltext--text">
{{ torrent.upspeed }}
</td>
</tr>
<tr>
<td class="grey--text">ETA</td>
<td class="torrentmodaltext--text">
{{ torrent.eta }}
</td>
</tr>
<tr>
<td class="grey--text">Peers</td>
<td class="torrentmodaltext--text">
{{ torrent.num_leechs
}}<span class="grey--text"
>/{{ torrent.available_peers }}</span
>
</td>
</tr>
<tr>
<td class="grey--text">Seeds</td>
<td class="torrentmodaltext--text">
{{ torrent.num_seeds
}}<span class="grey--text"
>/{{ torrent.available_seeds }}</span
>
</td>
</tr>
<tr>
<td class="grey--text">Ratio</td>
<td class="torrentmodaltext--text">
{{ torrent.ratio }}%
</td>
</tr>
<tr>
<td class="grey--text">Tags</td>
<td v-if="torrent.tags">
{{ torrent.tags.join(',') }}
</td>
<td v-else>None</td>
</tr>
<tr>
<td class="grey--text">Status</td>
<v-chip
small
:class="`${torrent.state} white--text my-2 caption`"
>{{ torrent.state }}</v-chip
>
</td>
</tr>
<tr>
<td class="grey--text">Seeds</td>
<td class="torrentmodaltext--text">
{{ torrent.num_seeds
}}<span class="grey--text"
>/{{ torrent.available_seeds }}</span
>
</td>
</tr>
<tr>
<td class="grey--text">Ratio</td>
<td class="torrentmodaltext--text">
{{ torrent.ratio }}%
</td>
</tr>
<tr>
<td class="grey--text">Tags</td>
<td v-if="torrent.tags">
{{ torrent.tags.join(',') }}
</td>
<td v-else>None</td>
</tr>
<tr>
<td class="grey--text">Status</td>
<v-chip
small
:class="`${torrent.state} white--text my-2 caption`"
>{{ torrent.state }}</v-chip
>
</tr>
</tbody>
</v-simple-table>
</tr>
</tbody>
</v-simple-table>
<v-flex class="pt-3 pb-4">
<v-progress-linear
height="5"
stream
rounded
color="cyan darken-1"
background-color="cyan lighten-3"
:buffer-value="torrent.progress"
></v-progress-linear>
</v-flex>
</v-card-text>
<v-flex class="pt-3 pb-4">
<v-progress-linear
height="5"
stream
rounded
color="cyan darken-1"
background-color="cyan lighten-3"
:buffer-value="torrent.progress"
></v-progress-linear>
</v-flex>
</v-card-text>
</perfect-scrollbar>
</v-card>
</template>

View file

@ -43,7 +43,7 @@
</template>
<script>
import { map, merge, cloneDeep } from 'lodash'
import { map, merge } from 'lodash'
import qbit from '@/services/qbit'
import { codeToFlag, isWindows } from '@/helpers'
@ -76,22 +76,12 @@ export default {
async getTorrentPeers() {
const { data } = await qbit.getTorrentPeers(
this.hash,
this.rid || undefined
this.rid + 1 || undefined
)
this.rid = data.rid
if (data.full_update) {
this.peersObj = data.peers
} else {
const tmp = cloneDeep(this.peersObj)
if (data.peers_removed) {
for (const key of data.peers_removed) {
delete tmp[key]
}
}
this.peersObj = merge(tmp, data.peers)
}
this.peersObj = data.peers
}
},
watch: {
@ -113,6 +103,9 @@ export default {
peers() {
return map(this.peersObj, (value, key) => merge({}, value, { key }))
}
},
created() {
this.getTorrentPeers()
}
}
</script>

View file

@ -78,6 +78,9 @@ export default {
trackers() {
return this.tempTrackers
}
},
created() {
this.getTorrentTrackers()
}
}
</script>

View file

@ -300,7 +300,7 @@ class Qbit {
actionTorrents(action, hashes, extra) {
const params = {
hashes: hashes.join('|'),
hashes: hashes.length ? hashes.join('|') : 'all',
...extra
}
const data = new URLSearchParams(params)