Former-commit-id: ac9399efef37f13706590384e29295c6234acb7c [formerly f62dcb89aa49125769405c502688f3f8d4348da3] [formerly 4b9f0fd696f449c30da2d2f7a11cf5d6c7054c54 [formerly 64e70e39dc]]
Former-commit-id: 422165231c785b121b1f6725909d3ce7c8dcdfee [formerly 2b26582a03f674d40abb39e27b2cc880d2bd3ebb]
Former-commit-id: ee743808a3c012514c9b7d57a34c79e408a8a78b
61 lines
1.4 KiB
Vue
61 lines
1.4 KiB
Vue
<template>
|
|
<div class="prompt">
|
|
<h3>Move</h3>
|
|
<p>Choose new house for your file(s)/folder(s):</p>
|
|
|
|
<file-list @update:selected="val => dest = val"></file-list>
|
|
|
|
<div>
|
|
<button class="ok" @click="move">Move</button>
|
|
<button class="cancel" @click="$store.commit('closeHovers')">Cancel</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex'
|
|
import FileList from './FileList'
|
|
import api from '@/utils/api'
|
|
import buttons from '@/utils/buttons'
|
|
|
|
export default {
|
|
name: 'move',
|
|
components: { FileList },
|
|
data: function () {
|
|
return {
|
|
current: window.location.pathname,
|
|
dest: null
|
|
}
|
|
},
|
|
computed: mapState(['req', 'selected']),
|
|
methods: {
|
|
move: function (event) {
|
|
event.preventDefault()
|
|
buttons.loading('move')
|
|
let items = []
|
|
|
|
// Create a new promise for each file.
|
|
for (let item of this.selected) {
|
|
items.push({
|
|
from: this.req.items[item].url,
|
|
to: this.dest + encodeURIComponent(this.req.items[item].name)
|
|
})
|
|
}
|
|
|
|
// Execute the promises.
|
|
api.move(items)
|
|
.then(() => {
|
|
buttons.done('move')
|
|
this.$router.push({ path: this.dest })
|
|
})
|
|
.catch(error => {
|
|
buttons.done('move')
|
|
this.$store.commit('showError', error)
|
|
})
|
|
|
|
event.preventDefault()
|
|
}
|
|
}
|
|
}
|
|
</script>
|