Skip to content

Commit

Permalink
refactor: Removes the deprecated ENABLE_EXPLORE_DRAG_AND_DROP feature…
Browse files Browse the repository at this point in the history
… flag (apache#26343)
  • Loading branch information
michael-s-molina authored Jan 16, 2024
1 parent c27fcb1 commit 46d55db
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 232 deletions.
1 change: 0 additions & 1 deletion RESOURCES/FEATURE_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ These features flags currently default to True and **will be removed in a future
- DASHBOARD_FILTERS_EXPERIMENTAL
- DASHBOARD_NATIVE_FILTERS
- DASHBOARD_NATIVE_FILTERS_SET
- ENABLE_EXPLORE_DRAG_AND_DROP
- ENABLE_EXPLORE_JSON_CSRF_PROTECTION
- ENABLE_TEMPLATE_REMOVE_FILTERS
- GENERIC_CHART_AXES
Expand Down
1 change: 1 addition & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ assists people when migrating to a new version.

### Breaking Changes

- [26343](https://github.com/apache/superset/issues/26343): Removes the deprecated `ENABLE_EXPLORE_DRAG_AND_DROP` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled.
- [26331](https://github.com/apache/superset/issues/26331): Removes the deprecated `DISABLE_DATASET_SOURCE_EDIT` feature flag. The previous value of the feature flag was `False` and now the feature is permanently removed.

### Potential Downtime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useMemo } from 'react';
import {
FeatureFlag,
isFeatureEnabled,
QueryColumn,
t,
validateNonEmpty,
} from '@superset-ui/core';
import React from 'react';
import { QueryColumn, t, validateNonEmpty } from '@superset-ui/core';
import {
ExtraControlProps,
SharedControlConfig,
Expand Down Expand Up @@ -266,21 +260,3 @@ export const dndXAxisControl: typeof dndGroupByControl = {
...dndGroupByControl,
...xAxisMixin,
};

export function withDndFallback(
DndComponent: React.ComponentType<any>,
FallbackComponent: React.ComponentType<any>,
) {
return function DndControl(props: any) {
const enableExploreDnd = useMemo(
() => isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP),
[],
);

return enableExploreDnd ? (
<DndComponent {...props} />
) : (
<FallbackComponent {...props} />
);
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/
export { default as sharedControls } from './sharedControls';
export { withDndFallback } from './dndControls';
// React control components
export { default as sharedControlComponents } from './components';
export * from './components';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ import {
dndXAxisControl,
} from './dndControls';

export { withDndFallback } from './dndControls';

const categoricalSchemeRegistry = getCategoricalSchemeRegistry();
const sequentialSchemeRegistry = getSequentialSchemeRegistry();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export enum FeatureFlag {
EMBEDDABLE_CHARTS = 'EMBEDDABLE_CHARTS',
EMBEDDED_SUPERSET = 'EMBEDDED_SUPERSET',
ENABLE_ADVANCED_DATA_TYPES = 'ENABLE_ADVANCED_DATA_TYPES',
ENABLE_EXPLORE_DRAG_AND_DROP = 'ENABLE_EXPLORE_DRAG_AND_DROP',
ENABLE_JAVASCRIPT_CONTROLS = 'ENABLE_JAVASCRIPT_CONTROLS',
ENABLE_TEMPLATE_PROCESSING = 'ENABLE_TEMPLATE_PROCESSING',
ENABLE_TEMPLATE_REMOVE_FILTERS = 'ENABLE_TEMPLATE_REMOVE_FILTERS',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,9 @@
* under the License.
*/
import React from 'react';
import { t } from '@superset-ui/core';
import {
FeatureFlag,
isFeatureEnabled,
t,
validateNonEmpty,
} from '@superset-ui/core';
import {
columnChoices,
ControlPanelConfig,
ControlPanelState,
formatSelectOptionsForRange,
sections,
sharedControls,
Expand All @@ -41,25 +34,11 @@ const sortAxisChoices = [
['value_desc', t('Metric descending')],
];

const allColumns = {
type: 'SelectControl',
default: null,
description: t('Columns to display'),
mapStateToProps: (state: ControlPanelState) => ({
choices: columnChoices(state.datasource),
}),
validators: [validateNonEmpty],
};

const dndAllColumns = {
...sharedControls.entity,
description: t('Columns to display'),
};

const columnsConfig = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndAllColumns
: allColumns;

const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
Expand All @@ -71,7 +50,7 @@ const config: ControlPanelConfig = {
{
name: 'all_columns_x',
config: {
...columnsConfig,
...dndAllColumns,
label: t('X Axis'),
},
},
Expand All @@ -80,7 +59,7 @@ const config: ControlPanelConfig = {
{
name: 'all_columns_y',
config: {
...columnsConfig,
...dndAllColumns,
label: t('Y Axis'),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
import {
FeatureFlag,
isFeatureEnabled,
t,
validateMapboxStylesUrl,
} from '@superset-ui/core';
import { t, validateMapboxStylesUrl } from '@superset-ui/core';
import {
columnChoices,
ControlPanelConfig,
ControlPanelState,
formatSelectOptions,
sections,
sharedControls,
getStandardizedControls,
} from '@superset-ui/chart-controls';

const allColumns = {
type: 'SelectControl',
default: null,
mapStateToProps: (state: ControlPanelState) => ({
choices: columnChoices(state.datasource),
}),
};

const columnsConfig = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? sharedControls.entity
: allColumns;
const columnsConfig = sharedControls.entity;

const colorChoices = [
['rgb(0, 139, 139)', t('Dark Cyan')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
* under the License.
*/
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import {
t,
legacyValidateInteger,
isFeatureEnabled,
FeatureFlag,
} from '@superset-ui/core';
import { t, legacyValidateInteger } from '@superset-ui/core';
import { formatSelectOptions } from '../../utilities/utils';
import {
filterNulls,
Expand All @@ -37,24 +32,19 @@ import {
extruded,
viewport,
mapboxStyle,
geojsonColumn,
autozoom,
lineWidth,
} from '../../utilities/Shared_DeckGL';
import { dndGeojsonColumn } from '../../utilities/sharedDndControls';

const geojson = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndGeojsonColumn
: geojsonColumn;

const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,
controlSetRows: [
[geojson],
[dndGeojsonColumn],
['row_limit'],
[filterNulls],
['adhoc_filters'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
* under the License.
*/
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
filterNulls,
autozoom,
jsColumns,
jsDataMutator,
jsTooltip,
jsOnclickHref,
lineColumn,
viewport,
lineWidth,
lineType,
Expand All @@ -41,11 +40,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
[
isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndLineColumn
: lineColumn,
],
[dndLineColumn],
[
{
...lineType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
getStandardizedControls,
sections,
} from '@superset-ui/chart-controls';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import timeGrainSqlaAnimationOverrides from '../../utilities/controls';
import { formatSelectOptions } from '../../utilities/utils';
import {
Expand All @@ -33,7 +33,6 @@ import {
jsOnclickHref,
legendFormat,
legendPosition,
lineColumn,
fillColorPicker,
strokeColorPicker,
filled,
Expand All @@ -49,10 +48,6 @@ import {
} from '../../utilities/Shared_DeckGL';
import { dndLineColumn } from '../../utilities/sharedDndControls';

const lines = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndLineColumn
: lineColumn;

const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
Expand All @@ -62,9 +57,9 @@ const config: ControlPanelConfig = {
controlSetRows: [
[
{
...lines,
...dndLineColumn,
config: {
...lines.config,
...dndLineColumn.config,
label: t('Polygon Column'),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlSubSectionHeader,
Expand Down Expand Up @@ -93,9 +93,7 @@ const controlPanel: ControlPanelConfig = {
name: 'metric',
config: {
...optionalEntity,
type: isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? 'DndMetricSelect'
: 'MetricsControl',
type: 'DndMetricSelect',
label: t('Metric'),
description: t('Metric for node values'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,15 @@
* under the License.
*/
import {
ColumnOption,
ControlSetItem,
ExtraControlProps,
sharedControls,
Dataset,
ColumnMeta,
} from '@superset-ui/chart-controls';
import {
ensureIsArray,
FeatureFlag,
isFeatureEnabled,
t,
} from '@superset-ui/core';
import React from 'react';
import { ensureIsArray, t } from '@superset-ui/core';
import { getQueryMode, isRawMode } from './shared';

const allColumns: typeof sharedControls.groupby = {
type: 'SelectControl',
label: t('Columns'),
description: t('Columns to display'),
multi: true,
freeForm: true,
allowAll: true,
commaChoosesOption: false,
default: [],
optionRenderer: c => <ColumnOption showType column={c} />,
valueRenderer: c => <ColumnOption column={c} />,
valueKey: 'column_name',
mapStateToProps: ({ datasource, controls }, controlState) => ({
options: datasource?.columns || [],
queryMode: getQueryMode(controls),
externalValidationErrors:
isRawMode({ controls }) && ensureIsArray(controlState?.value).length === 0
? [t('must have a value')]
: [],
}),
visibility: isRawMode,
resetOnHide: false,
};

const dndAllColumns: typeof sharedControls.groupby = {
type: 'DndColumnSelect',
label: t('Columns'),
Expand Down Expand Up @@ -84,7 +53,5 @@ const dndAllColumns: typeof sharedControls.groupby = {

export const allColumnsControlSetItem: ControlSetItem = {
name: 'all_columns',
config: isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndAllColumns
: allColumns,
config: dndAllColumns,
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
ColumnMeta,
defineSavedMetrics,
} from '@superset-ui/chart-controls';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import { getQueryMode, isAggMode, validateAggControlValues } from './shared';

const percentMetrics: typeof sharedControls.metrics = {
Expand Down Expand Up @@ -64,9 +64,7 @@ const dndPercentMetrics = {
export const percentMetricsControlSetItem: ControlSetItem = {
name: 'percent_metrics',
config: {
...(isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP)
? dndPercentMetrics
: percentMetrics),
...dndPercentMetrics,
},
};

Expand Down
Loading

0 comments on commit 46d55db

Please sign in to comment.