mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-08 19:22:57 +00:00

Former-commit-id: 6d70d81a1967f171a41cecbdad8664fc65d1111a [formerly e273e78de0030dcb2eec730a00f248f1e8dbd9f7] [formerly 37b0ede2385e153153a854112ffab1065bcdd44d [formerly f89b86939e36d97cefead23968b8b6fb9ca8ffd8]] Former-commit-id: 84fc2f9742c2e0011254ee762faf6f087986c6fa [formerly f22c175e96173bf25aa08067533937041152fdb3] Former-commit-id: 32981c2a1211608d2d5c059264aa5eb434099400
71 lines
1.7 KiB
Vue
71 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"
|
|
:disabled="$route.path === dest"
|
|
: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>
|