mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-12 05:02:58 +00:00

Former-commit-id: 5624723eeb939734902eeaa6c2f132c4beffa911 [formerly a83456d3eda5175e2941b2deeb58b5da323ff678] [formerly a6b3ac7942dbf48d7d9b3f8db5e5041a93143f19 [formerly 4d6b54c63ee21bd01854188b2ad82115948ff7fe]] Former-commit-id: d03621c16b2c892701d678361b6c0a7d5dbec620 [formerly d818b6751e035f283e1c8390d7993a33a459a7dd] Former-commit-id: 3539ee68532135467daa2cc175482769b1efb592
70 lines
1.7 KiB
Vue
70 lines
1.7 KiB
Vue
<template>
|
|
<div class="card floating">
|
|
<div class="card-title">
|
|
<h2>{{ $t('prompts.move') }}</h2>
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
<file-list @update:selected="val => dest = val"></file-list>
|
|
</div>
|
|
|
|
<div class="card-action">
|
|
<button class="flat cancel"
|
|
@click="$store.commit('closeHovers')"
|
|
:aria-label="$t('buttons.cancel')"
|
|
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
|
|
<button class="flat"
|
|
@click="move"
|
|
:aria-label="$t('buttons.move')"
|
|
:title="$t('buttons.move')">{{ $t('buttons.move') }}</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex'
|
|
import FileList from './FileList'
|
|
import * as 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.success('move')
|
|
this.$router.push({ path: this.dest })
|
|
})
|
|
.catch(error => {
|
|
buttons.done('move')
|
|
this.$showError(error)
|
|
})
|
|
|
|
event.preventDefault()
|
|
}
|
|
}
|
|
}
|
|
</script>
|