From 4123b426f656aa4fa7799f956a57f66cf26034ee Mon Sep 17 00:00:00 2001 From: HangLe Date: Thu, 1 Dec 2022 16:37:49 +0200 Subject: [PATCH 01/10] Fix for redirecting to AllFolders view after changing project --- .../src/components/BrowserSecondaryNavbar.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/swift_browser_ui_frontend/src/components/BrowserSecondaryNavbar.vue b/swift_browser_ui_frontend/src/components/BrowserSecondaryNavbar.vue index 1051252aa..049f181d7 100644 --- a/swift_browser_ui_frontend/src/components/BrowserSecondaryNavbar.vue +++ b/swift_browser_ui_frontend/src/components/BrowserSecondaryNavbar.vue @@ -96,10 +96,9 @@ export default { const item = event.target.value; if (item.id !== this.active.id) { const navigationParams = { - name: this.$router.name, + name: "AllFolders", params: {user: this.uname, project: item.id}, }; - // Pushing to router before ´go´ method // enables navigation with updated item id this.$router.push(navigationParams); From eda6cbc40d47c837dcf24b3f4430e31dd7f06b72 Mon Sep 17 00:00:00 2001 From: HangLe Date: Mon, 5 Dec 2022 18:04:38 +0200 Subject: [PATCH 02/10] Fix some bugs for Share modal - Fix Notification for removing a shared permission - Fix function when removing a permission --- .github/config/.finnishwords.txt | 3 + swift_browser_ui_frontend/src/common/lang.js | 4 +- .../src/components/ShareModal.vue | 68 +++++++++++++------ .../src/components/ShareModalTable.vue | 15 ++-- 4 files changed, 58 insertions(+), 32 deletions(-) diff --git a/.github/config/.finnishwords.txt b/.github/config/.finnishwords.txt index 8c58ae752..e7ae7ee91 100644 --- a/.github/config/.finnishwords.txt +++ b/.github/config/.finnishwords.txt @@ -204,6 +204,7 @@ luo luonnin luonti luotu +lupa määrä määrästä mahdollisia @@ -268,6 +269,7 @@ omistavan on ongelmiin onnistui +onnistuneesti onnistunut onnistuu operaatio @@ -303,6 +305,7 @@ poista poistaa poistaminen poistettava +poistettiin poistettu polku postamista diff --git a/swift_browser_ui_frontend/src/common/lang.js b/swift_browser_ui_frontend/src/common/lang.js index 8ec546dab..219108dbd 100644 --- a/swift_browser_ui_frontend/src/common/lang.js +++ b/swift_browser_ui_frontend/src/common/lang.js @@ -194,6 +194,7 @@ let default_translations = { read_perm: "Read", write_perm: "Read and write", shared_successfully: "Folder was shared successfully!", + remove_permission: "Permission was removed successfully!", project_id: "Project ID", field_label: "Project Identifiers to share with", field_placeholder: "Add Share IDs", @@ -640,7 +641,8 @@ let default_translations = { read_perm: "Salli säiliön luku", write_perm: "Salli säiliöön kirjoitus", shared_successfully: "Kansion jakaminen onnistui!", - project_id: "Jaa tunnus", + remove_permission: "Lupa poistettiin onnistuneesti!", + project_id: "Projektin tunnus", field_label: "Jaa projektitunnisteille", field_placeholder: "Lisää projektitunnukset", cancel: "Peru", diff --git a/swift_browser_ui_frontend/src/components/ShareModal.vue b/swift_browser_ui_frontend/src/components/ShareModal.vue index ffe7faf1f..a5b94699b 100644 --- a/swift_browser_ui_frontend/src/components/ShareModal.vue +++ b/swift_browser_ui_frontend/src/components/ShareModal.vue @@ -83,25 +83,27 @@ + +
+ {{ isShared ? $t('message.share.shared_successfully') + : $t('message.share.remove_permission') + }} + + + + + {{ $t("message.share.close") }} + +
+
- -
- {{ $t('message.share.shared_successfully') }} - - - - - {{ $t("message.share.close") }} - -
-
@@ -139,6 +140,8 @@ export default { sharedAccessRight: null, isShared: false, sharedDetails: [], + isPermissionRemoved: false, + timeout: null, }; }, computed: { @@ -154,7 +157,7 @@ export default { this.setAccessRights(); }, folderName: function () { - if (this.folderName) this.getSharedDetails(); + if (this.folderName) this.getSharedDetails(); }, read: function () { if(!this.read) { @@ -204,6 +207,16 @@ export default { if (ret) { this.isShared = true; this.getSharedDetails(); + + if (this.timeout !== null) { + clearTimeout(this.timeout); + this.timeout = null; + if(this.isPermissionRemoved) { + this.isPermissionRemoved = false; + } + } + this.timeout = setTimeout( + () => this.closeSharedNotification(), 3000); } }, ); @@ -266,6 +279,7 @@ export default { throw error; } } + await addAccessControlMeta( this.$route.params.project, this.folderName, @@ -280,12 +294,14 @@ export default { toggleShareModal: function () { this.$store.commit("toggleShareModal", false); this.$store.commit("setFolderName", ""); + this.sharedAccessRight = null; this.openShareGuide = false; this.tags = []; this.isShared = false; + this.isPermissionRemoved = false; }, closeSharedNotification: function () { - this.isShared = false; + this.isShared ? this.isShared = false : this.isPermissionRemoved = false; }, getSharedDetails: function () { this.$store.state.client.getShareDetails( @@ -301,6 +317,16 @@ export default { item => { return item.sharedTo !== folderData.projectId.value; }); + this.isPermissionRemoved = true; + + if (this.timeout !== null) { + clearTimeout(this.timeout); + this.timeout = null; + if (this.isShared) { + this.isShared = false; + } + } + this.timeout = setTimeout(() => this.isPermissionRemoved = false, 3000); }, }, }; diff --git a/swift_browser_ui_frontend/src/components/ShareModalTable.vue b/swift_browser_ui_frontend/src/components/ShareModalTable.vue index 9083b63c6..2f73718fa 100644 --- a/swift_browser_ui_frontend/src/components/ShareModalTable.vue +++ b/swift_browser_ui_frontend/src/components/ShareModalTable.vue @@ -63,7 +63,7 @@ export default { title: this.$t("message.remove"), onClick: ({ data }) => { this.$emit("removeSharedFolder", data); - this.deleteFolderShare(); + this.deleteFolderShare(data); }, }, }, @@ -129,22 +129,17 @@ export default { rights, ); }, - deleteFolderShare: function () { + deleteFolderShare: function (folderData) { removeAccessControlMeta( this.projectId, this.folderName, ).then( () => { - this.$store.state.client.shareContainerDeleteAccess( + this.$store.state.client.shareDeleteAccess( this.projectId, this.folderName, - ).then(() => { - this.$buefy.toast.open({ - duration: 5000, - message: this.$t("message.share.success_delete"), - type: "is-success", - }); - }); + [folderData.projectId.value], + ); }, ); }, From 907e3c65af3403f0d2c2188c98a043fac2ec85a7 Mon Sep 17 00:00:00 2001 From: HangLe Date: Mon, 5 Dec 2022 18:47:19 +0200 Subject: [PATCH 03/10] Fix for modal's scroll position to always show from top --- .../src/components/CreateFolderModal.vue | 2 +- .../src/components/UploadModal.vue | 10 ++---- swift_browser_ui_frontend/src/entries/main.js | 33 ++++++++++++++----- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/swift_browser_ui_frontend/src/components/CreateFolderModal.vue b/swift_browser_ui_frontend/src/components/CreateFolderModal.vue index 52863ce72..9139c8aaa 100644 --- a/swift_browser_ui_frontend/src/components/CreateFolderModal.vue +++ b/swift_browser_ui_frontend/src/components/CreateFolderModal.vue @@ -1,6 +1,6 @@