refactor: better naming for config flags (#10180)

This commit is contained in:
ʈᵃᵢ 2020-06-26 17:36:50 -07:00 committed by GitHub
parent 8bdc6b1771
commit 3414f35792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 17 deletions

View File

@ -309,7 +309,7 @@ describe('ListView with new UI filters', () => {
const fetchSelectsMock = jest.fn(() => []); const fetchSelectsMock = jest.fn(() => []);
const newFiltersProps = { const newFiltersProps = {
...mockedProps, ...mockedProps,
useNewUIFilters: true, isSIP34FilterUIEnabled: true,
filters: [ filters: [
{ {
Header: 'ID', Header: 'ID',

View File

@ -45,7 +45,7 @@ interface Props {
name: React.ReactNode | string; name: React.ReactNode | string;
onSelect: (rows: any[]) => any; onSelect: (rows: any[]) => any;
}>; }>;
useNewUIFilters?: boolean; isSIP34FilterUIEnabled?: boolean;
} }
const bulkSelectColumnConfig = { const bulkSelectColumnConfig = {
@ -73,7 +73,7 @@ const ListView: FunctionComponent<Props> = ({
className = '', className = '',
filters = [], filters = [],
bulkActions = [], bulkActions = [],
useNewUIFilters = false, isSIP34FilterUIEnabled = false,
}) => { }) => {
const { const {
getTableProps, getTableProps,
@ -100,7 +100,7 @@ const ListView: FunctionComponent<Props> = ({
fetchData, fetchData,
initialPageSize, initialPageSize,
initialSort, initialSort,
initialFilters: useNewUIFilters ? filters : [], initialFilters: isSIP34FilterUIEnabled ? filters : [],
}); });
const filterable = Boolean(filters.length); const filterable = Boolean(filters.length);
if (filterable) { if (filterable) {
@ -123,7 +123,7 @@ const ListView: FunctionComponent<Props> = ({
<div className="superset-list-view-container"> <div className="superset-list-view-container">
<div className={`superset-list-view ${className}`}> <div className={`superset-list-view ${className}`}>
<div className="header"> <div className="header">
{!useNewUIFilters && filterable && ( {!isSIP34FilterUIEnabled && filterable && (
<> <>
<Row> <Row>
<Col md={10} /> <Col md={10} />
@ -146,7 +146,7 @@ const ListView: FunctionComponent<Props> = ({
/> />
</> </>
)} )}
{useNewUIFilters && filterable && ( {isSIP34FilterUIEnabled && filterable && (
<FilterControls <FilterControls
filters={filters} filters={filters}
internalFilters={internalFilters} internalFilters={internalFilters}

View File

@ -26,7 +26,7 @@ export enum FeatureFlag {
ESTIMATE_QUERY_COST = 'ESTIMATE_QUERY_COST', ESTIMATE_QUERY_COST = 'ESTIMATE_QUERY_COST',
SHARE_QUERIES_VIA_KV_STORE = 'SHARE_QUERIES_VIA_KV_STORE', SHARE_QUERIES_VIA_KV_STORE = 'SHARE_QUERIES_VIA_KV_STORE',
SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE', SQLLAB_BACKEND_PERSISTENCE = 'SQLLAB_BACKEND_PERSISTENCE',
LIST_VIEWS_NEW_UI = 'LIST_VIEWS_NEW_UI', LIST_VIEWS_SIP34_FILTER_UI = 'LIST_VIEWS_SIP34_FILTER_UI',
} }
export type FeatureFlagMap = { export type FeatureFlagMap = {

View File

@ -104,8 +104,8 @@ class ChartList extends React.PureComponent<Props, State> {
return this.hasPerm('can_delete'); return this.hasPerm('can_delete');
} }
get isNewUIEnabled() { get isSIP34FilterUIEnabled() {
return isFeatureEnabled(FeatureFlag.LIST_VIEWS_NEW_UI); return isFeatureEnabled(FeatureFlag.LIST_VIEWS_SIP34_FILTER_UI);
} }
initialSort = [{ id: 'changed_on', desc: true }]; initialSort = [{ id: 'changed_on', desc: true }];
@ -425,7 +425,7 @@ class ChartList extends React.PureComponent<Props, State> {
updateFilters = async () => { updateFilters = async () => {
const { filterOperators } = this.state; const { filterOperators } = this.state;
if (this.isNewUIEnabled) { if (this.isSIP34FilterUIEnabled) {
this.setState({ this.setState({
filters: [ filters: [
{ {
@ -560,7 +560,7 @@ class ChartList extends React.PureComponent<Props, State> {
initialSort={this.initialSort} initialSort={this.initialSort}
filters={filters} filters={filters}
bulkActions={bulkActions} bulkActions={bulkActions}
useNewUIFilters={this.isNewUIEnabled} isSIP34FilterUIEnabled={this.isSIP34FilterUIEnabled}
/> />
); );
}} }}

View File

@ -119,8 +119,8 @@ class DashboardList extends React.PureComponent<Props, State> {
return this.hasPerm('can_mulexport'); return this.hasPerm('can_mulexport');
} }
get isNewUIEnabled() { get isSIP34FilterUIEnabled() {
return isFeatureEnabled(FeatureFlag.LIST_VIEWS_NEW_UI); return isFeatureEnabled(FeatureFlag.LIST_VIEWS_SIP34_FILTER_UI);
} }
initialSort = [{ id: 'changed_on', desc: true }]; initialSort = [{ id: 'changed_on', desc: true }];
@ -428,7 +428,7 @@ class DashboardList extends React.PureComponent<Props, State> {
updateFilters = async () => { updateFilters = async () => {
const { filterOperators } = this.state; const { filterOperators } = this.state;
if (this.isNewUIEnabled) { if (this.isSIP34FilterUIEnabled) {
return this.setState({ return this.setState({
filters: [ filters: [
{ {
@ -563,7 +563,7 @@ class DashboardList extends React.PureComponent<Props, State> {
initialSort={this.initialSort} initialSort={this.initialSort}
filters={filters} filters={filters}
bulkActions={bulkActions} bulkActions={bulkActions}
useNewUIFilters={this.isNewUIEnabled} isSIP34FilterUIEnabled={this.isSIP34FilterUIEnabled}
/> />
</> </>
); );

View File

@ -306,7 +306,7 @@ 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,
"LIST_VIEWS_NEW_UI": False, "LIST_VIEWS_SIP34_FILTER_UI": False,
} }
# This is merely a default. # This is merely a default.
@ -799,7 +799,8 @@ DOCUMENTATION_URL = None
DOCUMENTATION_TEXT = "Documentation" DOCUMENTATION_TEXT = "Documentation"
DOCUMENTATION_ICON = None # Recommended size: 16x16 DOCUMENTATION_ICON = None # Recommended size: 16x16
# Enables the replacement react views for all the FAB views: list, edit, show. # Enables the replacement react views for all the FAB views (list, edit, show) with
# designs introduced in SIP-34: https://github.com/apache/incubator-superset/issues/8976
# This is a work in progress so not all features available in FAB have been implemented # This is a work in progress so not all features available in FAB have been implemented
ENABLE_REACT_CRUD_VIEWS = False ENABLE_REACT_CRUD_VIEWS = False