mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-03-14 12:10:18 +03:00
feat: support for renaming folders (#500)
This commit is contained in:
parent
02d1f2bd66
commit
cf8f43aac3
2 changed files with 48 additions and 4 deletions
|
@ -26,7 +26,36 @@
|
|||
/>
|
||||
</template>
|
||||
<template v-if="!$vuetify.breakpoint.smAndDown" #append="{ item }">
|
||||
<span v-if="!item.icon">{{ item.children.length }} Files</span>
|
||||
<div v-if="!item.icon">
|
||||
<span class="ml-4">{{ item.children.length }} Files</span>
|
||||
<v-btn
|
||||
v-if="!item.editing"
|
||||
fab
|
||||
x-small
|
||||
class="accent white--text elevation-0 px-4 ml-2"
|
||||
@click="edit(item)"
|
||||
>
|
||||
<v-icon>{{ mdiPencil }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="item.editing"
|
||||
fab
|
||||
x-small
|
||||
class="accent white--text elevation-0 px-4 ml-2"
|
||||
@click="renameFolder(item)"
|
||||
>
|
||||
<v-icon>{{ mdiContentSave }}</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="item.editing"
|
||||
fab
|
||||
x-small
|
||||
class="error white--text elevation-0 px-4 ml-2"
|
||||
@click="togleEditing(item)"
|
||||
>
|
||||
<v-icon>{{ mdiClose }}</v-icon>
|
||||
</v-btn>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span>[{{ item.size }}]</span>
|
||||
<span class="ml-4">{{ item.progress }}%</span>
|
||||
|
@ -96,7 +125,7 @@
|
|||
import qbit from '@/services/qbit'
|
||||
import { treeify } from '@/helpers'
|
||||
import { FullScreenModal } from '@/mixins'
|
||||
import {
|
||||
import {
|
||||
mdiClose, mdiContentSave, mdiPencil, mdiFolderOpen,
|
||||
mdiFolder, mdiFile, mdiTrendingUp, mdiPriorityHigh,
|
||||
mdiArrowUp, mdiArrowDown, mdiPriorityLow
|
||||
|
@ -115,7 +144,7 @@ export default {
|
|||
priority(value) {
|
||||
if (value === 4) return 'normal'
|
||||
const res = FILE_PRIORITY_OPTIONS.find(el => el.value === value)
|
||||
|
||||
|
||||
return res ? res.name : 'undefined'
|
||||
}
|
||||
},
|
||||
|
@ -144,7 +173,7 @@ export default {
|
|||
if (this.treeData) {
|
||||
return treeify(this.treeData)
|
||||
}
|
||||
|
||||
|
||||
return []
|
||||
}
|
||||
},
|
||||
|
@ -220,6 +249,11 @@ export default {
|
|||
item.name = item.newName
|
||||
this.togleEditing(item)
|
||||
},
|
||||
renameFolder(item) {
|
||||
qbit.renameFolder(this.hash, item.name, item.newName)
|
||||
item.name = item.newName
|
||||
this.togleEditing(item)
|
||||
},
|
||||
setFilePrio(fileId, priority) {
|
||||
qbit.setTorrentFilePriority(this.hash, [fileId], priority)
|
||||
.then(() => this.initFiles())
|
||||
|
|
|
@ -359,6 +359,16 @@ class Qbit {
|
|||
return this.execute('post', '/torrents/renameFile', params)
|
||||
}
|
||||
|
||||
renameFolder(hash, oldPath, newPath) {
|
||||
const params = {
|
||||
hash,
|
||||
oldPath,
|
||||
newPath
|
||||
}
|
||||
|
||||
return this.execute('post', '/torrents/renameFolder', params)
|
||||
}
|
||||
|
||||
/** Torrent Priority **/
|
||||
setTorrentPriority(hashes, priority) {
|
||||
if (['increasePrio', 'decreasePrio', 'topPrio', 'bottomPrio'].includes(priority)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue