diff --git a/superset-frontend/spec/javascripts/views/CRUD/chart/ChartList_spec.jsx b/superset-frontend/spec/javascripts/views/CRUD/chart/ChartList_spec.jsx index 14366a444b..baa997ef21 100644 --- a/superset-frontend/spec/javascripts/views/CRUD/chart/ChartList_spec.jsx +++ b/superset-frontend/spec/javascripts/views/CRUD/chart/ChartList_spec.jsx @@ -78,7 +78,7 @@ fetchMock.get('/thumbnail', { body: new Blob(), sendAsJson: false }); describe('ChartList', () => { const isFeatureEnabledMock = jest .spyOn(featureFlags, 'isFeatureEnabled') - .mockImplementation(feature => feature === 'THUMBNAILS'); + .mockImplementation(feature => feature === 'LISTVIEWS_DEFAULT_CARD_VIEW'); afterAll(() => { isFeatureEnabledMock.restore(); diff --git a/superset-frontend/spec/javascripts/views/CRUD/dashboard/DashboardList_spec.jsx b/superset-frontend/spec/javascripts/views/CRUD/dashboard/DashboardList_spec.jsx index f5c18d3a36..fbc9c1ddff 100644 --- a/superset-frontend/spec/javascripts/views/CRUD/dashboard/DashboardList_spec.jsx +++ b/superset-frontend/spec/javascripts/views/CRUD/dashboard/DashboardList_spec.jsx @@ -70,7 +70,7 @@ fetchMock.get('/thumbnail', { body: new Blob(), sendAsJson: false }); describe('DashboardList', () => { const isFeatureEnabledMock = jest .spyOn(featureFlags, 'isFeatureEnabled') - .mockImplementation(feature => feature === 'THUMBNAILS'); + .mockImplementation(feature => feature === 'LISTVIEWS_DEFAULT_CARD_VIEW'); afterAll(() => { isFeatureEnabledMock.restore(); diff --git a/superset-frontend/src/featureFlags.ts b/superset-frontend/src/featureFlags.ts index 3b9acb1bfa..ffc1e56d38 100644 --- a/superset-frontend/src/featureFlags.ts +++ b/superset-frontend/src/featureFlags.ts @@ -28,6 +28,7 @@ export enum FeatureFlag { SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE', THUMBNAILS = 'THUMBNAILS', SIP_34_SAVED_QUERIES_UI = 'SIP_34_SAVED_QUERIES_UI', + LISTVIEWS_DEFAULT_CARD_VIEW = 'LISTVIEWS_DEFAULT_CARD_VIEW', } export type FeatureFlagMap = { diff --git a/superset-frontend/src/views/CRUD/chart/ChartList.tsx b/superset-frontend/src/views/CRUD/chart/ChartList.tsx index 022295fa01..79f136fb0f 100644 --- a/superset-frontend/src/views/CRUD/chart/ChartList.tsx +++ b/superset-frontend/src/views/CRUD/chart/ChartList.tsx @@ -517,7 +517,9 @@ function ChartList(props: ChartListProps) { pageSize={PAGE_SIZE} renderCard={renderCard} defaultViewMode={ - isFeatureEnabled(FeatureFlag.THUMBNAILS) ? 'card' : 'table' + isFeatureEnabled(FeatureFlag.LISTVIEWS_DEFAULT_CARD_VIEW) + ? 'card' + : 'table' } /> ); diff --git a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx index 36873536ea..4efdd9ff87 100644 --- a/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx +++ b/superset-frontend/src/views/CRUD/dashboard/DashboardList.tsx @@ -526,7 +526,9 @@ function DashboardList(props: DashboardListProps) { pageSize={PAGE_SIZE} renderCard={renderCard} defaultViewMode={ - isFeatureEnabled(FeatureFlag.THUMBNAILS) ? 'card' : 'table' + isFeatureEnabled(FeatureFlag.LISTVIEWS_DEFAULT_CARD_VIEW) + ? 'card' + : 'table' } /> diff --git a/superset/config.py b/superset/config.py index ff64478190..adbb95986b 100644 --- a/superset/config.py +++ b/superset/config.py @@ -307,8 +307,15 @@ DEFAULT_FEATURE_FLAGS: Dict[str, bool] = { "SIP_38_VIZ_REARCHITECTURE": False, "TAGGING_SYSTEM": False, "SQLLAB_BACKEND_PERSISTENCE": False, + "LISTVIEWS_DEFAULT_CARD_VIEW": False, } +# Set the default view to card/grid view if thumbnail support is enabled. +# Setting LISTVIEW_DEFAULT_CARD_VIEW to False will force the default view to +# always be the table layout +if DEFAULT_FEATURE_FLAGS["THUMBNAILS"]: + DEFAULT_FEATURE_FLAGS["LISTVIEW_DEFAULT_CARD_VIEW"] = True + # This is merely a default. FEATURE_FLAGS: Dict[str, bool] = {}