You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2025/03/14 14:36:50 UTC
(superset) branch master updated: fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode (#32646)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 777760b096 fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode (#32646)
777760b096 is described below
commit 777760b0966e23d24ba3c816a78b09bb36ac4176
Author: Andrey Yakir <49...@users.noreply.github.com>
AuthorDate: Fri Mar 14 16:36:42 2025 +0200
fix(dashboard): Ensure `dashboardId` is included in `form_data` for embedded mode (#32646)
---
.../src/dashboard/components/gridComponents/Chart.jsx | 3 +++
.../src/dashboard/components/gridComponents/Chart.test.jsx | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
index 5cc8ba6d37..2d48448815 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
@@ -157,6 +157,7 @@ const Chart = props => {
state.datasources[chart.form_data.datasource]) ||
PLACEHOLDER_DATASOURCE,
);
+ const dashboardInfo = useSelector(state => state.dashboardInfo);
const [descriptionHeight, setDescriptionHeight] = useState(0);
const [height, setHeight] = useState(props.height);
@@ -304,6 +305,8 @@ const Chart = props => {
],
);
+ formData.dashboardId = dashboardInfo.id;
+
const onExploreChart = useCallback(
async clickEvent => {
const isOpenInNewTab =
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Chart.test.jsx b/superset-frontend/src/dashboard/components/gridComponents/Chart.test.jsx
index 35be0144af..3d4cb66bdc 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart.test.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart.test.jsx
@@ -74,6 +74,7 @@ const defaultState = {
datasources: mockDatasource,
dashboardState: { editMode: false, expandedSlices: {} },
dashboardInfo: {
+ id: props.dashboardId,
superset_can_explore: false,
superset_can_share: false,
superset_can_csv: false,
@@ -165,7 +166,9 @@ test('should call exportChart when exportCSV is clicked', async () => {
expect(stubbedExportCSV).toHaveBeenCalledTimes(1);
expect(stubbedExportCSV).toHaveBeenCalledWith(
expect.objectContaining({
- formData: expect.anything(),
+ formData: expect.objectContaining({
+ dashboardId: 111,
+ }),
resultType: 'full',
resultFormat: 'csv',
}),
@@ -195,6 +198,7 @@ test('should call exportChart with row_limit props.maxRows when exportFullCSV is
expect.objectContaining({
formData: expect.objectContaining({
row_limit: 666,
+ dashboardId: 111,
}),
resultType: 'full',
resultFormat: 'csv',
@@ -249,6 +253,7 @@ test('should call exportChart with row_limit props.maxRows when exportFullXLSX i
expect.objectContaining({
formData: expect.objectContaining({
row_limit: 666,
+ dashboardId: 111,
}),
resultType: 'full',
resultFormat: 'xlsx',