mirror of
https://github.com/filebrowser/filebrowser.git
synced 2026-07-25 17:04:17 +00:00
Former-commit-id: 4d5ca1dd46c57e35222860a66c9f98f945fbaad7 [formerly 5a0bea68d0ddec09c95919c1ef45bdff3f602bc6] [formerly b324db325f094e5563f945c41f4f9eeb0b2df086 [formerly 698a08e1a9]]
Former-commit-id: 6c39601f33482edafad63f4b39e10e2720db2813 [formerly 02a9c37289ce3d27eee55f3eb3052391349adc0e]
Former-commit-id: fd29981acff35fa5428af5e1d95fe1d53bba0459
68 lines
1.7 KiB
Vue
68 lines
1.7 KiB
Vue
<template>
|
|
<div class="prompt">
|
|
<h3>Delete files</h3>
|
|
<p v-show="req.kind !== 'listing'">Are you sure you want to delete this file/folder?</p>
|
|
<p v-show="req.kind === 'listing'">Are you sure you want to delete {{ selectedCount }} file(s)?</p>
|
|
<div>
|
|
<button @click="submit" autofocus>Delete</button>
|
|
<button @click="showDelete(false)" class="cancel">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapGetters, mapMutations, mapState} from 'vuex'
|
|
import webdav from '../utils/webdav'
|
|
import page from '../utils/page'
|
|
|
|
export default {
|
|
name: 'delete-prompt',
|
|
computed: {
|
|
...mapGetters(['selectedCount']),
|
|
...mapState(['req', 'selected'])
|
|
},
|
|
methods: {
|
|
...mapMutations(['showDelete']),
|
|
submit: function (event) {
|
|
this.showDelete(false)
|
|
// buttons.setLoading('delete')
|
|
|
|
if (this.req.kind !== 'listing') {
|
|
webdav.trash(window.location.pathname)
|
|
.then(() => {
|
|
// buttons.setDone('delete')
|
|
page.open(page.removeLastDir(window.location.pathname))
|
|
})
|
|
.catch(error => {
|
|
// buttons.setDone('delete', false)
|
|
console.log(error)
|
|
})
|
|
|
|
return
|
|
}
|
|
|
|
if (this.selectedCount === 0) {
|
|
// This shouldn't happen...
|
|
return
|
|
}
|
|
|
|
let promises = []
|
|
|
|
for (let index of this.selected) {
|
|
promises.push(webdav.trash(this.req.data.items[index].url))
|
|
}
|
|
|
|
Promise.all(promises)
|
|
.then(() => {
|
|
page.reload()
|
|
// buttons.setDone('delete')
|
|
})
|
|
.catch(error => {
|
|
console.log(error)
|
|
page.reload()
|
|
// buttons.setDone('delete', false)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|