diff --git a/web/satellite/src/components/accessGrants/SortingHeader.vue b/web/satellite/src/components/accessGrants/SortingHeader.vue index 776106d05..e2880058b 100644 --- a/web/satellite/src/components/accessGrants/SortingHeader.vue +++ b/web/satellite/src/components/accessGrants/SortingHeader.vue @@ -37,6 +37,8 @@ export default class SortAccessGrantsHeader extends Vue { @Prop({default: () => new Promise(() => false)}) private readonly onHeaderClickCallback: OnHeaderClickCallback; + public AccessGrantsOrderBy = AccessGrantsOrderBy; + public sortBy: AccessGrantsOrderBy = AccessGrantsOrderBy.NAME; public sortDirection: SortDirection = SortDirection.ASCENDING; diff --git a/web/satellite/src/components/accessGrants/permissions/BucketsSelection.vue b/web/satellite/src/components/accessGrants/permissions/BucketsSelection.vue index 4f6f6ce9e..a242644b0 100644 --- a/web/satellite/src/components/accessGrants/permissions/BucketsSelection.vue +++ b/web/satellite/src/components/accessGrants/permissions/BucketsSelection.vue @@ -64,26 +64,12 @@ export default class BucketsSelection extends Vue { return this.storedBucketNames.length.toString(); } - /** - * Returns selected bucket names from store or all bucket names. - */ - public get selectedBucketNames(): string[] { - return this.storedBucketNames.length ? this.storedBucketNames : this.allBucketNames; - } - /** * Returns stored selected bucket names. */ - public get storedBucketNames(): string[] { + private get storedBucketNames(): string[] { return this.$store.state.accessGrantsModule.selectedBucketNames; } - - /** - * Returns all bucket names. - */ - public get allBucketNames(): string[] { - return this.$store.state.bucketUsageModule.allBucketNames; - } } diff --git a/web/satellite/src/components/accessGrants/steps/PermissionsStep.vue b/web/satellite/src/components/accessGrants/steps/PermissionsStep.vue index fe843b59f..6aa85ca5c 100644 --- a/web/satellite/src/components/accessGrants/steps/PermissionsStep.vue +++ b/web/satellite/src/components/accessGrants/steps/PermissionsStep.vue @@ -11,12 +11,12 @@
- - + +
- - + +
@@ -40,7 +40,7 @@
@@ -90,8 +90,8 @@ export default class PermissionsStep extends Vue { private restrictedKey: string = ''; private worker: Worker; - public isRead: boolean = true; - public isWrite: boolean = true; + public isDownload: boolean = true; + public isUpload: boolean = true; public isList: boolean = true; public isDelete: boolean = true; @@ -156,16 +156,44 @@ export default class PermissionsStep extends Vue { * Holds on continue in browser button click logic. */ public onContinueInBrowserClick(): void { - // mock - return; + this.worker.postMessage({ + 'type': 'SetPermission', + 'isDownload': this.isDownload, + 'isUpload': this.isUpload, + 'isList': this.isList, + 'isDelete': this.isDelete, + 'buckets': this.selectedBucketNames, + 'apiKey': this.key, + }); + + this.$router.push({ + name: RouteConfig.AccessGrants.with(RouteConfig.CreateAccessGrant.with(RouteConfig.PassphraseStep)).name, + params: { + key: this.restrictedKey, + }, + }); } /** * Returns stored selected bucket names. */ - public get selectedBucketNames(): string[] { + public get storedBucketNames(): string[] { return this.$store.state.accessGrantsModule.selectedBucketNames; } + + /** + * Returns selected bucket names from store or all bucket names. + */ + private get selectedBucketNames(): string[] { + return this.storedBucketNames.length ? this.storedBucketNames : this.allBucketNames; + } + + /** + * Returns all bucket names. + */ + private get allBucketNames(): string[] { + return this.$store.state.bucketUsageModule.allBucketNames; + } } diff --git a/web/satellite/static/wasm/webWorker.js b/web/satellite/static/wasm/webWorker.js index 9599de176..453c7bc95 100644 --- a/web/satellite/static/wasm/webWorker.js +++ b/web/satellite/static/wasm/webWorker.js @@ -18,21 +18,30 @@ const response = fetch('/static/static/wasm/access.wasm'); instantiateStreaming(response, go.importObject).then(result => go.run(result.instance)).catch(err => self.postMessage(new Error(err.message))); self.onmessage = function (event) { - const type = event.data.type; + const data = event.data; let result; - switch (type) { + switch (data.type) { case 'GenerateAccess': result = self.generateAccessGrant(); - self.postMessage(result); - break; - case 'NewPermission': - result = self.newPermission(); - self.postMessage(result); break; case 'SetPermission': - result = self.setAPIKeyPermission(); + const isDownload = data.isDownload; + const isUpload = data.isUpload; + const isList = data.isList; + const isDelete = data.isDelete; + const buckets = data.buckets; + const apiKey = data.apiKey; + + let permission = self.newPermission().value; + + permission.AllowDownload = isDownload; + permission.AllowUpload = isUpload; + permission.AllowDelete = isDelete; + permission.AllowList = isList; + + result = self.setAPIKeyPermission(apiKey, buckets, permission); self.postMessage(result); break;