From 1852d1cc6f5af15bed6f2e642769292d50a25d6e Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 3 Nov 2020 10:27:00 +0900 Subject: [PATCH] Improve drive --- src/client/components/drive-select-dialog.vue | 70 +++++++++++++++++++ src/client/components/drive-window.vue | 54 ++++---------- src/client/components/drive.folder.vue | 26 ++++++- src/client/components/drive.vue | 11 ++- src/client/os.ts | 4 +- 5 files changed, 118 insertions(+), 47 deletions(-) create mode 100644 src/client/components/drive-select-dialog.vue diff --git a/src/client/components/drive-select-dialog.vue b/src/client/components/drive-select-dialog.vue new file mode 100644 index 0000000000..5221bdbb63 --- /dev/null +++ b/src/client/components/drive-select-dialog.vue @@ -0,0 +1,70 @@ + + + diff --git a/src/client/components/drive-window.vue b/src/client/components/drive-window.vue index d989d982d9..0806fc1808 100644 --- a/src/client/components/drive-window.vue +++ b/src/client/components/drive-window.vue @@ -1,72 +1,44 @@ diff --git a/src/client/components/drive.folder.vue b/src/client/components/drive.folder.vue index bf2c9b6494..5664fb8c62 100644 --- a/src/client/components/drive.folder.vue +++ b/src/client/components/drive.folder.vue @@ -2,6 +2,7 @@
import { defineComponent } from 'vue'; -import { faFolder, faFolderOpen } from '@fortawesome/free-regular-svg-icons'; +import { faFolder, faFolderOpen, faTrashAlt, faWindowRestore } from '@fortawesome/free-regular-svg-icons'; import * as os from '@/os'; +import { faICursor } from '@fortawesome/free-solid-svg-icons'; export default defineComponent({ props: { @@ -241,6 +243,28 @@ export default defineComponent({ value: this.folder.id }); }, + + onContextmenu(e) { + os.contextMenu([{ + text: this.$t('openInWindow'), + icon: faWindowRestore, + action: async () => { + os.popup(await import('./drive-window.vue'), { + initialFolder: this.folder + }, { + }, 'closed'); + } + }, null, { + text: this.$t('rename'), + icon: faICursor, + action: this.rename + }, null, { + text: this.$t('delete'), + icon: faTrashAlt, + danger: true, + action: this.deleteFolder + }], e); + }, } }); diff --git a/src/client/components/drive.vue b/src/client/components/drive.vue index 2c3203b387..f25d25da01 100644 --- a/src/client/components/drive.vue +++ b/src/client/components/drive.vue @@ -64,7 +64,7 @@ export default defineComponent({ }, props: { - initFolder: { + initialFolder: { type: Object, required: false }, @@ -151,8 +151,8 @@ export default defineComponent({ this.connection.on('folderUpdated', this.onStreamDriveFolderUpdated); this.connection.on('folderDeleted', this.onStreamDriveFolderDeleted); - if (this.initFolder) { - this.move(this.initFolder); + if (this.initialFolder) { + this.move(this.initialFolder); } else { this.fetch(); } @@ -639,6 +639,10 @@ export default defineComponent({