From 8a2f7d378ab13c156fa183d9284b607ed69f5ecc Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:45:57 -0500 Subject: [PATCH] refactor: Removes the deprecated GENERIC_CHART_AXES feature flag (#26372) --- RESOURCES/FEATURE_FLAGS.md | 2 - UPDATING.md | 1 + .../cypress/e2e/dashboard/drillby.test.ts | 24 +- .../e2e/dashboard/drilltodetail.test.ts | 14 +- .../cypress/e2e/dashboard/utils.ts | 14 +- .../templates/src/plugin/controlPanel.erb | 2 +- .../src/operators/sortOperator.ts | 2 - .../src/sections/echartsTimeSeriesQuery.tsx | 22 +- .../src/sections/sections.tsx | 20 +- .../src/shared-controls/mixins.tsx | 10 +- .../src/shared-controls/sharedControls.tsx | 3 +- .../test/operators/sortOperator.test.ts | 23 - .../src/query/extractQueryFields.ts | 12 +- .../superset-ui-core/src/query/getXAxis.ts | 6 - .../src/utils/featureFlags.ts | 1 - .../test/query/buildQueryContext.test.ts | 25 +- .../test/query/extractQueryFields.test.ts | 14 +- .../test/query/normalizeTimeColumn.test.ts | 397 +++++++----------- .../src/controlPanel.ts | 2 - .../src/controlPanel.ts | 2 - .../src/controlPanel.tsx | 2 - .../src/controlPanel.tsx | 2 - .../src/controlPanel.ts | 2 - .../src/controlPanel.ts | 2 - .../src/controlPanel.ts | 2 - .../src/controlPanel.ts | 3 +- .../src/controlPanel.ts | 3 +- .../src/controlPanel.tsx | 2 - .../src/controlPanel.ts | 3 +- .../src/controlPanel.ts | 2 - .../src/controlPanel.ts | 2 - .../src/Multi/controlPanel.ts | 2 - .../src/layers/Arc/controlPanel.ts | 3 +- .../src/layers/Contour/controlPanel.ts | 2 - .../src/layers/Geojson/controlPanel.ts | 3 +- .../src/layers/Grid/controlPanel.ts | 2 - .../src/layers/Heatmap/controlPanel.ts | 2 - .../src/layers/Hex/controlPanel.ts | 2 - .../src/layers/Path/controlPanel.ts | 3 +- .../src/layers/Polygon/controlPanel.ts | 2 - .../src/layers/Scatter/controlPanel.ts | 3 +- .../src/layers/Screengrid/controlPanel.ts | 2 - .../src/Bubble/controlPanel.ts | 2 - .../src/Bullet/controlPanel.ts | 3 +- .../src/DistBar/controlPanel.ts | 2 - .../BigNumber/BigNumberTotal/controlPanel.ts | 2 - .../BigNumberWithTrendline/controlPanel.tsx | 8 +- .../src/BoxPlot/controlPanel.ts | 1 - .../src/Funnel/controlPanel.tsx | 2 - .../src/Gauge/controlPanel.tsx | 2 - .../src/Graph/controlPanel.tsx | 2 - .../src/MixedTimeseries/controlPanel.tsx | 15 +- .../src/MixedTimeseries/index.ts | 19 +- .../src/Pie/controlPanel.tsx | 2 - .../src/Radar/controlPanel.tsx | 2 - .../src/Sunburst/controlPanel.tsx | 2 - .../src/Timeseries/Area/controlPanel.tsx | 1 - .../src/Timeseries/Area/index.ts | 21 +- .../Timeseries/Regular/Bar/controlPanel.tsx | 1 - .../src/Timeseries/Regular/Bar/index.ts | 17 +- .../Timeseries/Regular/Line/controlPanel.tsx | 1 - .../src/Timeseries/Regular/Line/index.ts | 21 +- .../Regular/Scatter/controlPanel.tsx | 1 - .../src/Timeseries/Regular/Scatter/index.ts | 21 +- .../Regular/SmoothLine/controlPanel.tsx | 1 - .../Timeseries/Regular/SmoothLine/index.ts | 21 +- .../src/Timeseries/Step/controlPanel.tsx | 1 - .../src/Timeseries/Step/index.ts | 21 +- .../src/Timeseries/index.ts | 19 +- .../src/Tree/controlPanel.tsx | 2 - .../src/Treemap/controlPanel.tsx | 2 - .../src/Waterfall/controlPanel.tsx | 8 +- .../test/MixedTimeseries/buildQuery.test.ts | 147 +------ .../test/Timeseries/buildQuery.test.ts | 106 +---- .../src/plugin/controlPanel.tsx | 2 - .../src/plugin/buildQuery.ts | 5 - .../src/plugin/controlPanel.tsx | 61 ++- .../test/plugin/buildQuery.test.ts | 28 +- .../plugin-chart-table/src/buildQuery.ts | 2 - .../plugin-chart-table/src/controlPanel.tsx | 74 ++-- .../test/buildQuery.test.ts | 7 - .../src/plugin/controlPanel.ts | 2 - .../src/explore/actions/hydrateExplore.ts | 2 - .../components/ControlPanelsContainer.tsx | 4 +- .../DateFilterControl/DateFilterLabel.tsx | 2 +- .../DndFilterSelect.tsx | 2 - .../index.tsx | 3 +- .../utils/useDatePickerInAdhocFilter.tsx | 4 +- .../utils/useDatePickerInAdhocfilter.test.ts | 21 - .../VizTypeControl/VizTypeControl.test.tsx | 45 +- .../controlUtils/standardizedFormData.test.ts | 4 +- .../filters/components/Range/controlPanel.ts | 2 - .../filters/components/Select/controlPanel.ts | 3 - superset/config.py | 1 - .../examples/supported_charts_dashboard.py | 36 +- superset/legacy.py | 17 +- .../migrations/shared/migrate_viz/base.py | 3 +- tests/unit_tests/legacy_tests.py | 13 +- .../viz/time_related_fields_test.py | 12 +- 99 files changed, 363 insertions(+), 1115 deletions(-) diff --git a/RESOURCES/FEATURE_FLAGS.md b/RESOURCES/FEATURE_FLAGS.md index d782c10cb..8700bcb98 100644 --- a/RESOURCES/FEATURE_FLAGS.md +++ b/RESOURCES/FEATURE_FLAGS.md @@ -45,7 +45,6 @@ These features are **finished** but currently being tested. They are usable, but - DRILL_TO_DETAIL - DYNAMIC_PLUGINS: [(docs)](https://superset.apache.org/docs/installation/running-on-kubernetes) - ESTIMATE_QUERY_COST -- GENERIC_CHART_AXES - GLOBAL_ASYNC_QUERIES [(docs)](https://github.com/apache/superset/blob/master/CONTRIBUTING.md#async-chart-queries) - HORIZONTAL_FILTER_BAR - PLAYWRIGHT_REPORTS_AND_THUMBNAILS @@ -85,5 +84,4 @@ These features flags currently default to True and **will be removed in a future - DASHBOARD_CROSS_FILTERS - ENABLE_JAVASCRIPT_CONTROLS -- GENERIC_CHART_AXES - KV_STORE diff --git a/UPDATING.md b/UPDATING.md index 6b6a56414..ac1164f4d 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -45,6 +45,7 @@ assists people when migrating to a new version. - [26377](https://github.com/apache/superset/pull/26377): Removes the deprecated Redirect API that supported short URLs used before the permalink feature. - [26329](https://github.com/apache/superset/issues/26329): Removes the deprecated `DASHBOARD_NATIVE_FILTERS` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled. - [25510](https://github.com/apache/superset/pull/25510): Reenforces that any newly defined Python data format (other than epoch) must adhere to the ISO 8601 standard (enforced by way of validation at the API and database level) after a previous relaxation to include slashes in addition to dashes. From now on when specifying new columns, dataset owners will need to use a SQL expression instead to convert their string columns of the form %Y/%m/%d etc. to a `DATE`, `DATETIME`, etc. type. +- [26372](https://github.com/apache/superset/issues/26372): Removes the deprecated `GENERIC_CHART_AXES` feature flag. The previous value of the feature flag was `True` and now the feature is permanently enabled. ### Potential Downtime diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts index 50dd7180c..4a2f43538 100644 --- a/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts @@ -503,28 +503,28 @@ describe('Drill by modal', () => { }); it('Line chart', () => { - testEchart('echarts_timeseries_line', 'Time-Series Line Chart', [ + testEchart('echarts_timeseries_line', 'Line Chart', [ [70, 93], [70, 93], ]); }); it('Area Chart', () => { - testEchart('echarts_area', 'Time-Series Area Chart', [ + testEchart('echarts_area', 'Area Chart', [ [70, 93], [70, 93], ]); }); - it('Time-Series Scatter Chart', () => { - testEchart('echarts_timeseries_scatter', 'Time-Series Scatter Chart', [ + it('Scatter Chart', () => { + testEchart('echarts_timeseries_scatter', 'Scatter Chart', [ [70, 93], [70, 93], ]); }); - it('Time-Series Bar Chart V2', () => { - testEchart('echarts_timeseries_bar', 'Time-Series Bar Chart V2', [ + it('Bar Chart V2', () => { + testEchart('echarts_timeseries_bar', 'Bar Chart V2', [ [70, 94], [362, 68], ]); @@ -557,22 +557,22 @@ describe('Drill by modal', () => { ); }); - it('Time-Series Generic Chart', () => { - testEchart('echarts_timeseries', 'Time-Series Generic Chart', [ + it('Generic Chart', () => { + testEchart('echarts_timeseries', 'Generic Chart', [ [70, 93], [70, 93], ]); }); - it('Time-Series Smooth Line Chart', () => { - testEchart('echarts_timeseries_smooth', 'Time-Series Smooth Line Chart', [ + it('Smooth Line Chart', () => { + testEchart('echarts_timeseries_smooth', 'Smooth Line Chart', [ [70, 93], [70, 93], ]); }); - it('Time-Series Step Line Chart', () => { - testEchart('echarts_timeseries_step', 'Time-Series Step Line Chart', [ + it('Step Line Chart', () => { + testEchart('echarts_timeseries_step', 'Step Line Chart', [ [70, 93], [70, 93], ]); diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts index ff1872333..6c1944c0a 100644 --- a/superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/drilltodetail.test.ts @@ -332,13 +332,13 @@ describe('Drill to detail modal', () => { }); }); - describe('Time-Series Line Chart', () => { + describe('Line Chart', () => { it('opens the modal with the correct filters', () => { testTimeChart('echarts_timeseries_line'); }); }); - describe('Time-series Bar Chart', () => { + describe('Bar Chart', () => { it('opens the modal with the correct filters', () => { interceptSamples(); @@ -372,13 +372,13 @@ describe('Drill to detail modal', () => { }); }); - describe('Time-Series Area Chart', () => { + describe('Area Chart', () => { it('opens the modal with the correct filters', () => { testTimeChart('echarts_area'); }); }); - describe('Time-Series Scatter Chart', () => { + describe('Scatter Chart', () => { it('opens the modal with the correct filters', () => { testTimeChart('echarts_timeseries_scatter'); }); @@ -509,19 +509,19 @@ describe('Drill to detail modal', () => { }); }); - describe('Time-Series Generic Chart', () => { + describe('Generic Chart', () => { it('opens the modal with the correct filters', () => { testTimeChart('echarts_timeseries'); }); }); - describe('Time-Series Smooth Chart', () => { + describe('Smooth Chart', () => { it('opens the modal with the correct filters', () => { testTimeChart('echarts_timeseries_smooth'); }); }); - describe('Time-Series Step Line Chart', () => { + describe('Step Line Chart', () => { it('opens the modal with the correct filters', () => { testTimeChart('echarts_timeseries_step'); }); diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/utils.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/utils.ts index ebcd7d6d0..d892c0809 100644 --- a/superset-frontend/cypress-base/cypress/e2e/dashboard/utils.ts +++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/utils.ts @@ -38,17 +38,17 @@ export const SUPPORTED_TIER1_CHARTS = [ { name: 'Pie Chart', viz: 'pie' }, { name: 'Table', viz: 'table' }, { name: 'Pivot Table', viz: 'pivot_table_v2' }, - { name: 'Time-Series Line Chart', viz: 'echarts_timeseries_line' }, - { name: 'Time-Series Area Chart', viz: 'echarts_area' }, - { name: 'Time-Series Scatter Chart', viz: 'echarts_timeseries_scatter' }, - { name: 'Time-Series Bar Chart V2', viz: 'echarts_timeseries_bar' }, + { name: 'Line Chart', viz: 'echarts_timeseries_line' }, + { name: 'Area Chart', viz: 'echarts_area' }, + { name: 'Scatter Chart', viz: 'echarts_timeseries_scatter' }, + { name: 'Bar Chart V2', viz: 'echarts_timeseries_bar' }, ] as ChartSpec[]; export const SUPPORTED_TIER2_CHARTS = [ { name: 'Box Plot Chart', viz: 'box_plot' }, - { name: 'Time-Series Generic Chart', viz: 'echarts_timeseries' }, - { name: 'Time-Series Smooth Line Chart', viz: 'echarts_timeseries_smooth' }, - { name: 'Time-Series Step Line Chart', viz: 'echarts_timeseries_step' }, + { name: 'Generic Chart', viz: 'echarts_timeseries' }, + { name: 'Smooth Line Chart', viz: 'echarts_timeseries_smooth' }, + { name: 'Step Line Chart', viz: 'echarts_timeseries_step' }, { name: 'Funnel Chart', viz: 'funnel' }, { name: 'Gauge Chart', viz: 'gauge_chart' }, { name: 'Radar Chart', viz: 'radar' }, diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb index 14fe5b479..50594776a 100644 --- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb +++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/src/plugin/controlPanel.erb @@ -100,7 +100,7 @@ const config: ControlPanelConfig = { // For control input types, see: superset-frontend/src/explore/components/controls/index.js controlPanelSections: [ - <%if (chartType === 'timeseries') { %>sections.legacyTimeseriesTime,<% } else { %>sections.legacyRegularTime,<% } %> + <%if (chartType === 'timeseries') { %>sections.legacyTimeseriesTime,<% } %> { label: t('Query'), expanded: true, diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/operators/sortOperator.ts b/superset-frontend/packages/superset-ui-chart-controls/src/operators/sortOperator.ts index 4d7b5deaf..74807b5d4 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/operators/sortOperator.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/operators/sortOperator.ts @@ -21,7 +21,6 @@ import { ensureIsArray, getMetricLabel, getXAxisLabel, - hasGenericChartAxes, isDefined, PostProcessingSort, } from '@superset-ui/core'; @@ -40,7 +39,6 @@ export const sortOperator: PostProcessingFactory = ( ].filter(Boolean); if ( - hasGenericChartAxes && isDefined(formData?.x_axis_sort) && isDefined(formData?.x_axis_sort_asc) && sortableLabels.includes(formData.x_axis_sort) && diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/sections/echartsTimeSeriesQuery.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/sections/echartsTimeSeriesQuery.tsx index 596c6f0e5..b293e7844 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/sections/echartsTimeSeriesQuery.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/sections/echartsTimeSeriesQuery.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { hasGenericChartAxes, t } from '@superset-ui/core'; +import { t } from '@superset-ui/core'; import { ControlPanelSectionConfig, ControlSetRow } from '../types'; import { contributionModeControl, @@ -43,24 +43,20 @@ const controlsWithoutXAxis: ControlSetRow[] = [ export const echartsTimeSeriesQuery: ControlPanelSectionConfig = { label: t('Query'), expanded: true, - controlSetRows: [ - [hasGenericChartAxes ? 'x_axis' : null], - [hasGenericChartAxes ? 'time_grain_sqla' : null], - ...controlsWithoutXAxis, - ], + controlSetRows: [['x_axis'], ['time_grain_sqla'], ...controlsWithoutXAxis], }; export const echartsTimeSeriesQueryWithXAxisSort: ControlPanelSectionConfig = { label: t('Query'), expanded: true, controlSetRows: [ - [hasGenericChartAxes ? 'x_axis' : null], - [hasGenericChartAxes ? 'time_grain_sqla' : null], - [hasGenericChartAxes ? xAxisForceCategoricalControl : null], - [hasGenericChartAxes ? xAxisSortControl : null], - [hasGenericChartAxes ? xAxisSortAscControl : null], - [hasGenericChartAxes ? xAxisSortSeriesControl : null], - [hasGenericChartAxes ? xAxisSortSeriesAscendingControl : null], + ['x_axis'], + ['time_grain_sqla'], + [xAxisForceCategoricalControl], + [xAxisSortControl], + [xAxisSortAscControl], + [xAxisSortSeriesControl], + [xAxisSortSeriesAscendingControl], ...controlsWithoutXAxis, ], }; diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/sections/sections.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/sections/sections.tsx index 4535f1996..a338f6e76 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/sections/sections.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/sections/sections.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { hasGenericChartAxes, t } from '@superset-ui/core'; +import { t } from '@superset-ui/core'; import { ControlPanelSectionConfig } from '../types'; // A few standard controls sections that are used internally. @@ -38,24 +38,6 @@ export const legacyTimeseriesTime: ControlPanelSectionConfig = { ], }; -export const genericTime: ControlPanelSectionConfig = hasGenericChartAxes - ? { controlSetRows: [] } - : { - ...baseTimeSection, - controlSetRows: [ - ['granularity_sqla'], - ['time_grain_sqla'], - ['time_range'], - ], - }; - -export const legacyRegularTime: ControlPanelSectionConfig = hasGenericChartAxes - ? { controlSetRows: [] } - : { - ...baseTimeSection, - controlSetRows: [['granularity_sqla'], ['time_range']], - }; - export const datasourceAndVizType: ControlPanelSectionConfig = { label: t('Datasource & Chart Type'), expanded: true, diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx index 1db389dde..d9396270e 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/mixins.tsx @@ -18,7 +18,6 @@ */ import { ensureIsArray, - hasGenericChartAxes, NO_TIME_RANGE, QueryFormData, t, @@ -42,7 +41,6 @@ export const xAxisMixin = { validators: [validateNonEmpty], initialValue: (control: ControlState, state: ControlPanelState | null) => { if ( - hasGenericChartAxes && state?.form_data?.granularity_sqla && !state.form_data?.x_axis && !control?.value @@ -72,11 +70,9 @@ export const datePickerInAdhocFilterMixin: Pick< > = { initialValue: (control: ControlState, state: ControlPanelState | null) => { // skip initialValue if - // 1) GENERIC_CHART_AXES is disabled - // 2) the time_range control is present (this is the case for legacy charts) - // 3) there was a time filter in adhoc filters + // 1) the time_range control is present (this is the case for legacy charts) + // 2) there was a time filter in adhoc filters if ( - !hasGenericChartAxes || state?.controls?.time_range?.value || ensureIsArray(control.value).findIndex( (flt: any) => flt?.operator === 'TEMPORAL_RANGE', @@ -105,7 +101,7 @@ export const datePickerInAdhocFilterMixin: Pick< const temporalColumn = state?.datasource && getTemporalColumns(state.datasource).defaultTemporalColumn; - if (hasGenericChartAxes && temporalColumn) { + if (temporalColumn) { return [ ...ensureIsArray(control.value), { diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx index aec23e8dd..2be91cf5d 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx @@ -45,7 +45,6 @@ import { isPhysicalColumn, ensureIsArray, isDefined, - hasGenericChartAxes, NO_TIME_RANGE, validateMaxValue, } from '@superset-ui/core'; @@ -205,7 +204,7 @@ const time_grain_sqla: SharedControlConfig<'SelectControl'> = { choices: (datasource as Dataset)?.time_grain_sqla || [], }), visibility: ({ controls }) => { - if (!hasGenericChartAxes || !controls?.x_axis) { + if (!controls?.x_axis) { return true; } diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/operators/sortOperator.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/operators/sortOperator.test.ts index 41d44b50a..bf9b6e286 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/test/operators/sortOperator.test.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/test/operators/sortOperator.test.ts @@ -18,7 +18,6 @@ */ import { QueryObject, SqlaFormData } from '@superset-ui/core'; import { sortOperator } from '@superset-ui/chart-controls'; -import * as supersetCoreModule from '@superset-ui/core'; const formData: SqlaFormData = { metrics: [ @@ -54,16 +53,6 @@ const queryObject: QueryObject = { }; test('should ignore the sortOperator', () => { - // FF is disabled - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: false, - }); - expect(sortOperator(formData, queryObject)).toEqual(undefined); - - // FF is enabled - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); expect( sortOperator( { @@ -78,9 +67,6 @@ test('should ignore the sortOperator', () => { ).toEqual(undefined); // sortOperator doesn't support multiple series - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); expect( sortOperator( { @@ -98,9 +84,6 @@ test('should ignore the sortOperator', () => { }); test('should sort by metric', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); expect( sortOperator( { @@ -123,9 +106,6 @@ test('should sort by metric', () => { }); test('should sort by axis', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); expect( sortOperator( { @@ -148,9 +128,6 @@ test('should sort by axis', () => { }); test('should sort by extra metric', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); expect( sortOperator( { diff --git a/superset-frontend/packages/superset-ui-core/src/query/extractQueryFields.ts b/superset-frontend/packages/superset-ui-core/src/query/extractQueryFields.ts index bef753725..bbd173e61 100644 --- a/superset-frontend/packages/superset-ui-core/src/query/extractQueryFields.ts +++ b/superset-frontend/packages/superset-ui-core/src/query/extractQueryFields.ts @@ -18,7 +18,6 @@ */ import { t } from '../translation'; import { removeDuplicates } from '../utils'; -import { DTTM_ALIAS } from './constants'; import getColumnLabel from './getColumnLabel'; import getMetricLabel from './getMetricLabel'; import { @@ -30,7 +29,6 @@ import { FormDataResidual, QueryMode, } from './types/QueryFormData'; -import { hasGenericChartAxes } from './getXAxis'; /** * Extra SQL query related fields from chart form data. @@ -57,11 +55,7 @@ export default function extractQueryFields( order_by_cols: 'orderby', ...aliases, }; - const { - query_mode: queryMode, - include_time: includeTime, - ...restFormData - } = formData; + const { query_mode: queryMode, ...restFormData } = formData; let columns: QueryFormColumn[] = []; let metrics: QueryFormMetric[] = []; @@ -106,10 +100,6 @@ export default function extractQueryFields( } }); - if (!hasGenericChartAxes && includeTime && !columns.includes(DTTM_ALIAS)) { - columns.unshift(DTTM_ALIAS); - } - return { columns: removeDuplicates( columns.filter(col => col !== ''), diff --git a/superset-frontend/packages/superset-ui-core/src/query/getXAxis.ts b/superset-frontend/packages/superset-ui-core/src/query/getXAxis.ts index 7c329c2a8..8b36e89c1 100644 --- a/superset-frontend/packages/superset-ui-core/src/query/getXAxis.ts +++ b/superset-frontend/packages/superset-ui-core/src/query/getXAxis.ts @@ -18,8 +18,6 @@ */ import { DTTM_ALIAS, - FeatureFlag, - isFeatureEnabled, getColumnLabel, isQueryFormColumn, QueryFormData, @@ -30,10 +28,6 @@ import { export const isXAxisSet = (formData: QueryFormData) => isQueryFormColumn(formData.x_axis); -export const hasGenericChartAxes = isFeatureEnabled( - FeatureFlag.GENERIC_CHART_AXES, -); - export const getXAxisColumn = ( formData: QueryFormData, ): Optional => { diff --git a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts index f993e451f..4f6fece61 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/featureFlags.ts @@ -44,7 +44,6 @@ export enum FeatureFlag { ENABLE_TEMPLATE_PROCESSING = 'ENABLE_TEMPLATE_PROCESSING', ESCAPE_MARKDOWN_HTML = 'ESCAPE_MARKDOWN_HTML', ESTIMATE_QUERY_COST = 'ESTIMATE_QUERY_COST', - GENERIC_CHART_AXES = 'GENERIC_CHART_AXES', GLOBAL_ASYNC_QUERIES = 'GLOBAL_ASYNC_QUERIES', HORIZONTAL_FILTER_BAR = 'HORIZONTAL_FILTER_BAR', LISTVIEWS_DEFAULT_CARD_VIEW = 'LISTVIEWS_DEFAULT_CARD_VIEW', diff --git a/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts b/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts index 9d47361e8..4fe70f918 100644 --- a/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts +++ b/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts @@ -18,7 +18,6 @@ */ import { buildQueryContext } from '@superset-ui/core'; import * as queryModule from '../../src/query/normalizeTimeColumn'; -import * as getXAxisModule from '../../src/query/getXAxis'; describe('buildQueryContext', () => { it('should build datasource for table sources and apply defaults', () => { @@ -125,10 +124,7 @@ describe('buildQueryContext', () => { }, ]); }); - it('should call normalizeTimeColumn if GENERIC_CHART_AXES is enabled and has x_axis', () => { - Object.defineProperty(getXAxisModule, 'hasGenericChartAxes', { - value: true, - }); + it('should call normalizeTimeColumn if has x_axis', () => { const spyNormalizeTimeColumn = jest.spyOn( queryModule, 'normalizeTimeColumn', @@ -145,23 +141,4 @@ describe('buildQueryContext', () => { expect(spyNormalizeTimeColumn).toBeCalled(); spyNormalizeTimeColumn.mockRestore(); }); - it("shouldn't call normalizeTimeColumn if GENERIC_CHART_AXES is disabled", () => { - Object.defineProperty(getXAxisModule, 'hasGenericChartAxes', { - value: false, - }); - const spyNormalizeTimeColumn = jest.spyOn( - queryModule, - 'normalizeTimeColumn', - ); - - buildQueryContext( - { - datasource: '5__table', - viz_type: 'table', - }, - () => [{}], - ); - expect(spyNormalizeTimeColumn).not.toBeCalled(); - spyNormalizeTimeColumn.mockRestore(); - }); }); diff --git a/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts b/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts index dfc48c50a..56004a06e 100644 --- a/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts +++ b/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { configure, QueryMode, DTTM_ALIAS } from '@superset-ui/core'; +import { configure, QueryMode } from '@superset-ui/core'; import extractQueryFields from '../../src/query/extractQueryFields'; import { NUM_METRIC } from '../fixtures'; @@ -112,18 +112,6 @@ describe('extractQueryFields', () => { }); }); - it('should include time', () => { - expect( - extractQueryFields({ groupby: 'col_1', include_time: true }).columns, - ).toEqual([DTTM_ALIAS, 'col_1']); - expect( - extractQueryFields({ - groupby: ['col_1', DTTM_ALIAS, ''], - include_time: true, - }).columns, - ).toEqual(['col_1', DTTM_ALIAS]); - }); - it('should ignore null values', () => { expect( extractQueryFields({ series: ['a'], columns: null }).columns, diff --git a/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts b/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts index 2f6bdd0fb..59419bda6 100644 --- a/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts +++ b/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts @@ -22,272 +22,165 @@ import { SqlaFormData, } from '@superset-ui/core'; -describe('GENERIC_CHART_AXES is disabled', () => { - let windowSpy: any; - - beforeAll(() => { - // @ts-ignore - windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: false, - }, - })); - }); - - afterAll(() => { - windowSpy.mockRestore(); - }); - - it('should return original QueryObject if disabled GENERIC_CHART_AXES', () => { - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', +test('should return original QueryObject if x_axis is empty', () => { + const formData: SqlaFormData = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + time_grain_sqla: 'P1Y', + time_range: '1 year ago : 2013', + columns: ['col1'], + metrics: ['count(*)'], + }; + const query: QueryObject = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + extras: { time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - columns: ['col1'], - metrics: ['count(*)'], - }; - const query: QueryObject = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', - }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: ['col1'], - metrics: ['count(*)'], - is_timeseries: true, - }; - expect(normalizeTimeColumn(formData, query)).toEqual(query); - }); + }, + time_range: '1 year ago : 2013', + orderby: [['count(*)', true]], + columns: ['col1'], + metrics: ['count(*)'], + is_timeseries: true, + }; + expect(normalizeTimeColumn(formData, query)).toEqual(query); +}); - it('should return converted QueryObject even though disabled GENERIC_CHART_AXES (x_axis in formData)', () => { - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', +test('should support different columns for x-axis and granularity', () => { + const formData: SqlaFormData = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + time_grain_sqla: 'P1Y', + time_range: '1 year ago : 2013', + x_axis: 'time_column_in_x_axis', + columns: ['col1'], + metrics: ['count(*)'], + }; + const query: QueryObject = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + extras: { time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - columns: ['col1'], - metrics: ['count(*)'], - x_axis: 'time_column', - }; - const query: QueryObject = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', + where: '', + having: '', + }, + time_range: '1 year ago : 2013', + orderby: [['count(*)', true]], + columns: ['time_column_in_x_axis', 'col1'], + metrics: ['count(*)'], + is_timeseries: true, + }; + expect(normalizeTimeColumn(formData, query)).toEqual({ + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + extras: { where: '', having: '', time_grain_sqla: 'P1Y' }, + time_range: '1 year ago : 2013', + orderby: [['count(*)', true]], + columns: [ + { + timeGrain: 'P1Y', + columnType: 'BASE_AXIS', + sqlExpression: 'time_column_in_x_axis', + label: 'time_column_in_x_axis', + expressionType: 'SQL', }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: ['time_column', 'col1'], - metrics: ['count(*)'], - is_timeseries: true, - }; - expect(normalizeTimeColumn(formData, query)).toEqual({ - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', - }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: [ - { - timeGrain: 'P1Y', - columnType: 'BASE_AXIS', - sqlExpression: 'time_column', - label: 'time_column', - expressionType: 'SQL', - }, - 'col1', - ], - metrics: ['count(*)'], - }); + 'col1', + ], + metrics: ['count(*)'], }); }); -describe('GENERIC_CHART_AXES is enabled', () => { - let windowSpy: any; - - beforeAll(() => { - // @ts-ignore - windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: true, - }, - })); - }); - - afterAll(() => { - windowSpy.mockRestore(); - }); - - it('should return original QueryObject if x_axis is empty', () => { - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', +test('should support custom SQL in x-axis', () => { + const formData: SqlaFormData = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + time_grain_sqla: 'P1Y', + time_range: '1 year ago : 2013', + x_axis: { + expressionType: 'SQL', + label: 'Order Data + 1 year', + sqlExpression: '"Order Date" + interval \'1 year\'', + }, + columns: ['col1'], + metrics: ['count(*)'], + }; + const query: QueryObject = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + extras: { time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - columns: ['col1'], - metrics: ['count(*)'], - }; - const query: QueryObject = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', - }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: ['col1'], - metrics: ['count(*)'], - is_timeseries: true, - }; - expect(normalizeTimeColumn(formData, query)).toEqual(query); - }); - - it('should support different columns for x-axis and granularity', () => { - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - x_axis: 'time_column_in_x_axis', - columns: ['col1'], - metrics: ['count(*)'], - }; - const query: QueryObject = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', - where: '', - having: '', - }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: ['time_column_in_x_axis', 'col1'], - metrics: ['count(*)'], - is_timeseries: true, - }; - expect(normalizeTimeColumn(formData, query)).toEqual({ - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { where: '', having: '', time_grain_sqla: 'P1Y' }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: [ - { - timeGrain: 'P1Y', - columnType: 'BASE_AXIS', - sqlExpression: 'time_column_in_x_axis', - label: 'time_column_in_x_axis', - expressionType: 'SQL', - }, - 'col1', - ], - metrics: ['count(*)'], - }); - }); - - it('should support custom SQL in x-axis', () => { - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - x_axis: { + where: '', + having: '', + }, + time_range: '1 year ago : 2013', + orderby: [['count(*)', true]], + columns: [ + { expressionType: 'SQL', label: 'Order Data + 1 year', sqlExpression: '"Order Date" + interval \'1 year\'', }, - columns: ['col1'], - metrics: ['count(*)'], - }; - const query: QueryObject = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', - where: '', - having: '', - }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: [ - { - expressionType: 'SQL', - label: 'Order Data + 1 year', - sqlExpression: '"Order Date" + interval \'1 year\'', - }, - 'col1', - ], - metrics: ['count(*)'], - is_timeseries: true, - }; - expect(normalizeTimeColumn(formData, query)).toEqual({ - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { where: '', having: '', time_grain_sqla: 'P1Y' }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - columns: [ - { - timeGrain: 'P1Y', - columnType: 'BASE_AXIS', - expressionType: 'SQL', - label: 'Order Data + 1 year', - sqlExpression: `"Order Date" + interval '1 year'`, - }, - 'col1', - ], - metrics: ['count(*)'], - }); - }); - - it('fallback and invalid columns value', () => { - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - x_axis: { + 'col1', + ], + metrics: ['count(*)'], + is_timeseries: true, + }; + expect(normalizeTimeColumn(formData, query)).toEqual({ + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + extras: { where: '', having: '', time_grain_sqla: 'P1Y' }, + time_range: '1 year ago : 2013', + orderby: [['count(*)', true]], + columns: [ + { + timeGrain: 'P1Y', + columnType: 'BASE_AXIS', expressionType: 'SQL', label: 'Order Data + 1 year', - sqlExpression: '"Order Date" + interval \'1 year\'', + sqlExpression: `"Order Date" + interval '1 year'`, }, - columns: ['col1'], - metrics: ['count(*)'], - }; - const query: QueryObject = { - datasource: '5__table', - viz_type: 'table', - granularity: 'time_column', - extras: { - time_grain_sqla: 'P1Y', - where: '', - having: '', - }, - time_range: '1 year ago : 2013', - orderby: [['count(*)', true]], - metrics: ['count(*)'], - is_timeseries: true, - }; - expect(normalizeTimeColumn(formData, query)).toEqual(query); + 'col1', + ], + metrics: ['count(*)'], }); }); + +test('fallback and invalid columns value', () => { + const formData: SqlaFormData = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + time_grain_sqla: 'P1Y', + time_range: '1 year ago : 2013', + x_axis: { + expressionType: 'SQL', + label: 'Order Data + 1 year', + sqlExpression: '"Order Date" + interval \'1 year\'', + }, + columns: ['col1'], + metrics: ['count(*)'], + }; + const query: QueryObject = { + datasource: '5__table', + viz_type: 'table', + granularity: 'time_column', + extras: { + time_grain_sqla: 'P1Y', + where: '', + having: '', + }, + time_range: '1 year ago : 2013', + orderby: [['count(*)', true]], + metrics: ['count(*)'], + is_timeseries: true, + }; + expect(normalizeTimeColumn(formData, query)).toEqual(query); +}); diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-chord/src/controlPanel.ts index 5a58b567a..679e95970 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-chord/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-chord/src/controlPanel.ts @@ -20,12 +20,10 @@ import { ensureIsArray, t, validateNonEmpty } from '@superset-ui/core'; import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts index c6b26bd2b..944bf9ded 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts @@ -21,14 +21,12 @@ import { ControlPanelConfig, D3_FORMAT_OPTIONS, D3_FORMAT_DOCS, - sections, getStandardizedControls, } from '@superset-ui/chart-controls'; import { countryOptions } from './countries'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx index 22d5c8ce4..adf58a788 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-event-flow/src/controlPanel.tsx @@ -25,13 +25,11 @@ import { ControlPanelConfig, ControlState, formatSelectOptionsForRange, - sections, SelectControlConfig, } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Event definition'), controlSetRows: [ diff --git a/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx index 44bb75cea..500ab0ecf 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-heatmap/src/controlPanel.tsx @@ -21,7 +21,6 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, formatSelectOptionsForRange, - sections, sharedControls, getStandardizedControls, D3_TIME_FORMAT_DOCS, @@ -41,7 +40,6 @@ const dndAllColumns = { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts index 08e315ba4..81ca460fe 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts @@ -22,7 +22,6 @@ import { ControlPanelConfig, ControlPanelState, formatSelectOptions, - sections, getStandardizedControls, sharedControls, ControlState, @@ -41,7 +40,6 @@ const columnsConfig = { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts index c81e802b3..c96b2f0ed 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/controlPanel.ts @@ -20,12 +20,10 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, formatSelectOptions, - sections, } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts index f82701b5b..fec1b6fb6 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/src/controlPanel.ts @@ -21,7 +21,6 @@ import { columnChoices, ControlPanelConfig, formatSelectOptions, - sections, sharedControls, getStandardizedControls, } from '@superset-ui/chart-controls'; @@ -39,7 +38,6 @@ const colorChoices = [ const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts index ea87c024e..1fc693dc1 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/src/controlPanel.ts @@ -17,11 +17,10 @@ * under the License. */ import { t, validateNonEmpty } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts index 66fd5dcca..1f18d4e4e 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/controlPanel.ts @@ -17,11 +17,10 @@ * under the License. */ import { t } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx index 061c54c1c..f7dfcc0c0 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx @@ -26,13 +26,11 @@ import { D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import OptionDescription from './OptionDescription'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts index d09c4aedc..74d2b7ff7 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts @@ -17,11 +17,10 @@ * under the License. */ import { t } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts index 38f25f05b..ef9f0394d 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts @@ -20,12 +20,10 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts index 4d1a21561..2ca11373f 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts +++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/controlPanel.ts @@ -21,13 +21,11 @@ import { ControlPanelConfig, formatSelectOptions, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { ColorBy } from './utils'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/controlPanel.ts index 8f4df671c..bfabd2a0e 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/controlPanel.ts @@ -17,12 +17,10 @@ * under the License. */ import { t, validateNonEmpty } from '@superset-ui/core'; -import { sections } from '@superset-ui/chart-controls'; import { viewport, mapboxStyle } from '../utilities/Shared_DeckGL'; export default { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Map'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/controlPanel.ts index 664f389a0..21ea9cc8c 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Arc/controlPanel.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; import { t, validateNonEmpty, legacyValidateInteger } from '@superset-ui/core'; import timeGrainSqlaAnimationOverrides, { columnChoices, @@ -39,7 +39,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/controlPanel.ts index 407cab316..a154e1879 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/controlPanel.ts @@ -19,7 +19,6 @@ import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { t, validateNonEmpty } from '@superset-ui/core'; import { @@ -36,7 +35,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/controlPanel.ts index 27ebb3be9..079c35248 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Geojson/controlPanel.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; import { t, legacyValidateInteger } from '@superset-ui/core'; import { formatSelectOptions } from '../../utilities/utils'; import { @@ -39,7 +39,6 @@ import { dndGeojsonColumn } from '../../utilities/sharedDndControls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts index fa9a03a8f..a86118e57 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Grid/controlPanel.ts @@ -19,7 +19,6 @@ import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { t, validateNonEmpty } from '@superset-ui/core'; import { @@ -38,7 +37,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/controlPanel.ts index fd343eed1..eed6bbe2d 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Heatmap/controlPanel.ts @@ -18,7 +18,6 @@ */ import { ControlPanelConfig, - sections, formatSelectOptions, } from '@superset-ui/chart-controls'; import { @@ -50,7 +49,6 @@ const RADIUS_PIXEL_OPTIONS = Array.from( const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts index 8865ed005..109cef77d 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Hex/controlPanel.ts @@ -19,7 +19,6 @@ import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { t } from '@superset-ui/core'; import { @@ -38,7 +37,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts index a11ca7f1a..b3488d4ec 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/controlPanel.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; import { t } from '@superset-ui/core'; import { filterNulls, @@ -35,7 +35,6 @@ import { dndLineColumn } from '../../utilities/sharedDndControls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts index 490f87de4..2e7ff0807 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/controlPanel.ts @@ -19,7 +19,6 @@ import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { t } from '@superset-ui/core'; import timeGrainSqlaAnimationOverrides from '../../utilities/controls'; @@ -50,7 +49,6 @@ import { dndLineColumn } from '../../utilities/sharedDndControls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts index 9afeb1b41..3943249c4 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Scatter/controlPanel.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; import { t, validateNonEmpty } from '@superset-ui/core'; import timeGrainSqlaAnimationOverrides from '../../utilities/controls'; import { @@ -49,7 +49,6 @@ const config: ControlPanelConfig = { }, }), controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts index 82aeda174..a1b49a232 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts @@ -19,7 +19,6 @@ import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { t, validateNonEmpty } from '@superset-ui/core'; import timeGrainSqlaAnimationOverrides from '../../utilities/controls'; @@ -38,7 +37,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts index 773caa0fd..8763f467f 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts @@ -21,7 +21,6 @@ import { ControlPanelConfig, formatSelectOptions, D3_FORMAT_OPTIONS, - sections, getStandardizedControls, } from '@superset-ui/chart-controls'; import { @@ -40,7 +39,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/controlPanel.ts index 7f82e33d1..17d5e7a88 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/Bullet/controlPanel.ts @@ -17,11 +17,10 @@ * under the License. */ import { t } from '@superset-ui/core'; -import { ControlPanelConfig, sections } from '@superset-ui/chart-controls'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts index 58033938f..9b992897b 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts @@ -20,7 +20,6 @@ import { ensureIsArray, t, validateNonEmpty } from '@superset-ui/core'; import { ColumnMeta, ControlPanelConfig, - sections, sharedControls, getStandardizedControls, } from '@superset-ui/chart-controls'; @@ -41,7 +40,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts index 2bb1c1d1d..39b97bfd3 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts @@ -23,13 +23,11 @@ import { D3_TIME_FORMAT_OPTIONS, Dataset, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { headerFontSize, subheaderFontSize } from '../sharedControls'; export default { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx index 26bae683c..3e02ccce8 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -import { hasGenericChartAxes, smartDateFormatter, t } from '@superset-ui/core'; +import { smartDateFormatter, t } from '@superset-ui/core'; import { ControlPanelConfig, ControlSubSectionHeader, D3_FORMAT_DOCS, D3_TIME_FORMAT_OPTIONS, getStandardizedControls, - sections, temporalColumnMixin, } from '@superset-ui/chart-controls'; import React from 'react'; @@ -31,13 +30,12 @@ import { headerFontSize, subheaderFontSize } from '../sharedControls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, { label: t('Query'), expanded: true, controlSetRows: [ - [hasGenericChartAxes ? 'x_axis' : null], - [hasGenericChartAxes ? 'time_grain_sqla' : null], + ['x_axis'], + ['time_grain_sqla'], ['metric'], ['adhoc_filters'], ], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts index da21e3cfe..e2208892f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts @@ -39,7 +39,6 @@ import { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx index 3908ea451..da0b06675 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx @@ -26,7 +26,6 @@ import { D3_FORMAT_OPTIONS, D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, getStandardizedControls, - sections, sharedControls, } from '@superset-ui/chart-controls'; import { @@ -44,7 +43,6 @@ funnelLegendSection.splice(2, 1); const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx index a7e0d3fdc..1a0c079e6 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx @@ -23,14 +23,12 @@ import { ControlPanelConfig, ControlSubSectionHeader, D3_FORMAT_OPTIONS, - sections, getStandardizedControls, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './types'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Graph/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Graph/controlPanel.tsx index 2aed1584e..b594eb5a9 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Graph/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Graph/controlPanel.tsx @@ -22,7 +22,6 @@ import { ControlPanelConfig, ControlSubSectionHeader, getStandardizedControls, - sections, sharedControls, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './types'; @@ -41,7 +40,6 @@ const optionalEntity = { const controlPanel: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx index d3fb1fc53..5b24c9ab5 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx @@ -17,7 +17,7 @@ * under the License. */ import React from 'react'; -import { ensureIsArray, hasGenericChartAxes, t } from '@superset-ui/core'; +import { ensureIsArray, t } from '@superset-ui/core'; import { cloneDeep } from 'lodash'; import { ControlPanelConfig, @@ -284,14 +284,11 @@ function createAdvancedAnalyticsSection( const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, - hasGenericChartAxes - ? { - label: t('Shared query fields'), - expanded: true, - controlSetRows: [['x_axis'], ['time_grain_sqla']], - } - : null, + { + label: t('Shared query fields'), + expanded: true, + controlSetRows: [['x_axis'], ['time_grain_sqla']], + }, createQuerySection(t('Query A'), ''), createAdvancedAnalyticsSection(t('Advanced analytics Query A'), ''), createQuerySection(t('Query B'), '_b'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts index e8616a41a..f87d84132 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import buildQuery from './buildQuery'; import controlPanel from './controlPanel'; import transformProps from './transformProps'; @@ -60,13 +55,9 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin< ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Visualize two different series using the same x-axis. Note that both series can be visualized with a different chart type (e.g. 1 using bars and 1 using a line).', - ) - : t( - 'Visualize two different time series using the same x-axis. Note that each time series can be visualized differently (e.g. 1 using bars and 1 using a line).', - ), + description: t( + 'Visualize two different series using the same x-axis. Note that both series can be visualized with a different chart type (e.g. 1 using bars and 1 using a line).', + ), supportedAnnotationTypes: [ AnnotationType.Event, AnnotationType.Formula, @@ -74,7 +65,7 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin< AnnotationType.Timeseries, ], exampleGallery: [{ url: example }], - name: hasGenericChartAxes ? t('Mixed Chart') : t('Mixed Time-Series'), + name: t('Mixed Chart'), thumbnail, tags: [ t('Advanced-Analytics'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx index 8a7612c20..1afc64924 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Pie/controlPanel.tsx @@ -26,7 +26,6 @@ import { D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, - sections, getStandardizedControls, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './types'; @@ -45,7 +44,6 @@ const { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx index 838620768..3b423c512 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx @@ -31,7 +31,6 @@ import { D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, - sections, sharedControls, ControlFormItemSpec, getStandardizedControls, @@ -60,7 +59,6 @@ const radarMetricMaxValue: { name: string; config: ControlFormItemSpec } = { const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx index 1957caa23..3d4506f31 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Sunburst/controlPanel.tsx @@ -27,7 +27,6 @@ import { D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './types'; @@ -35,7 +34,6 @@ const { labelType, numberFormat, showLabels } = DEFAULT_FORM_DATA; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx index 2d8bf549a..79cd92a50 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx @@ -58,7 +58,6 @@ const { } = DEFAULT_FORM_DATA; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, sections.echartsTimeSeriesQueryWithXAxisSort, sections.advancedAnalyticsControls, sections.annotationsAndLayersControls, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/index.ts index 40cb06d44..b0fdfed0f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - t, - AnnotationType, - Behavior, - hasGenericChartAxes, -} from '@superset-ui/core'; +import { t, AnnotationType, Behavior } from '@superset-ui/core'; import buildQuery from '../buildQuery'; import controlPanel from './controlPanel'; import transformProps from '../transformProps'; @@ -56,13 +51,9 @@ export default class EchartsAreaChartPlugin extends EchartsChartPlugin< ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Area charts are similar to line charts in that they represent variables with the same scale, but area charts stack the metrics on top of each other.', - ) - : t( - 'Time-series Area chart are similar to line chart in that they represent variables with the same scale, but area charts stack the metrics on top of each other. An area chart in Superset can be stream, stack, or expand.', - ), + description: t( + 'Area charts are similar to line charts in that they represent variables with the same scale, but area charts stack the metrics on top of each other.', + ), exampleGallery: [{ url: example1 }], supportedAnnotationTypes: [ AnnotationType.Event, @@ -70,9 +61,7 @@ export default class EchartsAreaChartPlugin extends EchartsChartPlugin< AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes - ? t('Area Chart') - : t('Time-series Area Chart'), + name: t('Area Chart'), tags: [ t('ECharts'), t('Predictive'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx index 23cdae6a3..50cf3549f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx @@ -255,7 +255,6 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, sections.echartsTimeSeriesQueryWithXAxisSort, sections.advancedAnalyticsControls, sections.annotationsAndLayersControls, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/index.ts index d88f54a8e..8057c8f0d 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import { EchartsTimeseriesChartProps, EchartsTimeseriesFormData, @@ -62,11 +57,9 @@ export default class EchartsTimeseriesBarChartPlugin extends EchartsChartPlugin< ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t('Bar Charts are used to show metrics as a series of bars.') - : t( - 'Time-series Bar Charts are used to show the changes in a metric over time as a series of bars.', - ), + description: t( + 'Bar Charts are used to show metrics as a series of bars.', + ), exampleGallery: [ { url: example1 }, { url: example2 }, @@ -78,7 +71,7 @@ export default class EchartsTimeseriesBarChartPlugin extends EchartsChartPlugin< AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes ? t('Bar Chart') : t('Time-series Bar Chart'), + name: t('Bar Chart'), tags: [ t('ECharts'), t('Predictive'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx index 1b2e7688e..f6f3fb8e8 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx @@ -59,7 +59,6 @@ const { } = DEFAULT_FORM_DATA; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, sections.echartsTimeSeriesQueryWithXAxisSort, sections.advancedAnalyticsControls, sections.annotationsAndLayersControls, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/index.ts index f0b6fad88..e83f19e59 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import { EchartsTimeseriesChartProps, EchartsTimeseriesFormData, @@ -61,13 +56,9 @@ export default class EchartsTimeseriesLineChartPlugin extends EchartsChartPlugin ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Line chart is used to visualize measurements taken over a given category. Line chart is a type of chart which displays information as a series of data points connected by straight line segments. It is a basic type of chart common in many fields.', - ) - : t( - 'Time-series line chart is used to visualize repeated measurements taken over regular time intervals. Line chart is a type of chart which displays information as a series of data points connected by straight line segments. It is a basic type of chart common in many fields.', - ), + description: t( + 'Line chart is used to visualize measurements taken over a given category. Line chart is a type of chart which displays information as a series of data points connected by straight line segments. It is a basic type of chart common in many fields.', + ), exampleGallery: [{ url: example1 }, { url: example2 }], supportedAnnotationTypes: [ AnnotationType.Event, @@ -75,9 +66,7 @@ export default class EchartsTimeseriesLineChartPlugin extends EchartsChartPlugin AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes - ? t('Line Chart') - : t('Time-series Line Chart'), + name: t('Line Chart'), tags: [ t('ECharts'), t('Predictive'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx index 334f4438c..66550b418 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx @@ -55,7 +55,6 @@ const { } = DEFAULT_FORM_DATA; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, sections.echartsTimeSeriesQueryWithXAxisSort, sections.advancedAnalyticsControls, sections.annotationsAndLayersControls, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/index.ts index 1577a6256..753f9150d 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import { EchartsTimeseriesChartProps, EchartsTimeseriesFormData, @@ -60,13 +55,9 @@ export default class EchartsTimeseriesScatterChartPlugin extends EchartsChartPlu ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Scatter Plot has the horizontal axis in linear units, and the points are connected in order. It shows a statistical relationship between two variables.', - ) - : t( - 'Time-series Scatter Plot has time on the horizontal axis in linear units, and the points are connected in order. It shows a statistical relationship between two variables.', - ), + description: t( + 'Scatter Plot has the horizontal axis in linear units, and the points are connected in order. It shows a statistical relationship between two variables.', + ), exampleGallery: [{ url: example1 }], supportedAnnotationTypes: [ AnnotationType.Event, @@ -74,9 +65,7 @@ export default class EchartsTimeseriesScatterChartPlugin extends EchartsChartPlu AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes - ? t('Scatter Plot') - : t('Time-series Scatter Plot'), + name: t('Scatter Plot'), tags: [ t('ECharts'), t('Predictive'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx index 24ff0bfa8..6472eeea1 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx @@ -55,7 +55,6 @@ const { } = DEFAULT_FORM_DATA; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, sections.echartsTimeSeriesQueryWithXAxisSort, sections.advancedAnalyticsControls, sections.annotationsAndLayersControls, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/index.ts index 355b1fd2d..de6a1d38a 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import { EchartsTimeseriesChartProps, EchartsTimeseriesFormData, @@ -60,13 +55,9 @@ export default class EchartsTimeseriesSmoothLineChartPlugin extends EchartsChart ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Smooth-line is a variation of the line chart. Without angles and hard edges, Smooth-line sometimes looks smarter and more professional.', - ) - : t( - 'Time-series Smooth-line is a variation of the line chart. Without angles and hard edges, Smooth-line sometimes looks smarter and more professional.', - ), + description: t( + 'Smooth-line is a variation of the line chart. Without angles and hard edges, Smooth-line sometimes looks smarter and more professional.', + ), exampleGallery: [{ url: example1 }], supportedAnnotationTypes: [ AnnotationType.Event, @@ -74,9 +65,7 @@ export default class EchartsTimeseriesSmoothLineChartPlugin extends EchartsChart AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes - ? t('Smooth Line') - : t('Time-series Smooth Line'), + name: t('Smooth Line'), tags: [ t('ECharts'), t('Predictive'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx index 36da82957..05870f6a6 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx @@ -55,7 +55,6 @@ const { } = DEFAULT_FORM_DATA; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, sections.echartsTimeSeriesQueryWithXAxisSort, sections.advancedAnalyticsControls, sections.annotationsAndLayersControls, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/index.ts index e84f4c1a9..91deb322b 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import { EchartsTimeseriesChartProps, EchartsTimeseriesFormData, @@ -51,13 +46,9 @@ export default class EchartsTimeseriesStepChartPlugin extends EchartsChartPlugin ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Stepped-line graph (also called step chart) is a variation of line chart but with the line forming a series of steps between data points. A step chart can be useful when you want to show the changes that occur at irregular intervals.', - ) - : t( - 'Time-series Stepped-line graph (also called step chart) is a variation of line chart but with the line forming a series of steps between data points. A step chart can be useful when you want to show the changes that occur at irregular intervals.', - ), + description: t( + 'Stepped-line graph (also called step chart) is a variation of line chart but with the line forming a series of steps between data points. A step chart can be useful when you want to show the changes that occur at irregular intervals.', + ), exampleGallery: [{ url: example1 }, { url: example2 }], supportedAnnotationTypes: [ AnnotationType.Event, @@ -65,9 +56,7 @@ export default class EchartsTimeseriesStepChartPlugin extends EchartsChartPlugin AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes - ? t('Stepped Line') - : t('Time-series Stepped Line'), + name: t('Stepped Line'), tags: [ t('ECharts'), t('Predictive'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts index 956c425c3..dace33a10 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts @@ -16,12 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - AnnotationType, - Behavior, - hasGenericChartAxes, - t, -} from '@superset-ui/core'; +import { AnnotationType, Behavior, t } from '@superset-ui/core'; import buildQuery from './buildQuery'; import controlPanel from './Regular/Line/controlPanel'; import transformProps from './transformProps'; @@ -50,13 +45,9 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin< ], category: t('Evolution'), credits: ['https://echarts.apache.org'], - description: hasGenericChartAxes - ? t( - 'Swiss army knife for visualizing data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', - ) - : t( - 'Swiss army knife for visualizing time series data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', - ), + description: t( + 'Swiss army knife for visualizing data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', + ), exampleGallery: [{ url: example }], supportedAnnotationTypes: [ AnnotationType.Event, @@ -64,7 +55,7 @@ export default class EchartsTimeseriesChartPlugin extends EchartsChartPlugin< AnnotationType.Interval, AnnotationType.Timeseries, ], - name: hasGenericChartAxes ? t('Generic Chart') : t('Time-series Chart'), + name: t('Generic Chart'), tags: [ t('Advanced-Analytics'), t('Aesthetic'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx index 4e5b5cd98..e3c5ed575 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Tree/controlPanel.tsx @@ -22,7 +22,6 @@ import { ControlPanelConfig, ControlSubSectionHeader, getStandardizedControls, - sections, sharedControls, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './constants'; @@ -39,7 +38,6 @@ const optionalEntity = { const controlPanel: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx index e17100001..282cbe565 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx @@ -25,7 +25,6 @@ import { D3_NUMBER_FORMAT_DESCRIPTION_VALUES_TEXT, D3_FORMAT_OPTIONS, D3_TIME_FORMAT_OPTIONS, - sections, getStandardizedControls, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './types'; @@ -35,7 +34,6 @@ const { labelType, numberFormat, showLabels, showUpperLabels, dateFormat } = const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/controlPanel.tsx index d07e5175e..7a71dd4fc 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Waterfall/controlPanel.tsx @@ -17,27 +17,25 @@ * under the License. */ import React from 'react'; -import { hasGenericChartAxes, t } from '@superset-ui/core'; +import { t } from '@superset-ui/core'; import { ControlPanelConfig, ControlSubSectionHeader, D3_TIME_FORMAT_DOCS, DEFAULT_TIME_FORMAT, formatSelectOptions, - sections, sharedControls, } from '@superset-ui/chart-controls'; import { showValueControl } from '../controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, { label: t('Query'), expanded: true, controlSetRows: [ - [hasGenericChartAxes ? 'x_axis' : null], - [hasGenericChartAxes ? 'time_grain_sqla' : null], + ['x_axis'], + ['time_grain_sqla'], ['groupby'], ['metric'], ['adhoc_filters'], diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts index 7aef4f582..eefdc298d 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts @@ -278,137 +278,7 @@ test('should compile AA in query B', () => { }); }); -test('should convert a queryObject with x-axis although FF is disabled', () => { - let windowSpy: any; - - beforeAll(() => { - // @ts-ignore - windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: false, - }, - })); - }); - - afterAll(() => { - windowSpy.mockRestore(); - }); - - const { queries } = buildQuery({ - ...formDataMixedChart, - x_axis: 'my_index', - }); - expect(queries[0]).toEqual({ - time_range: '1980 : 2000', - since: undefined, - until: undefined, - granularity: 'ds', - filters: [], - extras: { - having: '', - where: "(foo in ('a', 'b'))", - time_grain_sqla: 'P1W', - }, - applied_time_extras: {}, - columns: [ - { - columnType: 'BASE_AXIS', - expressionType: 'SQL', - label: 'my_index', - sqlExpression: 'my_index', - timeGrain: 'P1W', - }, - 'foo', - ], - metrics: ['sum(sales)'], - annotation_layers: [], - row_limit: 10, - row_offset: undefined, - series_columns: ['foo'], - series_limit: 5, - series_limit_metric: undefined, - url_params: {}, - custom_params: {}, - custom_form_data: {}, - time_offsets: [], - post_processing: [ - { - operation: 'pivot', - options: { - aggregates: { - 'sum(sales)': { - operator: 'mean', - }, - }, - columns: ['foo'], - drop_missing_columns: false, - index: ['my_index'], - }, - }, - { - operation: 'rename', - options: { - columns: { - 'sum(sales)': null, - }, - inplace: true, - level: 0, - }, - }, - { - operation: 'flatten', - }, - ], - orderby: [['count', false]], - }); - - // check the main props on the second query - expect(queries[1]).toEqual( - expect.objectContaining({ - columns: [ - { - columnType: 'BASE_AXIS', - expressionType: 'SQL', - label: 'my_index', - sqlExpression: 'my_index', - timeGrain: 'P1W', - }, - ], - granularity: 'ds', - series_columns: [], - metrics: ['count'], - post_processing: [ - { - operation: 'pivot', - options: { - aggregates: { - count: { - operator: 'mean', - }, - }, - columns: [], - drop_missing_columns: false, - index: ['my_index'], - }, - }, - { - operation: 'flatten', - }, - ], - }), - ); -}); - -test("shouldn't convert a queryObject with axis although FF is enabled", () => { - const windowSpy = jest - .spyOn(window, 'window', 'get') - // @ts-ignore - .mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: true, - }, - })); - +test("shouldn't convert a queryObject with axis", () => { const { queries } = buildQuery(formDataMixedChart); expect(queries[0]).toEqual( expect.objectContaining({ @@ -478,20 +348,9 @@ test("shouldn't convert a queryObject with axis although FF is enabled", () => { ], }), ); - - windowSpy.mockRestore(); }); -test('ensure correct pivot columns with GENERIC_CHART_AXES enabled', () => { - const windowSpy = jest - .spyOn(window, 'window', 'get') - // @ts-ignore - .mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: true, - }, - })); - +test('ensure correct pivot columns', () => { const query = buildQuery({ ...formDataMixedChartWithAA, x_axis: 'ds' }) .queries[0]; @@ -512,6 +371,4 @@ test('ensure correct pivot columns with GENERIC_CHART_AXES enabled', () => { }, }, }); - - windowSpy.mockRestore(); }); diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts index 888734293..9f5913148 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts @@ -61,111 +61,7 @@ describe('Timeseries buildQuery', () => { }); }); -describe('GENERIC_CHART_AXES is enabled', () => { - let windowSpy: any; - - beforeAll(() => { - // @ts-ignore - windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: true, - }, - })); - }); - - afterAll(() => { - windowSpy.mockRestore(); - }); - - const formData: SqlaFormData = { - datasource: '5__table', - viz_type: 'table', - granularity_sqla: 'time_column', - time_grain_sqla: 'P1Y', - time_range: '1 year ago : 2013', - groupby: ['col1'], - metrics: ['count(*)'], - }; - - it("shouldn't convert queryObject", () => { - const { queries } = buildQuery(formData); - expect(queries[0]).toEqual( - expect.objectContaining({ - granularity: 'time_column', - time_range: '1 year ago : 2013', - extras: { time_grain_sqla: 'P1Y', having: '', where: '' }, - columns: ['col1'], - series_columns: ['col1'], - metrics: ['count(*)'], - is_timeseries: true, - post_processing: [ - { - operation: 'pivot', - options: { - aggregates: { 'count(*)': { operator: 'mean' } }, - columns: ['col1'], - drop_missing_columns: true, - index: ['__timestamp'], - }, - }, - { operation: 'flatten' }, - ], - }), - ); - }); - - it('should convert queryObject', () => { - const { queries } = buildQuery({ ...formData, x_axis: 'time_column' }); - expect(queries[0]).toEqual( - expect.objectContaining({ - granularity: 'time_column', - time_range: '1 year ago : 2013', - extras: { having: '', where: '', time_grain_sqla: 'P1Y' }, - columns: [ - { - columnType: 'BASE_AXIS', - expressionType: 'SQL', - label: 'time_column', - sqlExpression: 'time_column', - timeGrain: 'P1Y', - }, - 'col1', - ], - series_columns: ['col1'], - metrics: ['count(*)'], - post_processing: [ - { - operation: 'pivot', - options: { - aggregates: { 'count(*)': { operator: 'mean' } }, - columns: ['col1'], - drop_missing_columns: true, - index: ['time_column'], - }, - }, - { operation: 'flatten' }, - ], - }), - ); - }); -}); - -describe('GENERIC_CHART_AXES is disabled', () => { - let windowSpy: any; - - beforeAll(() => { - // @ts-ignore - windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({ - featureFlags: { - GENERIC_CHART_AXES: false, - }, - })); - }); - - afterAll(() => { - windowSpy.mockRestore(); - }); - +describe('queryObject conversion', () => { const formData: SqlaFormData = { datasource: '5__table', viz_type: 'table', diff --git a/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controlPanel.tsx index 03904e54c..6314525a9 100644 --- a/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controlPanel.tsx @@ -19,7 +19,6 @@ import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; import { t } from '@superset-ui/core'; import { allColumnsControlSetItem } from './controls/columns'; @@ -48,7 +47,6 @@ import { styleControlSetItem } from './controls/style'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/buildQuery.ts b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/buildQuery.ts index 4cd314e06..dd8707997 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/buildQuery.ts +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/buildQuery.ts @@ -20,7 +20,6 @@ import { AdhocColumn, buildQueryContext, ensureIsArray, - hasGenericChartAxes, isPhysicalColumn, QueryFormColumn, QueryFormOrderBy, @@ -42,10 +41,6 @@ export default function buildQuery(formData: PivotTableQueryFormData) { if ( isPhysicalColumn(col) && time_grain_sqla && - hasGenericChartAxes && - /* Charts created before `GENERIC_CHART_AXES` is enabled have a different - * form data, with `granularity_sqla` set instead. - */ (formData?.temporal_columns_lookup?.[col] || formData.granularity_sqla === col) ) { diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx index 64a2c0017..7351d6d9e 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/controlPanel.tsx @@ -19,7 +19,6 @@ import React from 'react'; import { ensureIsArray, - hasGenericChartAxes, isAdhocColumn, isPhysicalColumn, QueryFormMetric, @@ -30,7 +29,6 @@ import { import { ControlPanelConfig, D3_TIME_FORMAT_OPTIONS, - sections, sharedControls, Dataset, getStandardizedControls, @@ -39,7 +37,6 @@ import { MetricsLayoutEnum } from '../types'; const config: ControlPanelConfig = { controlPanelSections: [ - { ...sections.genericTime, expanded: false }, { label: t('Query'), expanded: true, @@ -65,37 +62,35 @@ const config: ControlPanelConfig = { }, ], [ - hasGenericChartAxes - ? { - name: 'time_grain_sqla', - config: { - ...sharedControls.time_grain_sqla, - visibility: ({ controls }) => { - const dttmLookup = Object.fromEntries( - ensureIsArray(controls?.groupbyColumns?.options).map( - option => [option.column_name, option.is_dttm], - ), - ); + { + name: 'time_grain_sqla', + config: { + ...sharedControls.time_grain_sqla, + visibility: ({ controls }) => { + const dttmLookup = Object.fromEntries( + ensureIsArray(controls?.groupbyColumns?.options).map( + option => [option.column_name, option.is_dttm], + ), + ); - return [ - ...ensureIsArray(controls?.groupbyColumns.value), - ...ensureIsArray(controls?.groupbyRows.value), - ] - .map(selection => { - if (isAdhocColumn(selection)) { - return true; - } - if (isPhysicalColumn(selection)) { - return !!dttmLookup[selection]; - } - return false; - }) - .some(Boolean); - }, - }, - } - : null, - hasGenericChartAxes ? 'temporal_columns_lookup' : null, + return [ + ...ensureIsArray(controls?.groupbyColumns.value), + ...ensureIsArray(controls?.groupbyRows.value), + ] + .map(selection => { + if (isAdhocColumn(selection)) { + return true; + } + if (isPhysicalColumn(selection)) { + return !!dttmLookup[selection]; + } + return false; + }) + .some(Boolean); + }, + }, + }, + 'temporal_columns_lookup', ], [ { diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/buildQuery.test.ts index bff468232..3bf887c0b 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/buildQuery.test.ts +++ b/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/buildQuery.test.ts @@ -18,7 +18,6 @@ */ import { TimeGranularity } from '@superset-ui/core'; -import * as supersetCoreModule from '@superset-ui/core'; import buildQuery from '../../src/plugin/buildQuery'; import { PivotTableQueryFormData } from '../../src/types'; @@ -60,13 +59,21 @@ const formData: PivotTableQueryFormData = { test('should build groupby with series in form data', () => { const queryContext = buildQuery(formData); const [query] = queryContext.queries; - expect(query.columns).toEqual(['col1', 'col2', 'row1', 'row2']); + expect(query.columns).toEqual([ + { + columnType: 'BASE_AXIS', + expressionType: 'SQL', + label: 'col1', + sqlExpression: 'col1', + timeGrain: 'P1M', + }, + 'col2', + 'row1', + 'row2', + ]); }); -test('should work with old charts after GENERIC_CHART_AXES is enabled', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); +test('should work with old charts', () => { const modifiedFormData = { ...formData, time_grain_sqla: TimeGranularity.MONTH, @@ -89,9 +96,6 @@ test('should work with old charts after GENERIC_CHART_AXES is enabled', () => { }); test('should prefer extra_form_data.time_grain_sqla over formData.time_grain_sqla', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const modifiedFormData = { ...formData, extra_form_data: { time_grain_sqla: TimeGranularity.QUARTER }, @@ -108,9 +112,6 @@ test('should prefer extra_form_data.time_grain_sqla over formData.time_grain_sql }); test('should fallback to formData.time_grain_sqla if extra_form_data.time_grain_sqla is not set', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const queryContext = buildQuery(formData); const [query] = queryContext.queries; expect(query.columns?.[0]).toEqual({ @@ -123,9 +124,6 @@ test('should fallback to formData.time_grain_sqla if extra_form_data.time_grain_ }); test('should not omit extras.time_grain_sqla from queryContext so dashboards apply them', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const modifiedFormData = { ...formData, extra_form_data: { time_grain_sqla: TimeGranularity.QUARTER }, diff --git a/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts b/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts index 13bf2e9c2..b8102a0ce 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts +++ b/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts @@ -21,7 +21,6 @@ import { buildQueryContext, ensureIsArray, getMetricLabel, - hasGenericChartAxes, isPhysicalColumn, QueryMode, QueryObject, @@ -108,7 +107,6 @@ const buildQuery: BuildQuery = ( if ( isPhysicalColumn(col) && time_grain_sqla && - hasGenericChartAxes && formData?.temporal_columns_lookup?.[col] ) { return { diff --git a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx index afde89378..bb608e1c0 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx @@ -22,7 +22,6 @@ import { ChartDataResponseResult, ensureIsArray, GenericDataType, - hasGenericChartAxes, isAdhocColumn, isPhysicalColumn, QueryFormColumn, @@ -38,7 +37,6 @@ import { ControlStateMapping, D3_TIME_FORMAT_OPTIONS, QueryModeLabel, - sections, sharedControls, ControlPanelState, ControlState, @@ -147,7 +145,6 @@ const percentMetricsControl: typeof sharedControls.metrics = { const config: ControlPanelConfig = { controlPanelSections: [ - sections.genericTime, { label: t('Query'), expanded: true, @@ -189,35 +186,33 @@ const config: ControlPanelConfig = { }, ], [ - hasGenericChartAxes - ? { - name: 'time_grain_sqla', - config: { - ...sharedControls.time_grain_sqla, - visibility: ({ controls }) => { - const dttmLookup = Object.fromEntries( - ensureIsArray(controls?.groupby?.options).map(option => [ - option.column_name, - option.is_dttm, - ]), - ); + { + name: 'time_grain_sqla', + config: { + ...sharedControls.time_grain_sqla, + visibility: ({ controls }) => { + const dttmLookup = Object.fromEntries( + ensureIsArray(controls?.groupby?.options).map(option => [ + option.column_name, + option.is_dttm, + ]), + ); - return ensureIsArray(controls?.groupby.value) - .map(selection => { - if (isAdhocColumn(selection)) { - return true; - } - if (isPhysicalColumn(selection)) { - return !!dttmLookup[selection]; - } - return false; - }) - .some(Boolean); - }, - }, - } - : null, - hasGenericChartAxes ? 'temporal_columns_lookup' : null, + return ensureIsArray(controls?.groupby.value) + .map(selection => { + if (isAdhocColumn(selection)) { + return true; + } + if (isPhysicalColumn(selection)) { + return !!dttmLookup[selection]; + } + return false; + }) + .some(Boolean); + }, + }, + }, + 'temporal_columns_lookup', ], [ { @@ -324,23 +319,6 @@ const config: ControlPanelConfig = { }, }, ], - !hasGenericChartAxes - ? [ - { - name: 'include_time', - config: { - type: 'CheckboxControl', - label: t('Include time'), - description: t( - 'Whether to include the time granularity as defined in the time section', - ), - default: false, - visibility: isAggMode, - resetOnHide: false, - }, - }, - ] - : [null], [ { name: 'order_desc', diff --git a/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts index 164f31aa0..e196eae10 100644 --- a/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts +++ b/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts @@ -17,7 +17,6 @@ * under the License. */ import { QueryMode, TimeGranularity } from '@superset-ui/core'; -import * as supersetCoreModule from '@superset-ui/core'; import buildQuery from '../src/buildQuery'; import { TableChartFormData } from '../src/types'; @@ -83,9 +82,6 @@ describe('plugin-chart-table', () => { expect(query.post_processing).toEqual([]); }); it('should prefer extra_form_data.time_grain_sqla over formData.time_grain_sqla', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const query = buildQuery({ ...basicFormData, groupby: ['col1'], @@ -103,9 +99,6 @@ describe('plugin-chart-table', () => { }); }); it('should fallback to formData.time_grain_sqla if extra_form_data.time_grain_sqla is not set', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const query = buildQuery({ ...basicFormData, time_grain_sqla: TimeGranularity.MONTH, diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts b/superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts index f40a9c19a..3ba153d24 100644 --- a/superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts +++ b/superset-frontend/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts @@ -20,12 +20,10 @@ import { t, validateNonEmpty } from '@superset-ui/core'; import { ControlPanelConfig, getStandardizedControls, - sections, } from '@superset-ui/chart-controls'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/src/explore/actions/hydrateExplore.ts b/superset-frontend/src/explore/actions/hydrateExplore.ts index bced548b8..ded9d0454 100644 --- a/superset-frontend/src/explore/actions/hydrateExplore.ts +++ b/superset-frontend/src/explore/actions/hydrateExplore.ts @@ -31,7 +31,6 @@ import { getCategoricalSchemeRegistry, getColumnLabel, getSequentialSchemeRegistry, - hasGenericChartAxes, NO_TIME_RANGE, QueryFormColumn, } from '@superset-ui/core'; @@ -77,7 +76,6 @@ export const hydrateExplore = common?.conf?.DEFAULT_TIME_FILTER || NO_TIME_RANGE; } if ( - hasGenericChartAxes && initialFormData.include_time && initialFormData.granularity_sqla && !initialFormData.groupby?.some( diff --git a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx index 04f10511e..d4b1caccc 100644 --- a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx +++ b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx @@ -190,9 +190,7 @@ const ControlPanelsTabs = styled(Tabs)` `; const isTimeSection = (section: ControlPanelSectionConfig): boolean => - !!section.label && - (sections.legacyRegularTime.label === section.label || - sections.legacyTimeseriesTime.label === section.label); + !!section.label && sections.legacyTimeseriesTime.label === section.label; const hasTimeColumn = (datasource: Dataset): boolean => datasource?.columns?.some(c => c.is_dttm); diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx index 4898ba8fd..a5ee71f8c 100644 --- a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx +++ b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx @@ -401,7 +401,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) { ref={labelRef} /> - {/* the zIndex value is from trying so that the Modal doesn't overlay the AdhocFilter when GENERIC_CHART_AXES is enabled */} + {/* the zIndex value is from trying so that the Modal doesn't overlay the AdhocFilter */} { config.operatorId = Operators.IN; } if ( - hasGenericChartAxes && isColumnMeta(droppedItem) && isTemporalColumn(droppedItem?.column_name, props.datasource) ) { diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx index 8c21bf75a..c58d2b2bd 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx @@ -22,7 +22,6 @@ import { Select } from 'src/components'; import { isFeatureEnabled, FeatureFlag, - hasGenericChartAxes, isDefined, styled, SupersetClient, @@ -177,7 +176,7 @@ export const useSimpleTabFilterProps = (props: Props) => { comparator = undefined; } - if (hasGenericChartAxes && isTemporalColumn(id, props.datasource)) { + if (isTemporalColumn(id, props.datasource)) { subject = id; operator = Operators.TEMPORAL_RANGE; operatorId = Operators.TEMPORAL_RANGE; diff --git a/superset-frontend/src/explore/components/controls/FilterControl/utils/useDatePickerInAdhocFilter.tsx b/superset-frontend/src/explore/components/controls/FilterControl/utils/useDatePickerInAdhocFilter.tsx index 14e654481..5f8cc4595 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/utils/useDatePickerInAdhocFilter.tsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/utils/useDatePickerInAdhocFilter.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { hasGenericChartAxes, t } from '@superset-ui/core'; +import { t } from '@superset-ui/core'; import { Dataset, isTemporalColumn } from '@superset-ui/chart-controls'; import DateFilterControl from 'src/explore/components/controls/DateFilterControl/DateFilterLabel'; import ControlHeader from 'src/explore/components/ControlHeader'; @@ -38,7 +38,7 @@ export const useDatePickerInAdhocFilter = ({ }: DatePickerInFilterProps): React.ReactElement | undefined => { const onTimeRangeChange = (val: string) => onChange(columnName, val); - return hasGenericChartAxes && isTemporalColumn(columnName, datasource) ? ( + return isTemporalColumn(columnName, datasource) ? ( <> { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: false, - }); - const { result } = renderHook(() => - useDatePickerInAdhocFilter({ - columnName: 'ds', - datasource: TestDataset, - onChange: jest.fn(), - }), - ); - expect(result.current).toBeUndefined(); -}); - test('should return undefined if column is not temporal', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const { result } = renderHook(() => useDatePickerInAdhocFilter({ columnName: 'gender', @@ -50,9 +32,6 @@ test('should return undefined if column is not temporal', () => { }); test('should return JSX', () => { - Object.defineProperty(supersetCoreModule, 'hasGenericChartAxes', { - value: true, - }); const { result } = renderHook(() => useDatePickerInAdhocFilter({ columnName: 'ds', diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx index d228e2e17..63d9fe2cf 100644 --- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx +++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx @@ -128,9 +128,7 @@ describe('VizTypeControl', () => { expect(screen.queryByLabelText('check-square')).not.toBeInTheDocument(); expect( - within(screen.getByTestId('fast-viz-switcher')).getByText( - 'Time-series Line Chart', - ), + within(screen.getByTestId('fast-viz-switcher')).getByText('Line Chart'), ).toBeInTheDocument(); expect( within(screen.getByTestId('fast-viz-switcher')).getByText('Table'), @@ -142,14 +140,10 @@ describe('VizTypeControl', () => { within(screen.getByTestId('fast-viz-switcher')).getByText('Pie Chart'), ).toBeInTheDocument(); expect( - within(screen.getByTestId('fast-viz-switcher')).getByText( - 'Time-series Bar Chart', - ), + within(screen.getByTestId('fast-viz-switcher')).getByText('Bar Chart'), ).toBeInTheDocument(); expect( - within(screen.getByTestId('fast-viz-switcher')).getByText( - 'Time-series Area Chart', - ), + within(screen.getByTestId('fast-viz-switcher')).getByText('Area Chart'), ).toBeInTheDocument(); }); @@ -163,9 +157,7 @@ describe('VizTypeControl', () => { expect(screen.getByLabelText('monitor')).toBeVisible(); expect( - within(screen.getByTestId('fast-viz-switcher')).getByText( - 'Time-series Line Chart', - ), + within(screen.getByTestId('fast-viz-switcher')).getByText('Line Chart'), ).toBeVisible(); }); @@ -192,9 +184,7 @@ describe('VizTypeControl', () => { await waitForRenderWrapper(props, state); expect(screen.getByLabelText('check-square')).toBeVisible(); expect( - within(screen.getByTestId('fast-viz-switcher')).getByText( - 'Time-series Line Chart', - ), + within(screen.getByTestId('fast-viz-switcher')).getByText('Line Chart'), ).toBeVisible(); }); @@ -206,9 +196,7 @@ describe('VizTypeControl', () => { }; await waitForRenderWrapper(props); userEvent.click( - within(screen.getByTestId('fast-viz-switcher')).getByText( - 'Time-series Line Chart', - ), + within(screen.getByTestId('fast-viz-switcher')).getByText('Line Chart'), ); expect(props.onChange).not.toHaveBeenCalled(); userEvent.click( @@ -235,9 +223,7 @@ describe('VizTypeControl', () => { userEvent.click(screen.getByRole('button', { name: 'ballot All charts' })); - expect( - await within(visualizations).findByText('Time-series Line Chart'), - ).toBeVisible(); + expect(await within(visualizations).findByText('Line Chart')).toBeVisible(); // search userEvent.type( @@ -247,17 +233,6 @@ describe('VizTypeControl', () => { expect( await within(visualizations).findByText('Time-series Table'), ).toBeVisible(); - expect(within(visualizations).getByText('Time-series Chart')).toBeVisible(); - expect(within(visualizations).getByText('Mixed Time-Series')).toBeVisible(); - expect( - within(visualizations).getByText('Time-series Area Chart'), - ).toBeVisible(); - expect( - within(visualizations).getByText('Time-series Line Chart'), - ).toBeVisible(); - expect( - within(visualizations).getByText('Time-series Bar Chart'), - ).toBeVisible(); expect(within(visualizations).queryByText('Table')).not.toBeInTheDocument(); expect( within(visualizations).queryByText('Big Number'), @@ -271,12 +246,10 @@ describe('VizTypeControl', () => { await waitForRenderWrapper(); userEvent.click(screen.getByRole('button', { name: 'ballot All charts' })); const visualizations = screen.getByTestId(getTestId('viz-row')); - userEvent.click(within(visualizations).getByText('Time-series Bar Chart')); + userEvent.click(within(visualizations).getByText('Bar Chart')); expect(defaultProps.onChange).not.toBeCalled(); - userEvent.dblClick( - within(visualizations).getByText('Time-series Line Chart'), - ); + userEvent.dblClick(within(visualizations).getByText('Line Chart')); expect(defaultProps.onChange).toHaveBeenCalledWith( 'echarts_timeseries_line', diff --git a/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts b/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts index 4f8de967a..498c2161d 100644 --- a/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts +++ b/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts @@ -416,9 +416,8 @@ describe('should transform form_data between table and bigNumberTotal', () => { // change control values on bigNumber bntFormData.metric = 'sum(sales)'; - bntFormData.time_range = '2021 : 2022'; + bntControlsState.metric.value = 'sum(sales)'; - bntControlsState.time_range.value = '2021 : 2022'; // bigNumberTotal -> table const sfd2 = new StandardizedFormData(bntFormData); @@ -439,7 +438,6 @@ describe('should transform form_data between table and bigNumberTotal', () => { adhocMetricSQL, ]); expect(tblFormData.groupby).toEqual(['name', 'gender', adhocColumn]); - expect(tblFormData.time_range).toBe('2021 : 2022'); }); }); diff --git a/superset-frontend/src/filters/components/Range/controlPanel.ts b/superset-frontend/src/filters/components/Range/controlPanel.ts index 2a38f5733..12d7331b0 100644 --- a/superset-frontend/src/filters/components/Range/controlPanel.ts +++ b/superset-frontend/src/filters/components/Range/controlPanel.ts @@ -19,14 +19,12 @@ import { t } from '@superset-ui/core'; import { ControlPanelConfig, - sections, sharedControls, } from '@superset-ui/chart-controls'; import { SingleValueType } from './SingleValueType'; const config: ControlPanelConfig = { controlPanelSections: [ - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset-frontend/src/filters/components/Select/controlPanel.ts b/superset-frontend/src/filters/components/Select/controlPanel.ts index 12bc36a7a..7bdc2c592 100644 --- a/superset-frontend/src/filters/components/Select/controlPanel.ts +++ b/superset-frontend/src/filters/components/Select/controlPanel.ts @@ -19,7 +19,6 @@ import { t, validateNonEmpty } from '@superset-ui/core'; import { ControlPanelConfig, - sections, sharedControls, } from '@superset-ui/chart-controls'; import { DEFAULT_FORM_DATA } from './types'; @@ -35,8 +34,6 @@ const { const config: ControlPanelConfig = { controlPanelSections: [ - // @ts-ignore - sections.legacyRegularTime, { label: t('Query'), expanded: true, diff --git a/superset/config.py b/superset/config.py index 00e76a51f..8b57244d2 100644 --- a/superset/config.py +++ b/superset/config.py @@ -447,7 +447,6 @@ DEFAULT_FEATURE_FLAGS: dict[str, bool] = { # Allow users to export full CSV of table viz type. # This could cause the server to run out of memory or compute. "ALLOW_FULL_CSV_EXPORT": False, - "GENERIC_CHART_AXES": True, # deprecated "ALLOW_ADHOC_SUBQUERY": False, "USE_ANALAGOUS_COLORS": False, # Apply RLS rules to SQL Lab queries. This requires parsing and manipulating the diff --git a/superset/examples/supported_charts_dashboard.py b/superset/examples/supported_charts_dashboard.py index 926750ffb..6ca33a87c 100644 --- a/superset/examples/supported_charts_dashboard.py +++ b/superset/examples/supported_charts_dashboard.py @@ -103,7 +103,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Line Chart", + slice_name="Line Chart", viz_type="echarts_timeseries_line", params=get_slice_json( defaults, @@ -114,7 +114,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Area Chart", + slice_name="Area Chart", viz_type="echarts_area", params=get_slice_json( defaults, @@ -125,7 +125,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Bar Chart V2", + slice_name="Bar Chart V2", viz_type="echarts_timeseries_bar", params=get_slice_json( defaults, @@ -136,7 +136,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Scatter Chart", + slice_name="Scatter Chart", viz_type="echarts_timeseries_scatter", params=get_slice_json( defaults, @@ -238,7 +238,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Percent Change Chart", + slice_name="Percent Change Chart", viz_type="compare", params=get_slice_json( defaults, @@ -249,7 +249,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Generic Chart", + slice_name="Generic Chart", viz_type="echarts_timeseries", params=get_slice_json( defaults, @@ -260,7 +260,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Smooth Line Chart", + slice_name="Smooth Line Chart", viz_type="echarts_timeseries_smooth", params=get_slice_json( defaults, @@ -271,7 +271,7 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: ), Slice( **slice_kwargs, - slice_name="Time-Series Step Line Chart", + slice_name="Step Line Chart", viz_type="echarts_timeseries_step", params=get_slice_json( defaults, @@ -317,10 +317,10 @@ def create_slices(tbl: SqlaTable) -> list[Slice]: Slice( **slice_kwargs, slice_name="Line Chart", - viz_type="line", + viz_type="echarts_timeseries_line", params=get_slice_json( defaults, - viz_type="line", + viz_type="echarts_timeseries_line", metrics=["sum__num"], groupby=["gender"], ), @@ -545,7 +545,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 5, "height": 50, - "sliceName": "Time-Series Line Chart", + "sliceName": "Line Chart", "width": 4 }, "type": "CHART" @@ -562,7 +562,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 6, "height": 50, - "sliceName": "Time-Series Bar Chart V2", + "sliceName": "Bar Chart V2", "width": 4 }, "type": "CHART" @@ -579,7 +579,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 7, "height": 50, - "sliceName": "Time-Series Area Chart", + "sliceName": "Area Chart", "width": 4 }, "type": "CHART" @@ -596,7 +596,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 8, "height": 50, - "sliceName": "Time-Series Scatter Chart", + "sliceName": "Scatter Chart", "width": 4 }, "type": "CHART" @@ -732,7 +732,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 16, "height": 50, - "sliceName": "Time-Series Percent Change Chart", + "sliceName": "Percent Change Chart", "width": 4 }, "type": "CHART" @@ -749,7 +749,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 17, "height": 50, - "sliceName": "Time-Series Generic Chart", + "sliceName": "Generic Chart", "width": 4 }, "type": "CHART" @@ -766,7 +766,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 18, "height": 50, - "sliceName": "Time-Series Smooth Line Chart", + "sliceName": "Smooth Line Chart", "width": 4 }, "type": "CHART" @@ -783,7 +783,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 19, "height": 50, - "sliceName": "Time-Series Step Line Chart", + "sliceName": "Step Line Chart", "width": 4 }, "type": "CHART" diff --git a/superset/legacy.py b/superset/legacy.py index 52b63a013..1a4cd10d7 100644 --- a/superset/legacy.py +++ b/superset/legacy.py @@ -17,8 +17,6 @@ """Code related with dealing with legacy / change management""" from typing import Any -from superset import is_feature_enabled - def update_time_range(form_data: dict[str, Any]) -> None: """ @@ -33,11 +31,10 @@ def update_time_range(form_data: dict[str, Any]) -> None: until = form_data.pop("until", "") or "" form_data["time_range"] = f"{since} : {until}" - if is_feature_enabled("GENERIC_CHART_AXES"): - if temporal_column := form_data.get("granularity_sqla"): - if any( - adhoc_filter.get("subject") == temporal_column - and adhoc_filter.get("comparator") == "No filter" - for adhoc_filter in form_data.get("adhoc_filters", []) - ): - form_data.setdefault("time_range", "No filter") + if temporal_column := form_data.get("granularity_sqla"): + if any( + adhoc_filter.get("subject") == temporal_column + and adhoc_filter.get("comparator") == "No filter" + for adhoc_filter in form_data.get("adhoc_filters", []) + ): + form_data.setdefault("time_range", "No filter") diff --git a/superset/migrations/shared/migrate_viz/base.py b/superset/migrations/shared/migrate_viz/base.py index f9e1b9d3c..51699b9d0 100644 --- a/superset/migrations/shared/migrate_viz/base.py +++ b/superset/migrations/shared/migrate_viz/base.py @@ -84,8 +84,7 @@ class MigrateViz: rv_data[key] = value - if is_feature_enabled("GENERIC_CHART_AXES"): - self._migrate_temporal_filter(rv_data) + self._migrate_temporal_filter(rv_data) self.data = rv_data diff --git a/tests/unit_tests/legacy_tests.py b/tests/unit_tests/legacy_tests.py index 9a8f7fbcd..c5e7e183c 100644 --- a/tests/unit_tests/legacy_tests.py +++ b/tests/unit_tests/legacy_tests.py @@ -80,20 +80,9 @@ def test_update_time_range_since_until() -> None: assert form_data == {"time_range": "yesterday : tomorrow"} -@with_feature_flags(GENERIC_CHART_AXES=False) -def test_update_time_range_granularity_sqla_no_feature_flag() -> None: - """ - Tests for the unfiltered `granularity_sqla` when `GENERIC_CHART_AXES` is off. - """ - form_data = copy.deepcopy(original_form_data) - update_time_range(form_data) - assert form_data == original_form_data - - -@with_feature_flags(GENERIC_CHART_AXES=True) def test_update_time_range_granularity_sqla_with_feature_flag() -> None: """ - Tests for the unfiltered `granularity_sqla` when `GENERIC_CHART_AXES` is on. + Tests for the unfiltered `granularity_sqla`. """ form_data = copy.deepcopy(original_form_data) update_time_range(form_data) diff --git a/tests/unit_tests/migrations/viz/time_related_fields_test.py b/tests/unit_tests/migrations/viz/time_related_fields_test.py index 06fdf611c..4494aff1c 100644 --- a/tests/unit_tests/migrations/viz/time_related_fields_test.py +++ b/tests/unit_tests/migrations/viz/time_related_fields_test.py @@ -17,7 +17,6 @@ from typing import Any from superset.migrations.shared.migrate_viz import MigratePivotTable -from tests.unit_tests.conftest import with_feature_flags from tests.unit_tests.migrations.viz.utils import migrate_and_assert SOURCE_FORM_DATA: dict[str, Any] = { @@ -35,15 +34,7 @@ TARGET_FORM_DATA: dict[str, Any] = { } -@with_feature_flags(GENERIC_CHART_AXES=False) -def test_migration_without_generic_chart_axes() -> None: - source = SOURCE_FORM_DATA.copy() - target = TARGET_FORM_DATA.copy() - upgrade_downgrade(source, target) - - -@with_feature_flags(GENERIC_CHART_AXES=True) -def test_migration_with_generic_chart_axes() -> None: +def test_migration() -> None: source = SOURCE_FORM_DATA.copy() target = TARGET_FORM_DATA.copy() target["adhoc_filters"] = [ @@ -60,7 +51,6 @@ def test_migration_with_generic_chart_axes() -> None: upgrade_downgrade(source, target) -@with_feature_flags(GENERIC_CHART_AXES=True) def test_custom_sql_time_column() -> None: source = SOURCE_FORM_DATA.copy() source["granularity_sqla"] = {