refactor: Removes the deprecated GENERIC_CHART_AXES feature flag (#26372)

This commit is contained in:
Michael S. Molina 2024-01-31 09:45:57 -05:00 committed by GitHub
parent d8f7e2ce5e
commit 8a2f7d378a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
99 changed files with 363 additions and 1115 deletions

View File

@ -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

View File

@ -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

View File

@ -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],
]);

View File

@ -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');
});

View File

@ -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' },

View File

@ -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,

View File

@ -21,7 +21,6 @@ import {
ensureIsArray,
getMetricLabel,
getXAxisLabel,
hasGenericChartAxes,
isDefined,
PostProcessingSort,
} from '@superset-ui/core';
@ -40,7 +39,6 @@ export const sortOperator: PostProcessingFactory<PostProcessingSort> = (
].filter(Boolean);
if (
hasGenericChartAxes &&
isDefined(formData?.x_axis_sort) &&
isDefined(formData?.x_axis_sort_asc) &&
sortableLabels.includes(formData.x_axis_sort) &&

View File

@ -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,
],
};

View File

@ -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,

View File

@ -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),
{

View File

@ -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;
}

View File

@ -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(
{

View File

@ -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 !== ''),

View File

@ -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<QueryFormColumn> => {

View File

@ -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',

View File

@ -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();
});
});

View File

@ -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,

View File

@ -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);
});

View File

@ -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,

View File

@ -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,

View File

@ -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: [

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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'],
],

View File

@ -39,7 +39,6 @@ import {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
{
label: t('Query'),
expanded: true,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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'),

View File

@ -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'),

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -58,7 +58,6 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.genericTime,
sections.echartsTimeSeriesQueryWithXAxisSort,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,

View File

@ -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'),

View File

@ -255,7 +255,6 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] {
const config: ControlPanelConfig = {
controlPanelSections: [
sections.genericTime,
sections.echartsTimeSeriesQueryWithXAxisSort,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,

View File

@ -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'),

View File

@ -59,7 +59,6 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.genericTime,
sections.echartsTimeSeriesQueryWithXAxisSort,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,

View File

@ -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'),

View File

@ -55,7 +55,6 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.genericTime,
sections.echartsTimeSeriesQueryWithXAxisSort,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,

View File

@ -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'),

View File

@ -55,7 +55,6 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.genericTime,
sections.echartsTimeSeriesQueryWithXAxisSort,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,

View File

@ -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'),

View File

@ -55,7 +55,6 @@ const {
} = DEFAULT_FORM_DATA;
const config: ControlPanelConfig = {
controlPanelSections: [
sections.genericTime,
sections.echartsTimeSeriesQueryWithXAxisSort,
sections.advancedAnalyticsControls,
sections.annotationsAndLayersControls,

View File

@ -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'),

View File

@ -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'),

View File

@ -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,

View File

@ -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,

View File

@ -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'],

View File

@ -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();
});

View File

@ -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',

View File

@ -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,

View File

@ -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)
) {

View File

@ -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',
],
[
{

View File

@ -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 },

View File

@ -21,7 +21,6 @@ import {
buildQueryContext,
ensureIsArray,
getMetricLabel,
hasGenericChartAxes,
isPhysicalColumn,
QueryMode,
QueryObject,
@ -108,7 +107,6 @@ const buildQuery: BuildQuery<TableChartFormData> = (
if (
isPhysicalColumn(col) &&
time_grain_sqla &&
hasGenericChartAxes &&
formData?.temporal_columns_lookup?.[col]
) {
return {

View File

@ -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',

View File

@ -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,

View File

@ -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,

View File

@ -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(

View File

@ -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);

View File

@ -401,7 +401,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
ref={labelRef}
/>
</Tooltip>
{/* 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 */}
<Modal
title={title}
show={show}

View File

@ -18,7 +18,6 @@
*/
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import {
hasGenericChartAxes,
logging,
Metric,
QueryFormData,
@ -373,7 +372,6 @@ const DndFilterSelect = (props: DndFilterSelectProps) => {
config.operatorId = Operators.IN;
}
if (
hasGenericChartAxes &&
isColumnMeta(droppedItem) &&
isTemporalColumn(droppedItem?.column_name, props.datasource)
) {

View File

@ -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;

View File

@ -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) ? (
<>
<ControlHeader label={t('Time Range')} />
<DateFilterControl

View File

@ -18,27 +18,9 @@
*/
import { renderHook } from '@testing-library/react-hooks';
import { TestDataset } from '@superset-ui/chart-controls';
import * as supersetCoreModule from '@superset-ui/core';
import { useDatePickerInAdhocFilter } from './useDatePickerInAdhocFilter';
test('should return undefined if Generic Axis is disabled', () => {
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',

View File

@ -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',

View File

@ -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');
});
});

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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"

View File

@ -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")

View File

@ -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

View File

@ -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)

View File

@ -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"] = {