feat: Add Batch change location (#574)

This commit is contained in:
Rémi Marseault 2022-12-30 12:11:38 +01:00 committed by GitHub
parent 91fcfeeba6
commit 060c3c3a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 34 additions and 37 deletions

View file

@ -42,6 +42,7 @@ export default {
if (authenticated) {
this.$store.commit('LOGIN', true)
this.$store.commit('updateMainData')
await this.$store.dispatch('FETCH_SETTINGS')
if (this.onLoginPage) return this.$router.push('/')
return

View file

@ -10,7 +10,13 @@
<v-container>
<v-row>
<v-col>
<v-text-field v-model="torrent.name" :label="$t('modals.changeLocation.torrentName')" :prepend-icon="mdiFile" readonly />
<v-list flat class="mb-4">
<v-list-item v-for="t in torrents" :key="t.hash" else>
<v-list-item-content>
<v-list-item-title class="text-wrap" v-text="t.name" />
</v-list-item-content>
</v-list-item>
</v-list>
<v-text-field v-model="newPath" :label="$t('directory')" :prepend-icon="mdiFolder" @keydown.enter="setLocation" />
</v-col>
</v-row>
@ -39,7 +45,7 @@ export default {
name: 'ChangeLocationModal',
mixins: [Modal, FullScreenModal],
props: {
hash: String
hashes: Array
},
data() {
return {
@ -50,23 +56,23 @@ export default {
}
},
computed: {
...mapGetters(['getTorrent']),
...mapGetters(['getTorrent', 'getSettings']),
dialogWidth() {
return this.phoneLayout ? '100%' : '750px'
},
torrent() {
return this.getTorrent(this.hash)
torrents() {
return [...this.hashes.map(hash => this.getTorrent(hash))]
},
isPhone() {
return this.$vuetify.breakpoint.xsOnly
}
},
created() {
this.newPath = this.torrent.savePath
this.newPath = this.getSettings().save_path
},
methods: {
setLocation() {
qbit.setTorrentLocation([this.hash], this.newPath)
qbit.setTorrentLocation(this.hashes, this.newPath)
this.close()
},
close() {

View file

@ -42,7 +42,7 @@
</v-list-item>
</template>
<v-list>
<v-list-item v-if="!multiple" link @click="location">
<v-list-item link @click="location">
<v-icon>{{ mdiFolder }}</v-icon>
<v-list-item-title class="ml-2 list-item__title">
{{ $t('rightClick.advanced.changeLocation') | titleCase }}
@ -369,7 +369,10 @@ export default {
qbit.pauseTorrents(this.hashes)
},
location() {
this.createModal('ChangeLocationModal', { hash: this.torrent.hash })
this.createModal(
'ChangeLocationModal',
{ hashes: this.multiple ? this.selected_torrents : [this.torrent.hash] }
)
},
rename() {
this.createModal('RenameModal', { hash: this.torrent.hash })

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: 'One or more files are not valid torrents'
},
changeLocation: {
title: 'Change Location',
torrentName: 'Torrent Name'
title: 'Change Location'
},
rename: {
title: 'Rename',

View file

@ -401,8 +401,7 @@ const locale = {
// oneOrMoreFilesInvalidTorrent: 'One or more files are not valid torrents'
},
changeLocation: {
// title: 'Change Location',
// torrentName: 'Torrent Name'
// title: 'Change Location'
},
rename: {
// title: 'Rename',

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: 'Un ou plusieurs fichiers ne sont pas des torrents valides'
},
changeLocation: {
title: "Changement d'emplacement",
torrentName: 'Nom du torrent'
title: "Changement d'emplacement"
},
rename: {
title: 'Renommer',

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: 'Satu atau lebih file bukan torrent yang valid'
},
changeLocation: {
title: 'Ubah Lokasi',
torrentName: 'Nama Torrent'
title: 'Ubah Lokasi'
},
rename: {
title: 'Ubah Nama',

View file

@ -400,8 +400,7 @@ const locale = {
// oneOrMoreFilesInvalidTorrent: 'One or more files are not valid torrents'
},
changeLocation: {
// title: 'Change Location',
// torrentName: 'Torrent Name'
// title: 'Change Location'
},
rename: {
// title: 'Rename',

View file

@ -399,8 +399,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: '一つまたは複数の無効なTorrentファイルが含まれています'
},
changeLocation: {
title: '場所を変更',
torrentName: 'Torrent名'
title: '場所を変更'
},
rename: {
title: '名前を変更',

View file

@ -400,8 +400,7 @@ const locale = {
// oneOrMoreFilesInvalidTorrent: 'One or more files are not valid torrents'
},
changeLocation: {
// title: 'Change Location',
// torrentName: 'Torrent Name'
// title: 'Change Location'
},
rename: {
// title: 'Rename',

View file

@ -400,8 +400,7 @@ const locale = {
// oneOrMoreFilesInvalidTorrent: 'One or more files are not valid torrents'
},
changeLocation: {
// title: 'Change Location',
// torrentName: 'Torrent Name'
// title: 'Change Location'
},
rename: {
// title: 'Rename',

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: 'Один или несколько файлов не являются действительным торрентом'
},
changeLocation: {
title: 'Изменить местоположение',
torrentName: 'Название торрента'
title: 'Изменить местоположение'
},
rename: {
title: 'Переименовать',

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: 'Один або кілька файлів не є дійсним торрентом'
},
changeLocation: {
title: 'Змінити місцезнаходження',
torrentName: 'Назва торренту'
title: 'Змінити місцезнаходження'
},
rename: {
title: 'Перейменувати',

View file

@ -400,8 +400,7 @@ const locale = {
// oneOrMoreFilesInvalidTorrent: 'One or more files are not valid torrents'
},
changeLocation: {
// title: 'Change Location',
// torrentName: 'Torrent Name'
// title: 'Change Location'
},
rename: {
// title: 'Rename',

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: '存在无效的种子文件'
},
changeLocation: {
title: '更改位置',
torrentName: '种子名称'
title: '更改位置'
},
rename: {
title: '重命名',

View file

@ -400,8 +400,7 @@ const locale = {
oneOrMoreFilesInvalidTorrent: '存在無效的種子檔案'
},
changeLocation: {
title: '更改位置',
torrentName: '種子名稱'
title: '更改位置'
},
rename: {
title: '重新命名',

View file

@ -1,6 +1,6 @@
import Vue from 'vue'
import qbit from '../services/qbit'
import { i18n } from '../plugins/i18n'
import { i18n } from '@/plugins/i18n'
export default {
INIT_INTERVALS: async context => {
@ -15,7 +15,7 @@ export default {
Vue.$toast.success(i18n.t('toast.loginSuccess'))
context.commit('LOGIN', true)
context.commit('updateMainData')
context.commit('FETCH_SETTINGS')
await context.dispatch('FETCH_SETTINGS')
context.commit('FETCH_CATEGORIES')
context.commit('FETCH_TAGS')