EnxDev commented on code in PR #36332:
URL: https://github.com/apache/superset/pull/36332#discussion_r2584457209
##########
superset-frontend/src/explore/components/SaveModal.tsx:
##########
@@ -290,6 +330,99 @@ class SaveModal extends Component<SaveModalProps,
SaveModalState> {
}
}
+ /* Adds a new chart to a new row on the specified dashboard tab.
+ * @param {number} dashboardId - ID of the dashboard.
+ * @param {number} chartId - ID of the chart to add.
+ * @param {string} tabId - ID of the dashboard tab where the chart is added.
+ * @param {string | undefined} sliceName - Chart name
+ * */
+ addChartToDashboardTab = async (
+ dashboardId: number,
+ chartId: number,
+ tabId: string,
+ sliceName: string | undefined,
+ ) => {
+ try {
+ const dashboardResponse = await SupersetClient.get({
+ endpoint: `/api/v1/dashboard/${dashboardId}`,
+ });
+
+ const dashboard = dashboardResponse.json.result;
+
+ let positionJson = dashboard.position_json;
+ if (typeof positionJson === 'string') {
+ positionJson = JSON.parse(positionJson);
+ }
+ positionJson = positionJson || {};
+
+ const updatedPositionJson = JSON.parse(JSON.stringify(positionJson));
Review Comment:
Do we need this deep clone?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]