-
+
+
+ Change icon
+
@@ -184,7 +190,8 @@ function onStopEdit() {
-
+
{{ vModel.alias || vModel.title }}
@@ -199,7 +206,8 @@ function onStopEdit() {
{{ $t('activity.copyView') }}
-
+
diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.ts
index b0ddc867db..cb0c5ea8c5 100644
--- a/packages/nc-gui/composables/useSharedView.ts
+++ b/packages/nc-gui/composables/useSharedView.ts
@@ -58,8 +58,11 @@ export function useSharedView() {
'xc-password': localPassword ?? password.value,
},
})
-
- allowCSVDownload.value = JSON.parse(viewMeta.meta)?.allowCSVDownload
+ try {
+ allowCSVDownload.value = (typeof viewMeta.meta === 'string' ? JSON.parse(viewMeta.meta) : viewMeta.meta)?.allowCSVDownload
+ } catch {
+ allowCSVDownload.value = false
+ }
if (localPassword) password.value = localPassword
sharedView.value = { title: '', ...viewMeta }
diff --git a/packages/nc-gui/layouts/shared-view.vue b/packages/nc-gui/layouts/shared-view.vue
index 986213d401..797f68f5d4 100644
--- a/packages/nc-gui/layouts/shared-view.vue
+++ b/packages/nc-gui/layouts/shared-view.vue
@@ -58,7 +58,8 @@ export default {
-
+
+
{{ sharedView?.title }}
diff --git a/packages/nocodb/src/lib/models/View.ts b/packages/nocodb/src/lib/models/View.ts
index 06c092cc04..cc83d8bfea 100644
--- a/packages/nocodb/src/lib/models/View.ts
+++ b/packages/nocodb/src/lib/models/View.ts
@@ -5,7 +5,7 @@ import {
CacheScope,
MetaTable,
} from '../utils/globals';
-import { parseMetaProp, stringifyMetaProp } from '../utils/modelUtils'
+import { parseMetaProp, stringifyMetaProp } from '../utils/modelUtils';
import Model from './Model';
import FormView from './FormView';
import GridView from './GridView';
@@ -715,11 +715,16 @@ export default class View implements ViewType {
}
}
+ // todo: cache
static async getByUUID(uuid: string, ncMeta = Noco.ncMeta) {
const view = await ncMeta.metaGet2(null, null, MetaTable.VIEWS, {
uuid,
});
+ if (view) {
+ parseMetaProp(view);
+ }
+
return view && new View(view);
}
@@ -748,8 +753,9 @@ export default class View implements ViewType {
viewId
);
}
- if (!view.meta) {
+ if (!view.meta || !('allowCSVDownload' in view.meta)) {
const defaultMeta = {
+ ...(view.meta ?? {}),
allowCSVDownload: true,
};
// get existing cache
@@ -757,7 +763,7 @@ export default class View implements ViewType {
const o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (o) {
// update data
- o.meta = JSON.stringify(defaultMeta);
+ o.meta = defaultMeta;
// set cache
await NocoCache.set(key, o);
}
diff --git a/packages/nocodb/src/lib/utils/modelUtils.ts b/packages/nocodb/src/lib/utils/modelUtils.ts
index f2b6c7b96c..130e081f0a 100644
--- a/packages/nocodb/src/lib/utils/modelUtils.ts
+++ b/packages/nocodb/src/lib/utils/modelUtils.ts
@@ -1,5 +1,7 @@
-export function parseMetaProp(modelOrModelList: { meta: any } | { meta: any }[]) {
- if (!modelOrModelList) return
+export function parseMetaProp(
+ modelOrModelList: { meta: any } | { meta: any }[]
+) {
+ if (!modelOrModelList) return;
// parse meta property
for (const model of Array.isArray(modelOrModelList)
@@ -7,17 +9,17 @@ export function parseMetaProp(modelOrModelList: { meta: any } | { meta: any }[])
: [modelOrModelList]) {
try {
model.meta =
- typeof model.meta === 'string' ? JSON.parse(model.meta) : model.meta
+ typeof model.meta === 'string' ? JSON.parse(model.meta) : model.meta;
} catch {
- model.meta = {}
+ model.meta = {};
}
}
}
export function stringifyMetaProp(
- modelOrModelList: { meta?: any } | { meta?: any }[],
+ modelOrModelList: { meta?: any } | { meta?: any }[]
) {
- if (!modelOrModelList) return
+ if (!modelOrModelList) return;
// parse meta property
for (const model of Array.isArray(modelOrModelList)
@@ -25,9 +27,9 @@ export function stringifyMetaProp(
: [modelOrModelList]) {
try {
model.meta =
- typeof model.meta !== 'string' ? model.meta : JSON.parse(model.meta)
+ typeof model.meta === 'string' ? model.meta : JSON.stringify(model.meta);
} catch (e) {
- model.meta = '{}'
+ model.meta = '{}';
}
}
}