diff --git a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue
index 33266b2bf9..b46def2fab 100644
--- a/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue
+++ b/packages/nc-gui/components/project/spreadsheet/components/SharedViewsList.vue
@@ -51,8 +51,8 @@
-
- {{ ~~currentView.download === 1 ? '✔️' : '❌' }}
+
+ {{ (~~(JSON.parse(currentView.meta).allowCSVDownload) === 1) ? '✔️' : '❌' }}
|
@@ -94,8 +94,8 @@
|
-
- {{ ~~link.download === 1 ? '✔️' : '❌' }}
+
+ {{ ~~((JSON.parse(link.meta)).allowCSVDownload) === 1 ? '✔️' : '❌' }}
|
diff --git a/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue b/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue
index fcfeaa83ac..8301d09348 100644
--- a/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue
+++ b/packages/nc-gui/components/project/spreadsheet/components/SpreadsheetNavDrawer.vue
@@ -443,12 +443,12 @@
@@ -525,7 +525,7 @@ export default {
searchQueryVal: '',
showShareLinkPassword: false,
passwordProtect: false,
- allowDownload: true,
+ allowCSVDownload: true,
sharedViewPassword: '',
overAdvShieldIcon: false,
overShieldIcon: false,
@@ -724,8 +724,8 @@ export default {
this.saveShareLinkPassword()
}
},
- onAllowDownloadChange() {
- this.saveAllowDownload()
+ onAllowCSVDownloadChange() {
+ this.saveAllowCSVDownload()
},
async saveShareLinkPassword() {
try {
@@ -750,10 +750,12 @@ export default {
this.$e('a:view:share:enable-pwd')
},
- async saveAllowDownload() {
+ async saveAllowCSVDownload() {
try {
+ const meta = JSON.parse(this.shareLink.meta)
+ meta.allowCSVDownload = this.allowCSVDownload
await this.$api.dbViewShare.update(this.shareLink.id, {
- download: this.allowDownload
+ meta: JSON.stringify(meta)
})
this.$toast.success('Successfully updated').goAway(3000)
} catch (e) {
@@ -761,10 +763,10 @@ export default {
.error(await this._extractSdkResponseErrorMsg(e))
.goAway(3000)
}
- if (this.allowDownload) {
- this.$e('a:view:share:enable-download')
+ if (this.allowCSVDownload) {
+ this.$e('a:view:share:enable-csv-download')
} else {
- this.$e('a:view:share:disable-download')
+ this.$e('a:view:share:disable-csv-download')
}
},
async loadViews() {
@@ -872,7 +874,7 @@ export default {
// todo: url
this.shareLink = shared
this.passwordProtect = shared.password !== null
- this.allowDownload = shared.download
+ this.allowCSVDownload = JSON.parse(shared.meta).allowCSVDownload
this.showShareModel = true
},
copyView(view, i) {
diff --git a/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue b/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue
index aaaf854d7b..12ba9c0a44 100644
--- a/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue
+++ b/packages/nc-gui/components/project/spreadsheet/public/XcTable.vue
@@ -49,7 +49,7 @@
/>
{
await knex.schema.alterTable(MetaTable.VIEWS, (table) => {
- table.boolean('download').defaultTo(true);
+ table.text('meta');
});
};
const down = async (knex) => {
await knex.schema.alterTable(MetaTable.VIEWS, (table) => {
- table.dropColumns('download');
+ table.dropColumns('meta');
});
};
diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts
index 3ceceb8ba6..3eeb5cfc92 100644
--- a/packages/nocodb/src/lib/models/View.ts
+++ b/packages/nocodb/src/lib/models/View.ts
@@ -42,7 +42,7 @@ export default class View implements ViewType {
project_id?: string;
base_id?: string;
show_system_fields?: boolean;
- download?: boolean;
+ meta?: string;
constructor(data: View) {
Object.assign(this, data);
@@ -615,7 +615,30 @@ export default class View implements ViewType {
viewId
);
}
-
+ if (!view.meta) {
+ const defaultMeta = {
+ allowCSVDownload: true
+ }
+ // get existing cache
+ const key = `${CacheScope.VIEW}:${view.id}`;
+ const o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
+ if (o) {
+ // update data
+ o.meta = JSON.stringify(defaultMeta);
+ // set cache
+ await NocoCache.set(key, o);
+ }
+ // set meta
+ await ncMeta.metaUpdate(
+ null,
+ null,
+ MetaTable.VIEWS,
+ {
+ meta: JSON.stringify(defaultMeta),
+ },
+ viewId
+ );
+ }
return view;
}
@@ -685,7 +708,7 @@ export default class View implements ViewType {
'show_system_fields',
'lock_type',
'password',
- 'download',
+ 'meta',
'uuid',
]);
// get existing cache
|