mirror of https://github.com/apache/superset.git
feat(listview): feature flag config to set default viewing mode (#10986)
This commit is contained in:
parent
220c410df4
commit
0d1f6119a6
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -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'
|
||||
}
|
||||
/>
|
||||
</>
|
||||
|
|
|
@ -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] = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue