feat: use confirmation modal when deleting from context menu #191

This commit is contained in:
Daan Wijns 2021-04-04 12:06:52 +02:00
parent dfd10beeab
commit 53c548b502
3 changed files with 13 additions and 24 deletions

View file

@ -64,6 +64,7 @@ export default {
},
methods: {
close() {
this.$store.state.selected_torrents = []
this.$store.commit('DELETE_MODAL', this.guid)
},
deleteWithoutFiles() {

View file

@ -95,10 +95,13 @@ export default {
},
created() {
this.getTorrentPeers()
this.refreshTimer = setInterval(function(){
this.refreshTimer = setInterval(function () {
this.getTorrentPeers()
}.bind(this), 2000)
},
beforeDestroy() {
clearTimeout(this.refreshTimer)
},
methods: {
codeToFlag(val) {
return codeToFlag(val)
@ -116,9 +119,6 @@ export default {
this.peersObj = data.peers
}
},
beforeDestroy() {
clearTimeout(this.refreshTimer)
}
}
</script>

View file

@ -29,7 +29,7 @@
</v-list-item>
<v-divider />
<v-list-item link @click="deleteWithoutFiles">
<v-list-item link @click="removeTorrent">
<v-icon color="red">
{{ mdiDelete }}
</v-icon>
@ -40,17 +40,6 @@
Delete
</v-list-item-title>
</v-list-item>
<v-list-item link @click="deleteWithFiles">
<v-icon color="red">
{{ mdiDeleteForever }}
</v-icon>
<v-list-item-title
class="ml-2 red--text"
style="font-size: 1em;"
>
Delete with files
</v-list-item-title>
</v-list-item>
<v-divider />
<v-menu
open-on-hover
@ -241,7 +230,7 @@ import qbit from '@/services/qbit'
import { General, TorrentSelect } from '@/mixins'
import {
mdiBullhorn, mdiPlaylistCheck, mdiArrowUp, mdiArrowDown, mdiPriorityLow,
mdiInformation, mdiDeleteForever, mdiRenameBox, mdiFolder, mdiDelete,
mdiInformation, mdiRenameBox, mdiFolder, mdiDelete,
mdiPlay, mdiPause, mdiSelect, mdiPriorityHigh, mdiChevronRight,
mdiFastForward, mdiShape, mdiHeadCog, mdiCheckboxMarked, mdiCheckboxBlankOutline,
mdiSpeedometerSlow, mdiChevronUp, mdiChevronDown
@ -261,7 +250,7 @@ export default {
{ name: 'bottom', icon: mdiPriorityLow, action: 'bottomPrio' }
],
mdiDelete, mdiPlay, mdiPause, mdiSelect, mdiFastForward,
mdiFolder, mdiRenameBox, mdiDeleteForever, mdiInformation,
mdiFolder, mdiRenameBox, mdiInformation,
mdiPlaylistCheck, mdiPriorityHigh, mdiBullhorn, mdiChevronRight,
mdiShape, mdiHeadCog, mdiCheckboxMarked, mdiCheckboxBlankOutline,
mdiSpeedometerSlow, mdiChevronUp, mdiChevronDown
@ -284,7 +273,7 @@ export default {
return [this.torrent.hash]
},
multiple() {
return this.selected_torrents.length
return this.selected_torrents.length > 1
}
},
methods: {
@ -303,11 +292,10 @@ export default {
reannounce() {
qbit.reannounceTorrents(this.hashes)
},
deleteWithoutFiles() {
qbit.deleteTorrents(this.hashes, false)
},
deleteWithFiles() {
qbit.deleteTorrents(this.hashes, true)
removeTorrent() {
this.$store.state.selected_torrents = this.hashes
return this.createModal('ConfirmDeleteModal')
},
recheck() {
qbit.recheckTorrents(this.hashes)