mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
refactor: Removes the deprecated GENERIC_CHART_AXES feature flag (#26372)
This commit is contained in:
committed by
GitHub
parent
d8f7e2ce5e
commit
8a2f7d378a
@@ -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 {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user