diff --git a/packages/nc-gui/components/base/shareBase.vue b/packages/nc-gui/components/base/shareBase.vue index b61612234e..07cccfa779 100644 --- a/packages/nc-gui/components/base/shareBase.vue +++ b/packages/nc-gui/components/base/shareBase.vue @@ -5,44 +5,10 @@ Shared base link
- - - - - - - mdi-link-variant - - Readonly link - - - - - - mdi-link-variant-off - - Disable shared base - - - - - - +
- {{ url }} + {{ url }} + mdi-reload @@ -58,6 +24,78 @@
+ +
+
+ + + + + + + mdi-link-variant + + Anyone with the link + + + + + + mdi-link-variant-off + + Disable shared base + + + + +
+ + +
+
+ +
+ + + + + + + Editor + + + + + Viewer + + + + +
+
@@ -92,9 +130,9 @@ export default { console.log(e) } }, - async createSharedBase() { + async createSharedBase(roles = 'viewer') { try { - const sharedBase = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: 'db' }, 'createSharedBaseLink']) + const sharedBase = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: 'db' }, 'createSharedBaseLink', { roles }]) this.base = sharedBase || {} } catch (e) { this.$toast.error(e.message).goAway(3000) @@ -157,4 +195,5 @@ style="background: transparent; border: 1px solid #ddd">`) background: var(--v-backgroundColor-base); padding: 20px 20px; } +/deep/ .nc-url-chip .v-chip__content{width: 100%} diff --git a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue index 6be60c7fd3..a7d83e55b2 100644 --- a/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue +++ b/packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue @@ -871,6 +871,7 @@ export default { const { row: rowObj, rowMeta } = this.data[row] if (rowMeta.new) { try { + this.$set(this.data[row], 'saving', true) const pks = this.meta.columns.filter((col) => { return col.pk }) @@ -910,6 +911,8 @@ export default { this.$toast.error(`Failed to save row : ${e.message}`).goAway(3000) } } + + this.$set(this.data[row], 'saving', false) } } }, @@ -943,6 +946,7 @@ export default { if (!id) { return this.$toast.info('Update not allowed for table which doesn\'t have primary Key').goAway(3000) } + this.$set(this.data[row], 'saving', true) const newData = await this.api.update(id, { [column._cn]: rowObj[column._cn] @@ -961,6 +965,8 @@ export default { this.$toast.error(`Failed to update row : ${e.message}`).goAway(3000) } } + + this.$set(this.data[row], 'saving', false) } }, async deleteRow() { diff --git a/packages/nc-gui/layouts/shared.vue b/packages/nc-gui/layouts/shared.vue index f35ac026ce..57629b0ee5 100644 --- a/packages/nc-gui/layouts/shared.vue +++ b/packages/nc-gui/layouts/shared.vue @@ -1,7 +1,6 @@ diff --git a/packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts b/packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts index b181164a09..6f39d72606 100644 --- a/packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts +++ b/packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts @@ -3447,12 +3447,18 @@ export default class NcMetaMgr { } ); + let roles = args?.args?.roles; + if (!roles || (roles !== 'editor' && roles !== 'viewer')) { + roles = 'viewer'; + } + if (!sharedBase) { const insertData = { project_id: args.project_id, db_alias: this.getDbAlias(args), shared_base_id: uuidv4(), - password: args?.args?.password + password: args?.args?.password, + roles }; await this.xcMeta.metaInsert( @@ -3466,8 +3472,19 @@ export default class NcMetaMgr { this.getDbAlias(args), 'nc_shared_bases', {}, - ['id', 'shared_base_id', 'enabled'] + ['id', 'shared_base_id', 'enabled', 'roles'] + ); + } else { + await this.xcMeta.metaUpdate( + this.getProjectId(args), + this.getDbAlias(args), + 'nc_shared_bases', + { roles }, + { + project_id: this.getProjectId(args) + } ); + sharedBase.roles = roles; } sharedBase.url = `${req.ncSiteUrl}${this.config.dashboardPath}#/nc/base/${sharedBase.shared_base_id}`;