mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-03-14 12:10:18 +03:00
fixed sorting
This commit is contained in:
parent
8c72dc9aaf
commit
94e83c52a0
5 changed files with 30 additions and 12 deletions
|
@ -8,6 +8,7 @@
|
|||
activatable
|
||||
item-key="name"
|
||||
open-on-click
|
||||
|
||||
>
|
||||
<template v-slot:prepend="{ item, open }">
|
||||
<v-icon v-if="!item.icon">
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
v-if="torrent"
|
||||
style="min-height: 400px; overflow: hidden !important;"
|
||||
>
|
||||
<div :class="`pa-0 project ${torrent.state}`">
|
||||
<div
|
||||
:class="`pa-0 project ${torrent.state}`"
|
||||
:style="{ height: phoneLayout ? '100vh' : '' }"
|
||||
>
|
||||
<v-card-title class="pb-0 justify-center primary">
|
||||
<h2 class="white--text">Torrent Detail</h2>
|
||||
</v-card-title>
|
||||
|
|
|
@ -112,6 +112,16 @@ class Qbit {
|
|||
return this.axios.post('/transfer/toggleSpeedLimitsMode')
|
||||
}
|
||||
|
||||
getTorrents(payload) {
|
||||
let params = {
|
||||
sort: payload.sort,
|
||||
reverse: payload.reverse
|
||||
}
|
||||
const data = new URLSearchParams(params)
|
||||
console.log(data.toString())
|
||||
return this.axios.get(`/torrents/info?${data.toString()}`)
|
||||
}
|
||||
|
||||
deleteTorrents(hashes, deleteFiles) {
|
||||
return this.actionTorrents('delete', hashes, { deleteFiles })
|
||||
}
|
||||
|
|
|
@ -83,22 +83,23 @@ export default new Vuex.Store({
|
|||
},
|
||||
updateMainData: async state => {
|
||||
const rid = state.rid ? state.rid : undefined
|
||||
const { data } = await qbit.getMainData(rid)
|
||||
|
||||
// torrents
|
||||
state.torrents = []
|
||||
for (const [key, value] of Object.entries(data.torrents)) {
|
||||
state.torrents.push(new Torrent({ hash: key, ...value }))
|
||||
}
|
||||
const res = await qbit.getMainData(rid)
|
||||
|
||||
// status
|
||||
state.status = new Status(data.server_state)
|
||||
state.status = new Status(res.data.server_state)
|
||||
|
||||
// graph
|
||||
state.download_data.splice(0, 1)
|
||||
state.download_data.push(state.status.dlspeedRaw)
|
||||
state.upload_data.splice(0, 1)
|
||||
state.upload_data.push(state.status.upspeedRaw)
|
||||
|
||||
const { data } = await qbit.getTorrents(state.sort_options)
|
||||
// torrents
|
||||
state.torrents = []
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
state.torrents.push(new Torrent({ hash: key, ...value }))
|
||||
}
|
||||
},
|
||||
SET_SETTINGS: async state => {
|
||||
const { data } = await qbit.getAppPreferences()
|
||||
|
@ -106,6 +107,10 @@ export default new Vuex.Store({
|
|||
},
|
||||
SET_SELECTED_TORRENT_DETAIL: (state, hash) => {
|
||||
state.selectedDetailTorrent = hash
|
||||
},
|
||||
UPDATE_SORT_OPTIONS: (state, payload) => {
|
||||
state.sort_options.sort = payload.name
|
||||
state.sort_options.reverse = payload.reverse
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -126,7 +126,7 @@ export default {
|
|||
case 'Done':
|
||||
case 'Downloaded':
|
||||
case 'Dloaded':
|
||||
name = 'downloaded'
|
||||
name = 'progress'
|
||||
break
|
||||
case 'state':
|
||||
case 'status':
|
||||
|
@ -138,8 +138,7 @@ export default {
|
|||
name = 'name'
|
||||
break
|
||||
}
|
||||
|
||||
this.$store.state.sort_options = { name, reverse }
|
||||
this.$store.commit('UPDATE_SORT_OPTIONS', { name, reverse })
|
||||
},
|
||||
resetSelected() {
|
||||
this.$store.commit('RESET_SELECTED')
|
||||
|
|
Loading…
Add table
Reference in a new issue