diff --git a/frontend/src/components/prompts/Prompts.vue b/frontend/src/components/prompts/Prompts.vue index bb4a7c9b..9e2738e5 100644 --- a/frontend/src/components/prompts/Prompts.vue +++ b/frontend/src/components/prompts/Prompts.vue @@ -19,6 +19,7 @@ import Replace from './Replace' import ReplaceRename from './ReplaceRename' import Share from './Share' import Upload from './Upload' +import ShareDelete from './ShareDelete' import { mapState } from 'vuex' import buttons from '@/utils/buttons' @@ -37,7 +38,8 @@ export default { Help, Replace, ReplaceRename, - Upload + Upload, + ShareDelete }, data: function () { return { @@ -91,7 +93,8 @@ export default { 'replace', 'replace-rename', 'share', - 'upload' + 'upload', + 'share-delete' ].indexOf(this.show) >= 0; return matched && this.show || null; diff --git a/frontend/src/components/prompts/ShareDelete.vue b/frontend/src/components/prompts/ShareDelete.vue new file mode 100644 index 00000000..c927f104 --- /dev/null +++ b/frontend/src/components/prompts/ShareDelete.vue @@ -0,0 +1,47 @@ + + + + {{ $t('prompts.deleteMessageShare', {path: hash.path}) }} + + + {{ $t('buttons.cancel') }} + {{ $t('buttons.delete') }} + + + + + diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 74eeb09a..5c3a451f 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -115,6 +115,7 @@ "currentlyNavigating": "Currently navigating on:", "deleteMessageMultiple": "Are you sure you want to delete {count} file(s)?", "deleteMessageSingle": "Are you sure you want to delete this file/folder?", + "deleteMessageShare": "Are you sure you want to delete this share({path})?", "deleteTitle": "Delete files", "displayName": "Display Name:", "download": "Download files", diff --git a/frontend/src/i18n/zh-cn.json b/frontend/src/i18n/zh-cn.json index aed3807e..ddd021bf 100644 --- a/frontend/src/i18n/zh-cn.json +++ b/frontend/src/i18n/zh-cn.json @@ -115,6 +115,7 @@ "currentlyNavigating": "当前目录:", "deleteMessageMultiple": "你确定要删除这 {count} 个文件吗?", "deleteMessageSingle": "你确定要删除这个文件/文件夹吗?", + "deleteMessageShare": "你确定要删除这个分享({path})吗?", "deleteTitle": "删除文件", "displayName": "名称:", "download": "下载文件", diff --git a/frontend/src/views/settings/Shares.vue b/frontend/src/views/settings/Shares.vue index 04d62c4e..d8a2bb54 100644 --- a/frontend/src/views/settings/Shares.vue +++ b/frontend/src/views/settings/Shares.vue @@ -73,19 +73,23 @@ export default { this.clip.on('success', () => { this.$showSuccess(this.$t('success.linkCopied')) }) + this.$root.$on('share-deleted', this.deleted) }, beforeDestroy () { this.clip.destroy() + this.$root.$off('share-deleted', this.deleted) }, methods: { deleteLink: async function (event, link) { event.preventDefault() - try { - await api.remove(link.hash) - this.links = this.links.filter(item => item.hash !== link.hash) - } catch (e) { - this.$showError(e) - } + this.$store.commit('setHash', { + hash: link.hash, + path: link.path + }) + this.$store.commit('showHover', 'share-delete') + }, + deleted (hash) { + this.links = this.links.filter(item => item.hash !== hash) }, humanTime (time) { return moment(time * 1000).fromNow()
{{ $t('prompts.deleteMessageShare', {path: hash.path}) }}