mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
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', () => {
|
describe('ChartList', () => {
|
||||||
const isFeatureEnabledMock = jest
|
const isFeatureEnabledMock = jest
|
||||||
.spyOn(featureFlags, 'isFeatureEnabled')
|
.spyOn(featureFlags, 'isFeatureEnabled')
|
||||||
.mockImplementation(feature => feature === 'THUMBNAILS');
|
.mockImplementation(feature => feature === 'LISTVIEWS_DEFAULT_CARD_VIEW');
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
isFeatureEnabledMock.restore();
|
isFeatureEnabledMock.restore();
|
||||||
|
@ -70,7 +70,7 @@ fetchMock.get('/thumbnail', { body: new Blob(), sendAsJson: false });
|
|||||||
describe('DashboardList', () => {
|
describe('DashboardList', () => {
|
||||||
const isFeatureEnabledMock = jest
|
const isFeatureEnabledMock = jest
|
||||||
.spyOn(featureFlags, 'isFeatureEnabled')
|
.spyOn(featureFlags, 'isFeatureEnabled')
|
||||||
.mockImplementation(feature => feature === 'THUMBNAILS');
|
.mockImplementation(feature => feature === 'LISTVIEWS_DEFAULT_CARD_VIEW');
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
isFeatureEnabledMock.restore();
|
isFeatureEnabledMock.restore();
|
||||||
|
@ -28,6 +28,7 @@ export enum FeatureFlag {
|
|||||||
SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE',
|
SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE',
|
||||||
THUMBNAILS = 'THUMBNAILS',
|
THUMBNAILS = 'THUMBNAILS',
|
||||||
SIP_34_SAVED_QUERIES_UI = 'SIP_34_SAVED_QUERIES_UI',
|
SIP_34_SAVED_QUERIES_UI = 'SIP_34_SAVED_QUERIES_UI',
|
||||||
|
LISTVIEWS_DEFAULT_CARD_VIEW = 'LISTVIEWS_DEFAULT_CARD_VIEW',
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FeatureFlagMap = {
|
export type FeatureFlagMap = {
|
||||||
|
@ -517,7 +517,9 @@ function ChartList(props: ChartListProps) {
|
|||||||
pageSize={PAGE_SIZE}
|
pageSize={PAGE_SIZE}
|
||||||
renderCard={renderCard}
|
renderCard={renderCard}
|
||||||
defaultViewMode={
|
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}
|
pageSize={PAGE_SIZE}
|
||||||
renderCard={renderCard}
|
renderCard={renderCard}
|
||||||
defaultViewMode={
|
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,
|
"SIP_38_VIZ_REARCHITECTURE": False,
|
||||||
"TAGGING_SYSTEM": False,
|
"TAGGING_SYSTEM": False,
|
||||||
"SQLLAB_BACKEND_PERSISTENCE": 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.
|
# This is merely a default.
|
||||||
FEATURE_FLAGS: Dict[str, bool] = {}
|
FEATURE_FLAGS: Dict[str, bool] = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user