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 newFiltersProps = {
...mockedProps,
useNewUIFilters: true,
isSIP34FilterUIEnabled: true,
filters: [
{
Header: 'ID',

View File

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

View File

@ -26,7 +26,7 @@ export enum FeatureFlag {
ESTIMATE_QUERY_COST = 'ESTIMATE_QUERY_COST',
SHARE_QUERIES_VIA_KV_STORE = 'SHARE_QUERIES_VIA_KV_STORE',
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 = {

View File

@ -104,8 +104,8 @@ class ChartList extends React.PureComponent<Props, State> {
return this.hasPerm('can_delete');
}
get isNewUIEnabled() {
return isFeatureEnabled(FeatureFlag.LIST_VIEWS_NEW_UI);
get isSIP34FilterUIEnabled() {
return isFeatureEnabled(FeatureFlag.LIST_VIEWS_SIP34_FILTER_UI);
}
initialSort = [{ id: 'changed_on', desc: true }];
@ -425,7 +425,7 @@ class ChartList extends React.PureComponent<Props, State> {
updateFilters = async () => {
const { filterOperators } = this.state;
if (this.isNewUIEnabled) {
if (this.isSIP34FilterUIEnabled) {
this.setState({
filters: [
{
@ -560,7 +560,7 @@ class ChartList extends React.PureComponent<Props, State> {
initialSort={this.initialSort}
filters={filters}
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');
}
get isNewUIEnabled() {
return isFeatureEnabled(FeatureFlag.LIST_VIEWS_NEW_UI);
get isSIP34FilterUIEnabled() {
return isFeatureEnabled(FeatureFlag.LIST_VIEWS_SIP34_FILTER_UI);
}
initialSort = [{ id: 'changed_on', desc: true }];
@ -428,7 +428,7 @@ class DashboardList extends React.PureComponent<Props, State> {
updateFilters = async () => {
const { filterOperators } = this.state;
if (this.isNewUIEnabled) {
if (this.isSIP34FilterUIEnabled) {
return this.setState({
filters: [
{
@ -563,7 +563,7 @@ class DashboardList extends React.PureComponent<Props, State> {
initialSort={this.initialSort}
filters={filters}
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,
"TAGGING_SYSTEM": False,
"SQLLAB_BACKEND_PERSISTENCE": False,
"LIST_VIEWS_NEW_UI": False,
"LIST_VIEWS_SIP34_FILTER_UI": False,
}
# This is merely a default.
@ -799,7 +799,8 @@ DOCUMENTATION_URL = None
DOCUMENTATION_TEXT = "Documentation"
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
ENABLE_REACT_CRUD_VIEWS = False