You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/06 21:47:36 UTC
(superset) branch master updated: feat(dashboard): expand all chart descriptions (#32958)
This is an automated email from the ASF dual-hosted git repository.
rusackas 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 4f2147009f1 feat(dashboard): expand all chart descriptions (#32958)
4f2147009f1 is described below
commit 4f2147009f15208b8f702a06cc0960dea15a60c9
Author: Urban Pettersson <45...@users.noreply.github.com>
AuthorDate: Thu Aug 6 23:47:30 2026 +0200
feat(dashboard): expand all chart descriptions (#32958)
Co-authored-by: Urban Pettersson <ur...@alteryx.com>
Co-authored-by: rusackas <ev...@rusackas.com>
Co-authored-by: Claude Opus 4.8 <no...@anthropic.com>
---
.../e2e/dashboard/shared_dashboard_functions.ts | 1 +
.../spec/fixtures/mockDashboardState.js | 2 +-
.../src/dashboard/actions/dashboardState.ts | 1 +
superset-frontend/src/dashboard/actions/hydrate.ts | 1 +
.../PropertiesModal/PropertiesModal.test.tsx | 2 +-
.../components/gridComponents/Chart/Chart.test.tsx | 83 +++++++++++++++++++---
.../components/gridComponents/Chart/Chart.tsx | 5 +-
.../src/dashboard/reducers/dashboardState.test.ts | 9 ++-
.../src/dashboard/reducers/dashboardState.ts | 14 ++--
superset-frontend/src/dashboard/types.ts | 1 +
superset/daos/dashboard.py | 1 +
superset/dashboards/schemas.py | 1 +
.../examples/fcc_new_coder_survey/dashboard.yaml | 1 +
superset/examples/featured_charts/dashboard.yaml | 1 +
superset/examples/sales_dashboard/dashboard.yaml | 1 +
superset/examples/slack_dashboard/dashboard.yaml | 1 +
superset/examples/video_game_sales/dashboard.yaml | 1 +
tests/integration_tests/commands_test.py | 1 +
tests/integration_tests/dashboards/api_tests.py | 2 +-
.../integration_tests/dashboards/commands_tests.py | 1 +
tests/integration_tests/fixtures/importexport.py | 3 +-
tests/integration_tests/import_export_tests.py | 50 +++++++++++++
tests/unit_tests/fixtures/assets_configs.py | 2 +
23 files changed, 163 insertions(+), 22 deletions(-)
diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/shared_dashboard_functions.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/shared_dashboard_functions.ts
index 2ca48836c1f..8bbc1a24e87 100644
--- a/superset-frontend/cypress-base/cypress/e2e/dashboard/shared_dashboard_functions.ts
+++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/shared_dashboard_functions.ts
@@ -138,6 +138,7 @@ export function prepareDashboardFilters(
chart_customization_config: [],
timed_refresh_immune_slices: [],
expanded_slices: {},
+ expand_all_slices: false,
refresh_frequency: 0,
color_scheme: '',
label_colors: {},
diff --git a/superset-frontend/spec/fixtures/mockDashboardState.js b/superset-frontend/spec/fixtures/mockDashboardState.js
index 129c88b1308..0148df8d234 100644
--- a/superset-frontend/spec/fixtures/mockDashboardState.js
+++ b/superset-frontend/spec/fixtures/mockDashboardState.js
@@ -114,6 +114,6 @@ export const overwriteConfirmMetadata = {
editors: [],
viewers: [],
json_metadata:
- '{"timed_refresh_immune_slices":[],"expanded_slices":{},"refresh_frequency":0,"default_filters":"{}","color_scheme":"supersetColors","label_colors":{"0":"#FCC700","1":"#A868B7","15":"#3CCCCB","30":"#A38F79","45":"#8FD3E4","age":"#1FA8C9","Yes,":"#1FA8C9","Female":"#454E7C","Prefer":"#5AC189","No,":"#FF7F44","Male":"#666666","Prefer not to say":"#E04355","Ph.D.":"#FCC700","associate\'s degree":"#A868B7","bachelor\'s degree":"#3CCCCB","high school diploma or equivalent (GED)":"#A38F7 [...]
+ '{"timed_refresh_immune_slices":[],"expanded_slices":{},"expand_all_slices":false,"refresh_frequency":0,"default_filters":"{}","color_scheme":"supersetColors","label_colors":{"0":"#FCC700","1":"#A868B7","15":"#3CCCCB","30":"#A38F79","45":"#8FD3E4","age":"#1FA8C9","Yes,":"#1FA8C9","Female":"#454E7C","Prefer":"#5AC189","No,":"#FF7F44","Male":"#666666","Prefer not to say":"#E04355","Ph.D.":"#FCC700","associate\'s degree":"#A868B7","bachelor\'s degree":"#3CCCCB","high school diploma or [...]
},
};
diff --git a/superset-frontend/src/dashboard/actions/dashboardState.ts b/superset-frontend/src/dashboard/actions/dashboardState.ts
index 95633c04a50..7a08bed326a 100644
--- a/superset-frontend/src/dashboard/actions/dashboardState.ts
+++ b/superset-frontend/src/dashboard/actions/dashboardState.ts
@@ -536,6 +536,7 @@ export function saveDashboardRequest(
? getColorSchemeDomain(colorScheme)
: [],
expanded_slices: data.metadata?.expanded_slices || {},
+ expand_all_slices: data.metadata?.expand_all_slices || false,
label_colors: customLabelsColor,
shared_label_colors: getFreshSharedLabels(sharedLabelsColor),
map_label_colors: getFreshLabelsColorMapEntries(customLabelsColor),
diff --git a/superset-frontend/src/dashboard/actions/hydrate.ts b/superset-frontend/src/dashboard/actions/hydrate.ts
index d943ae5f80b..3619f8c920b 100644
--- a/superset-frontend/src/dashboard/actions/hydrate.ts
+++ b/superset-frontend/src/dashboard/actions/hydrate.ts
@@ -397,6 +397,7 @@ export const hydrateDashboard =
directPathLastUpdated: Date.now(),
focusedFilterField: null,
expandedSlices: metadata?.expanded_slices || {},
+ expandAllSlices: metadata?.expand_all_slices || false,
refreshFrequency: metadata?.refresh_frequency || 0,
// dashboard viewers can set refresh frequency for the current visit,
// only persistent refreshFrequency will be saved to backend
diff --git a/superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx b/superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
index 305a8597850..d96736f823a 100644
--- a/superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
+++ b/superset-frontend/src/dashboard/components/PropertiesModal/PropertiesModal.test.tsx
@@ -70,7 +70,7 @@ const mockedIsFeatureEnabled = isFeatureEnabled as jest.Mock;
const spyColorSchemeSelect = jest.spyOn(ColorSchemeSelect, 'default');
const mockedJsonMetadata =
- '{"timed_refresh_immune_slices": [], "expanded_slices": {}, "refresh_frequency": 0, "default_filters": "{}", "color_scheme": "supersetColors", "label_colors": {"0": "#D3B3DA", "1": "#9EE5E5", "0. Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II": "#454E7C", "1. Phase I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized": "#666666", "root": "#1FA8C9", "Protein subunit": "#454E7C", "Phase II": "#5AC189", "Pre-clinical": "#FF7F44", "Phase III": "#666666", "Phase I": "#E04355", [...]
+ '{"timed_refresh_immune_slices": [], "expanded_slices": {}, "expand_all_slices": false, "refresh_frequency": 0, "default_filters": "{}", "color_scheme": "supersetColors", "label_colors": {"0": "#D3B3DA", "1": "#9EE5E5", "0. Pre-clinical": "#1FA8C9", "2. Phase II or Combined I/II": "#454E7C", "1. Phase I": "#5AC189", "3. Phase III": "#FF7F44", "4. Authorized": "#666666", "root": "#1FA8C9", "Protein subunit": "#454E7C", "Phase II": "#5AC189", "Pre-clinical": "#FF7F44", "Phase III": "#666 [...]
spyColorSchemeSelect.mockImplementation(
() => (<div>ColorSchemeSelect</div>) as any,
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
index ab6b36ef67c..3ee8623dcbe 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.test.tsx
@@ -145,18 +145,79 @@ test('should render a ChartContainer', () => {
expect(getByTestId('chart-container')).toBeInTheDocument();
});
-test('should render a description if it has one and isExpanded=true', () => {
- const { container } = setup(
- {},
- {
- dashboardState: {
- ...defaultState.dashboardState,
- expandedSlices: { [props.id]: true },
+const noDescriptionRenderInputs = ([undefined, false, true] as const).flatMap(
+ sliceExpanded =>
+ ([undefined, false, true] as const).map(allExpanded => ({
+ sliceExpanded,
+ allExpanded,
+ })),
+);
+
+test.each(noDescriptionRenderInputs)(
+ 'should not render a description when it has none, expandedSlices=$sliceExpanded and expandAllSlices=$allExpanded',
+ ({ sliceExpanded, allExpanded }) => {
+ const { container } = setup(
+ {},
+ {
+ dashboardState: {
+ ...defaultState.dashboardState,
+ expandedSlices: { [props.id]: sliceExpanded },
+ expandAllSlices: allExpanded,
+ },
+ sliceEntities: {
+ ...sliceEntities,
+ slices: {
+ [queryId]: {
+ ...sliceEntities.slices[queryId],
+ description_markdown: undefined,
+ owners: [],
+ viz_type: VizType.Table,
+ },
+ },
+ },
},
- },
- );
- expect(container.querySelector('.slice_description')).toBeInTheDocument();
-});
+ );
+ expect(
+ container.querySelector('.slice_description'),
+ ).not.toBeInTheDocument();
+ },
+);
+
+const chartDescriptionRenderInputs = [
+ { expandSlice: undefined, expandAllSlices: undefined, result: false },
+ { expandSlice: undefined, expandAllSlices: false, result: false },
+ { expandSlice: undefined, expandAllSlices: true, result: true },
+ { expandSlice: false, expandAllSlices: undefined, result: false },
+ { expandSlice: false, expandAllSlices: false, result: false },
+ { expandSlice: false, expandAllSlices: true, result: false },
+ { expandSlice: true, expandAllSlices: undefined, result: true },
+ { expandSlice: true, expandAllSlices: false, result: true },
+ { expandSlice: true, expandAllSlices: true, result: true },
+];
+
+test.each(chartDescriptionRenderInputs)(
+ 'should $result render a description if it has one, expandedSlices=$expandSlice and expandAllSlices=$expandAllSlices',
+ ({ expandSlice, expandAllSlices, result }) => {
+ const { container } = setup(
+ {},
+ {
+ dashboardState: {
+ ...defaultState.dashboardState,
+ expandedSlices: { [props.id]: expandSlice },
+ expandAllSlices,
+ },
+ },
+ );
+
+ if (result) {
+ expect(container.querySelector('.slice_description')).toBeInTheDocument();
+ } else {
+ expect(
+ container.querySelector('.slice_description'),
+ ).not.toBeInTheDocument();
+ }
+ },
+);
test('should call refreshChart when SliceHeader calls forceRefresh', () => {
const { getByText, getByRole } = setup({});
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
index 29f19bdfdde..49fe854613b 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx
@@ -208,7 +208,10 @@ const Chart = (props: ChartProps) => {
);
const isExpanded = useSelector(
(state: RootState) =>
- !!(state.dashboardState as JsonObject).expandedSlices?.[props.id],
+ !!(
+ state.dashboardState.expandedSlices?.[props.id] ??
+ state.dashboardState.expandAllSlices
+ ),
);
const supersetCanExplore = useSelector(
(state: RootState) =>
diff --git a/superset-frontend/src/dashboard/reducers/dashboardState.test.ts b/superset-frontend/src/dashboard/reducers/dashboardState.test.ts
index 559aa6a7f37..dc57c4a7d15 100644
--- a/superset-frontend/src/dashboard/reducers/dashboardState.test.ts
+++ b/superset-frontend/src/dashboard/reducers/dashboardState.test.ts
@@ -355,7 +355,7 @@ describe('DashboardState reducer', () => {
{ expandedSlices: { 1: true, 2: false } } as Partial<DashboardState>,
{ type: TOGGLE_EXPAND_SLICE, sliceId: 1 },
),
- ).toEqual({ expandedSlices: { 2: false } });
+ ).toEqual({ expandedSlices: { 1: false, 2: false } });
expect(
typedDashboardStateReducer(
@@ -363,6 +363,13 @@ describe('DashboardState reducer', () => {
{ type: TOGGLE_EXPAND_SLICE, sliceId: 2 },
),
).toEqual({ expandedSlices: { 1: true, 2: true } });
+
+ expect(
+ typedDashboardStateReducer(
+ { expandedSlices: { 1: true } } as Partial<DashboardState>,
+ { type: TOGGLE_EXPAND_SLICE, sliceId: 2 },
+ ),
+ ).toEqual({ expandedSlices: { 1: true, 2: true } });
});
test('should set hasUnsavedChanges', () => {
diff --git a/superset-frontend/src/dashboard/reducers/dashboardState.ts b/superset-frontend/src/dashboard/reducers/dashboardState.ts
index 292f1f3cd93..5a25aac94d9 100644
--- a/superset-frontend/src/dashboard/reducers/dashboardState.ts
+++ b/superset-frontend/src/dashboard/reducers/dashboardState.ts
@@ -86,6 +86,7 @@ interface DashboardStateShape {
labelsColorMapMustSync?: boolean;
sharedLabelsColorsMustSync?: boolean;
expandedSlices?: Record<number, boolean>;
+ expandAllSlices?: boolean;
hasUnsavedChanges?: boolean;
dashboardIsSaving?: boolean;
lastModifiedTime?: number;
@@ -258,11 +259,14 @@ export default function dashboardStateReducer(
const updatedExpandedSlices = { ...state.expandedSlices };
const { sliceId } = action;
if (sliceId !== undefined) {
- if (updatedExpandedSlices[sliceId]) {
- delete updatedExpandedSlices[sliceId];
- } else {
- updatedExpandedSlices[sliceId] = true;
- }
+ // Toggle the *effective* expanded state (per-slice override falling
+ // back to the global expandAllSlices flag), not just the raw
+ // per-slice override. Otherwise the first toggle on a slice whose
+ // description is only showing because expandAllSlices is true would
+ // flip undefined -> true and leave the description visible.
+ const currentlyExpanded =
+ updatedExpandedSlices[sliceId] ?? state.expandAllSlices;
+ updatedExpandedSlices[sliceId] = !currentlyExpanded;
}
return { ...state, expandedSlices: updatedExpandedSlices };
},
diff --git a/superset-frontend/src/dashboard/types.ts b/superset-frontend/src/dashboard/types.ts
index 084e557bbf8..adbe07d0dfc 100644
--- a/superset-frontend/src/dashboard/types.ts
+++ b/superset-frontend/src/dashboard/types.ts
@@ -161,6 +161,7 @@ export type DashboardState = {
inactiveTabs?: string[];
datasetsStatus?: ResourceStatus;
expandedSlices?: Record<number, boolean>;
+ expandAllSlices?: boolean;
refreshFrequency: number;
shouldPersistRefreshFrequency?: boolean;
colorNamespace?: string;
diff --git a/superset/daos/dashboard.py b/superset/daos/dashboard.py
index 8b43ab59a15..a1939f4c51a 100644
--- a/superset/daos/dashboard.py
+++ b/superset/daos/dashboard.py
@@ -439,6 +439,7 @@ class DashboardDAO(BaseDAO[Dashboard]):
# without clobbering existing values (#42116).
metadata_defaults: dict[str, Any] = {
"expanded_slices": {},
+ "expand_all_slices": False,
"refresh_frequency": 0,
"color_scheme": "",
"label_colors": {},
diff --git a/superset/dashboards/schemas.py b/superset/dashboards/schemas.py
index 7dbfe948951..41ed68d79e5 100644
--- a/superset/dashboards/schemas.py
+++ b/superset/dashboards/schemas.py
@@ -208,6 +208,7 @@ class DashboardJSONMetadataSchema(Schema):
# deprecated wrt dashboard-native filters
filter_scopes = fields.Dict()
expanded_slices = fields.Dict()
+ expand_all_slices = fields.Boolean()
refresh_frequency = fields.Integer()
# deprecated wrt dashboard-native filters
default_filters = fields.Str()
diff --git a/superset/examples/fcc_new_coder_survey/dashboard.yaml b/superset/examples/fcc_new_coder_survey/dashboard.yaml
index 4199e8b60b7..7c6838f47de 100644
--- a/superset/examples/fcc_new_coder_survey/dashboard.yaml
+++ b/superset/examples/fcc_new_coder_survey/dashboard.yaml
@@ -25,6 +25,7 @@ metadata:
color_scheme_domain: []
cross_filters_enabled: false
default_filters: '{}'
+ expand_all_slices: false
expanded_slices: {}
global_chart_configuration: {}
label_colors:
diff --git a/superset/examples/featured_charts/dashboard.yaml b/superset/examples/featured_charts/dashboard.yaml
index c61eecfa1b8..77a43aece86 100644
--- a/superset/examples/featured_charts/dashboard.yaml
+++ b/superset/examples/featured_charts/dashboard.yaml
@@ -25,6 +25,7 @@ metadata:
color_scheme_domain: []
cross_filters_enabled: true
default_filters: '{}'
+ expand_all_slices: false
expanded_slices: {}
global_chart_configuration: {}
label_colors: {}
diff --git a/superset/examples/sales_dashboard/dashboard.yaml b/superset/examples/sales_dashboard/dashboard.yaml
index 321e57d5bd6..4a9d1814333 100644
--- a/superset/examples/sales_dashboard/dashboard.yaml
+++ b/superset/examples/sales_dashboard/dashboard.yaml
@@ -129,6 +129,7 @@ metadata:
- '#D1C6BC'
cross_filters_enabled: true
default_filters: '{}'
+ expand_all_slices: false
expanded_slices: {}
global_chart_configuration:
chartsInScope:
diff --git a/superset/examples/slack_dashboard/dashboard.yaml b/superset/examples/slack_dashboard/dashboard.yaml
index 46f01e73c22..ce9f061f1b2 100644
--- a/superset/examples/slack_dashboard/dashboard.yaml
+++ b/superset/examples/slack_dashboard/dashboard.yaml
@@ -25,6 +25,7 @@ metadata:
color_scheme_domain: []
cross_filters_enabled: false
default_filters: '{}'
+ expand_all_slices: false
expanded_slices: {}
global_chart_configuration: {}
label_colors:
diff --git a/superset/examples/video_game_sales/dashboard.yaml b/superset/examples/video_game_sales/dashboard.yaml
index 5d3c415b544..3269d273151 100644
--- a/superset/examples/video_game_sales/dashboard.yaml
+++ b/superset/examples/video_game_sales/dashboard.yaml
@@ -25,6 +25,7 @@ metadata:
color_scheme_domain: []
cross_filters_enabled: false
default_filters: '{}'
+ expand_all_slices: false
expanded_slices: {}
global_chart_configuration: {}
label_colors:
diff --git a/tests/integration_tests/commands_test.py b/tests/integration_tests/commands_test.py
index 220ae4e9196..b7fdb9b10d6 100644
--- a/tests/integration_tests/commands_test.py
+++ b/tests/integration_tests/commands_test.py
@@ -129,6 +129,7 @@ class TestImportAssetsCommand(SupersetTestCase):
assert json.loads(dashboard.json_metadata) == {
"color_scheme": None,
"expanded_slices": {str(new_chart_id): True},
+ "expand_all_slices": False,
"import_time": 1604342885,
"native_filter_configuration": [],
"refresh_frequency": 0,
diff --git a/tests/integration_tests/dashboards/api_tests.py b/tests/integration_tests/dashboards/api_tests.py
index 83cdc03987c..479c78f94e2 100644
--- a/tests/integration_tests/dashboards/api_tests.py
+++ b/tests/integration_tests/dashboards/api_tests.py
@@ -93,7 +93,7 @@ class TestDashboardApi(ApiEditorsTestCaseMixin, InsertChartMixin, SupersetTestCa
"description": "desc_changed",
"position_json": '{"b": "B"}',
"css": "css_changed",
- "json_metadata": '{"refresh_frequency": 30, "timed_refresh_immune_slices": [], "expanded_slices": {}, "color_scheme": "", "label_colors": {}, "shared_label_colors": [], "map_label_colors": {}, "color_scheme_domain": [], "cross_filters_enabled": false}', # noqa: E501
+ "json_metadata": '{"refresh_frequency": 30, "timed_refresh_immune_slices": [], "expanded_slices": {}, "expand_all_slices": false, "color_scheme": "", "label_colors": {}, "shared_label_colors": [], "map_label_colors": {}, "color_scheme_domain": [], "cross_filters_enabled": false}', # noqa: E501
"published": False,
}
diff --git a/tests/integration_tests/dashboards/commands_tests.py b/tests/integration_tests/dashboards/commands_tests.py
index 5bb029c8edf..13324fa1acc 100644
--- a/tests/integration_tests/dashboards/commands_tests.py
+++ b/tests/integration_tests/dashboards/commands_tests.py
@@ -641,6 +641,7 @@ class TestImportDashboardsCommand(SupersetTestCase):
assert json.loads(dashboard.json_metadata) == {
"color_scheme": None,
"expanded_slices": {str(new_chart_id): True},
+ "expand_all_slices": False,
"import_time": 1604342885,
"native_filter_configuration": [],
"refresh_frequency": 0,
diff --git a/tests/integration_tests/fixtures/importexport.py b/tests/integration_tests/fixtures/importexport.py
index 9a9d5d77fa0..1b9f784f234 100644
--- a/tests/integration_tests/fixtures/importexport.py
+++ b/tests/integration_tests/fixtures/importexport.py
@@ -69,7 +69,7 @@ dashboard_export: dict[str, Any] = {
"css": "",
"dashboard_title": "Births 2",
"description": None,
- "json_metadata": '{"timed_refresh_immune_slices": [], "expanded_slices": {}, "refresh_frequency": 0, "default_filters": "{}", "color_scheme": null, "remote_id": 1}', # noqa: E501
+ "json_metadata": '{"timed_refresh_immune_slices": [], "expanded_slices": {}, "expand_all_slices": false, "refresh_frequency": 0, "default_filters": "{}", "color_scheme": null, "remote_id": 1}', # noqa: E501
"position_json": '{"CHART--jvaBFZx78":{"children":[],"id":"CHART--jvaBFZx78","meta":{"chartId":83,"height":50,"sliceName":"Number of California Births","uuid":"c77bb4b3-09f4-4d9a-a9e2-66a627c64343","width":4},"parents":["ROOT_ID","GRID_ID","ROW-se_5H8KNiO"],"type":"CHART"},"DASHBOARD_VERSION_KEY":"v2","GRID_ID":{"children":["ROW-se_5H8KNiO"],"id":"GRID_ID","parents":["ROOT_ID"],"type":"GRID"},"HEADER_ID":{"id":"HEADER_ID","meta":{"text":"Births"},"type":"HEADER"},"ROOT_ID [...]
"slices": [
{
@@ -702,6 +702,7 @@ dashboard_config: dict[str, Any] = {
"83": {"region": {"scope": ["ROOT_ID"], "immune": [83]}},
},
"expanded_slices": {"83": True},
+ "expand_all_slices": False,
"refresh_frequency": 0,
"default_filters": "{}",
"color_scheme": None,
diff --git a/tests/integration_tests/import_export_tests.py b/tests/integration_tests/import_export_tests.py
index a0fb9a75632..fc9f2b4e862 100644
--- a/tests/integration_tests/import_export_tests.py
+++ b/tests/integration_tests/import_export_tests.py
@@ -491,6 +491,56 @@ class TestImportExport(SupersetTestCase):
"native_filter_configuration": [],
} == json.loads(imported_dash.json_metadata)
+ def test_import_dashboard_expand_all_slices_false(self) -> None:
+ dash = self.create_dashboard("dash", slcs=[], id=10005)
+ dash.json_metadata = json.dumps(
+ {
+ "remote_id": 10005,
+ "expand_all_slices": False,
+ }
+ )
+
+ imported_dash_id = import_dashboard(dash, import_time=1991)
+ imported_dash = self.get_dash(imported_dash_id)
+
+ expected_dash = self.create_dashboard("dash", slcs=[], id=10005)
+ make_transient(expected_dash)
+ self.assert_dash_equals(
+ imported_dash, expected_dash, check_position=False, check_slugs=False
+ )
+ expected_json_metadata = {
+ "remote_id": 10005,
+ "import_time": 1991,
+ "expand_all_slices": False,
+ "native_filter_configuration": [],
+ }
+ assert expected_json_metadata == json.loads(imported_dash.json_metadata)
+
+ def test_import_dashboard_expand_all_slices_true(self) -> None:
+ dash = self.create_dashboard("dash", slcs=[], id=10006)
+ dash.json_metadata = json.dumps(
+ {
+ "remote_id": 10006,
+ "expand_all_slices": True,
+ }
+ )
+
+ imported_dash_id = import_dashboard(dash, import_time=1991)
+ imported_dash = self.get_dash(imported_dash_id)
+
+ expected_dash = self.create_dashboard("dash", slcs=[], id=10006)
+ make_transient(expected_dash)
+ self.assert_dash_equals(
+ imported_dash, expected_dash, check_position=False, check_slugs=False
+ )
+ expected_json_metadata = {
+ "remote_id": 10006,
+ "import_time": 1991,
+ "expand_all_slices": True,
+ "native_filter_configuration": [],
+ }
+ assert expected_json_metadata == json.loads(imported_dash.json_metadata)
+
def test_import_new_dashboard_slice_reset_ownership(self):
admin_user = security_manager.find_user(username="admin")
assert admin_user
diff --git a/tests/unit_tests/fixtures/assets_configs.py b/tests/unit_tests/fixtures/assets_configs.py
index 9217f744fbd..87fd2b145b8 100644
--- a/tests/unit_tests/fixtures/assets_configs.py
+++ b/tests/unit_tests/fixtures/assets_configs.py
@@ -171,6 +171,7 @@ dashboards_config_1: dict[str, Any] = {
"metadata": {
"timed_refresh_immune_slices": [],
"expanded_slices": {},
+ "expand_all_slices": False,
"refresh_frequency": 0,
"default_filters": "{}",
"color_scheme": "supersetColors",
@@ -249,6 +250,7 @@ dashboards_config_2: dict[str, Any] = {
"metadata": {
"timed_refresh_immune_slices": [],
"expanded_slices": {},
+ "expand_all_slices": False,
"refresh_frequency": 0,
"default_filters": "{}",
"color_scheme": "supersetColors",