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": { "vuetify": {
"version": "2.3.10", "version": "2.3.12",
"resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.3.10.tgz", "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-2.3.12.tgz",
"integrity": "sha512-KzL/MhZ7ajubm9kwbdCoA/cRV50RX+a5Hcqiwt7Am1Fni2crDtl2no05UNwKroTfscrYYf07gq3WIFSurPsnCA==" "integrity": "sha512-FSt1pzpf0/Lh0xuctAPB7RiLbUl7bzVc7ejbXLLhfmgm7zD7yabuhVYuyVda/SzokjZMGS3j1lNu2lLfdrz0oQ=="
}, },
"vuex": { "vuex": {
"version": "3.5.1", "version": "3.5.1",

View file

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

View file

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

View file

@ -1,103 +1,108 @@
<template> <template>
<v-card flat> <v-card flat>
<v-card-text class="pa-0" style="font-size: 1.1em"> <perfect-scrollbar>
<v-simple-table> <v-card-text
<tbody> class="pa-0"
<tr> style="font-size: 1.1em; max-height: 500px; min-height: 400px"
<td class="grey--text">Torrent title</td> >
<td class="torrentmodaltext--text"> <v-simple-table>
{{ torrent.name }} <tbody>
</td> <tr>
</tr> <td class="grey--text">Torrent title</td>
<tr style="margin-top: 10px !important"> <td class="torrentmodaltext--text">
<td class="grey--text">hash</td> {{ torrent.name }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.hash }} </tr>
</td> <tr style="margin-top: 10px !important">
</tr> <td class="grey--text">hash</td>
<tr> <td class="torrentmodaltext--text">
<td class="grey--text">Size</td> {{ torrent.hash }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.size }} </tr>
</td> <tr>
</tr> <td class="grey--text">Size</td>
<tr> <td class="torrentmodaltext--text">
<td class="grey--text">Done:</td> {{ torrent.size }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.dloaded }} </tr>
</td> <tr>
</tr> <td class="grey--text">Done:</td>
<tr> <td class="torrentmodaltext--text">
<td class="grey--text">Download</td> {{ torrent.dloaded }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.dlspeed }} </tr>
</td> <tr>
</tr> <td class="grey--text">Download</td>
<tr> <td class="torrentmodaltext--text">
<td class="grey--text">Upload</td> {{ torrent.dlspeed }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.upspeed }} </tr>
</td> <tr>
</tr> <td class="grey--text">Upload</td>
<tr> <td class="torrentmodaltext--text">
<td class="grey--text">ETA</td> {{ torrent.upspeed }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.eta }} </tr>
</td> <tr>
</tr> <td class="grey--text">ETA</td>
<tr> <td class="torrentmodaltext--text">
<td class="grey--text">Peers</td> {{ torrent.eta }}
<td class="torrentmodaltext--text"> </td>
{{ torrent.num_leechs </tr>
}}<span class="grey--text" <tr>
>/{{ torrent.available_peers }}</span <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> </tbody>
<tr> </v-simple-table>
<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>
<v-flex class="pt-3 pb-4"> <v-flex class="pt-3 pb-4">
<v-progress-linear <v-progress-linear
height="5" height="5"
stream stream
rounded rounded
color="cyan darken-1" color="cyan darken-1"
background-color="cyan lighten-3" background-color="cyan lighten-3"
:buffer-value="torrent.progress" :buffer-value="torrent.progress"
></v-progress-linear> ></v-progress-linear>
</v-flex> </v-flex>
</v-card-text> </v-card-text>
</perfect-scrollbar>
</v-card> </v-card>
</template> </template>

View file

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

View file

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

View file

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