2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2020-01-30 03:10:42 +01:00
|
|
|
<section class="uawsfosz _card">
|
2020-01-29 20:37:25 +01:00
|
|
|
<div class="_title"><fa :icon="faCloud"/> {{ $t('drive') }}</div>
|
|
|
|
<div class="_content">
|
2020-04-21 17:34:56 +02:00
|
|
|
<span>{{ $t('uploadFolder') }}: {{ uploadFolder ? uploadFolder.name : '-' }}</span>
|
|
|
|
<mk-button primary @click="chooseUploadFolder()"><fa :icon="faFolderOpen"/> {{ $t('selectFolder') }}</mk-button>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2020-04-21 17:34:56 +02:00
|
|
|
import { faCloud, faFolderOpen } from '@fortawesome/free-solid-svg-icons';
|
2020-01-29 20:37:25 +01:00
|
|
|
import { faClock, faEyeSlash, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
|
|
|
|
import MkButton from '../../components/ui/button.vue';
|
2020-04-21 17:34:56 +02:00
|
|
|
import { selectDriveFolder } from '../../scripts/select-drive-folder';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
|
|
|
MkButton,
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-04-21 17:34:56 +02:00
|
|
|
uploadFolder: null,
|
|
|
|
faCloud, faClock, faEyeSlash, faFolderOpen, faTrashAlt
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-04-21 17:34:56 +02:00
|
|
|
async created() {
|
|
|
|
if (this.$store.state.settings.uploadFolder) {
|
|
|
|
this.uploadFolder = await this.$root.api('drive/folders/show', {
|
|
|
|
folderId: this.$store.state.settings.uploadFolder
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2020-04-21 17:34:56 +02:00
|
|
|
chooseUploadFolder() {
|
|
|
|
selectDriveFolder(this.$root, false).then(async folder => {
|
|
|
|
await this.$store.dispatch('settings/set', { key: 'uploadFolder', value: folder ? folder.id : null });
|
|
|
|
this.$root.dialog({
|
|
|
|
type: 'success',
|
|
|
|
iconOnly: true, autoClose: true
|
|
|
|
});
|
|
|
|
if (this.$store.state.settings.uploadFolder) {
|
|
|
|
this.uploadFolder = await this.$root.api('drive/folders/show', {
|
|
|
|
folderId: this.$store.state.settings.uploadFolder
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.uploadFolder = null;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-01-30 03:10:42 +01:00
|
|
|
.uawsfosz {
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|