Skip to content

Commit 43d4859

Browse files
committed
feat(dashboard): download content json without content’s metadata
1 parent 46581f1 commit 43d4859

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

dashboard/src/components/view/view-component/render/division.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const DivActions = observer(({ downloadScreenShot }: { downloadScreenShot
1414
const content = useRenderContentModelContext();
1515

1616
const downloadSchema = () => {
17-
const schema = JSON.stringify(content.json, null, 2);
17+
const schema = JSON.stringify(content.contentJSON, null, 2);
1818
const filename = `${model.name}__${content.name}`;
1919
downloadJSON(filename, schema);
2020
};

dashboard/src/dashboard-editor/model/content/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ const _ContentModel = types
7676
},
7777
};
7878
},
79+
get contentJSON(): DashboardContentDBType['content'] {
80+
return this.json.content;
81+
},
7982
get filtersChanged() {
8083
const fields = 'filters.current';
8184
return !isEqual(getSnapshot(get(self, fields)), get(self.origin, fields));

dashboard/src/dashboard-editor/ui/header/header-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const HeaderMenu = observer(() => {
99
const content = useEditContentModelContext();
1010

1111
const downloadSchema = () => {
12-
const schema = JSON.stringify(content.json, null, 2);
12+
const schema = JSON.stringify(content.contentJSON, null, 2);
1313
const filename = `${model.name}__${content.name}`;
1414
downloadJSON(filename, schema);
1515
};

dashboard/src/dashboard-render/model/content.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export const ContentRenderModel = types
6464
},
6565
};
6666
},
67+
get contentJSON(): DashboardContentDBType['content'] {
68+
return this.json.content;
69+
},
6770
get payloadForSQL(): TPayloadForSQL {
6871
// @ts-expect-error type of getParent
6972
const context = getParent(self).context.current;

0 commit comments

Comments
 (0)