Skip to content

Commit 2e1683f

Browse files
authored
Merge pull request #965 from CSCfi/feature/share-modal
Show notification when changing permission in share modal
2 parents 8ddf1dc + 2bfb52a commit 2e1683f

File tree

5 files changed

+32
-24
lines changed

5 files changed

+32
-24
lines changed

Diff for: .github/config/.finnishwords.txt

+1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ mutta
238238
muussa
239239
muutaman
240240
muutamia
241+
muutettiin
241242
muuttaa
242243
muuttaaksesi
243244
näkyvissä

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- Show notification when changing permission in share modal
1213
- Use OIDC as the default Keystone login provider for SSO
1314
- (GH #864) Vault c4ghtransit integration - Uploads object headers to Vault in addition to Object Storage
1415
- (GH #781) Render full details of Folders you have shared and Folders shared with you

Diff for: swift_browser_ui_frontend/src/common/lang.js

+2
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ let default_translations = {
203203
write_perm: "Read and write",
204204
shared_successfully: "Folder was shared successfully!",
205205
remove_permission: "Permission was removed successfully!",
206+
update_permission: "Permission was changed successfully.",
206207
shared_table_title: "Project's folder has been shared with",
207208
field_label: "Project Identifiers to share with",
208209
field_placeholder: "Add Share IDs",
@@ -663,6 +664,7 @@ let default_translations = {
663664
write_perm: "Salli säiliöön kirjoitus",
664665
shared_successfully: "Kansion jakaminen onnistui!",
665666
remove_permission: "Lupa poistettiin onnistuneesti!",
667+
update_permission: "Lupa muutettiin onnistuneesti.",
666668
shared_table_title: "Projektin kansio on jaettu",
667669
project_id: "Projektin tunnus",
668670
field_label: "Jaa projektitunnisteille",

Diff for: swift_browser_ui_frontend/src/components/ShareModal.vue

+27-24
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{{ $t("message.share.close") }}
1717
</c-button>
1818
</header>
19-
<c-card-content>
19+
<c-card-content id="share-card-modal-content">
2020
<h6 class="subtitle is-6 has-text-dark">
2121
{{ $t("message.share.share_subtitle") }}
2222
</h6>
@@ -86,12 +86,13 @@
8686
</c-flex>
8787
</c-container>
8888
<c-alert
89-
v-show="isShared || isPermissionRemoved"
89+
v-show="isShared || isPermissionRemoved || isPermissionUpdated"
9090
type="success"
9191
>
9292
<div class="shared-notification">
9393
{{ isShared ? $t('message.share.shared_successfully')
94-
: $t('message.share.remove_permission')
94+
: isPermissionUpdated ? $t('message.share.update_permission')
95+
: $t('message.share.remove_permission')
9596
}}
9697
<c-button
9798
text
@@ -111,6 +112,7 @@
111112
:folder-name="folderName"
112113
:access-rights="accessRights"
113114
@removeSharedFolder="removeSharedFolder"
115+
@updateSharedFolder="updateSharedFolder"
114116
/>
115117
</c-container>
116118
</c-card-content>
@@ -143,6 +145,7 @@ export default {
143145
isShared: false,
144146
sharedDetails: [],
145147
isPermissionRemoved: false,
148+
isPermissionUpdated: false,
146149
timeout: null,
147150
};
148151
},
@@ -207,18 +210,10 @@ export default {
207210
(ret) => {
208211
this.loading = false;
209212
if (ret) {
210-
this.isShared = true;
211213
this.getSharedDetails();
212-
213-
if (this.timeout !== null) {
214-
clearTimeout(this.timeout);
215-
this.timeout = null;
216-
if(this.isPermissionRemoved) {
217-
this.isPermissionRemoved = false;
218-
}
219-
}
220-
this.timeout = setTimeout(
221-
() => this.closeSharedNotification(), 3000);
214+
this.closeSharedNotification();
215+
this.isShared = true;
216+
this.closeSharedNotificationWithTimeout();
222217
}
223218
},
224219
);
@@ -302,8 +297,18 @@ export default {
302297
this.isShared = false;
303298
this.isPermissionRemoved = false;
304299
},
300+
closeSharedNotificationWithTimeout() {
301+
document.getElementById("share-card-modal-content").scrollTo(0, 0);
302+
this.timeout = setTimeout(() => this.closeSharedNotification(), 3000);
303+
},
305304
closeSharedNotification: function () {
306-
this.isShared ? this.isShared = false : this.isPermissionRemoved = false;
305+
if (this.timeout !== null) {
306+
clearTimeout(this.timeout);
307+
}
308+
309+
this.isShared = false;
310+
this.isPermissionRemoved = false;
311+
this.isPermissionUpdated = false;
307312
},
308313
getSharedDetails: function () {
309314
this.$store.state.client.getShareDetails(
@@ -314,21 +319,19 @@ export default {
314319
this.tags = [];
315320
});
316321
},
322+
updateSharedFolder: function () {
323+
this.closeSharedNotification();
324+
this.isPermissionUpdated = true;
325+
this.closeSharedNotificationWithTimeout();
326+
},
317327
removeSharedFolder: function (folderData) {
328+
this.closeSharedNotification();
318329
this.sharedDetails = this.sharedDetails.filter(
319330
item => {
320331
return item.sharedTo !== folderData.projectId.value;
321332
});
322333
this.isPermissionRemoved = true;
323-
324-
if (this.timeout !== null) {
325-
clearTimeout(this.timeout);
326-
this.timeout = null;
327-
if (this.isShared) {
328-
this.isShared = false;
329-
}
330-
}
331-
this.timeout = setTimeout(() => this.isPermissionRemoved = false, 3000);
334+
this.closeSharedNotificationWithTimeout();
332335
},
333336
},
334337
};

Diff for: swift_browser_ui_frontend/src/components/ShareModalTable.vue

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export default {
133133
[sharedProjectId],
134134
rights,
135135
);
136+
this.$emit("updateSharedFolder");
136137
},
137138
deleteFolderShare: function (folderData) {
138139
removeAccessControlMeta(

0 commit comments

Comments
 (0)