You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2023/01/19 16:18:28 UTC
[superset] branch feat/cross-filters updated: Remove emitFilterControl everywhere
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch feat/cross-filters
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/feat/cross-filters by this push:
new f139e76c68 Remove emitFilterControl everywhere
f139e76c68 is described below
commit f139e76c685af9028a5358d471cf67c75bacd1b4
Author: geido <di...@gmail.com>
AuthorDate: Thu Jan 19 17:18:11 2023 +0100
Remove emitFilterControl everywhere
---
.../src/sections/echartsTimeSeriesQuery.tsx | 2 --
.../ColumnConfigControl/ColumnConfigControl.tsx | 17 ---------
.../components/ColumnConfigControl/constants.tsx | 13 -------
.../src/shared-controls/customControls.tsx | 19 ----------
.../shared-controls/emitFilterControl.test.tsx | 26 --------------
.../src/BoxPlot/EchartsBoxPlot.tsx | 4 +--
.../src/BoxPlot/controlPanel.ts | 2 --
.../src/BoxPlot/transformProps.ts | 4 +--
.../plugin-chart-echarts/src/BoxPlot/types.ts | 2 --
.../src/Funnel/EchartsFunnel.tsx | 4 +--
.../src/Funnel/controlPanel.tsx | 2 --
.../src/Funnel/transformProps.ts | 4 +--
.../plugin-chart-echarts/src/Funnel/types.ts | 2 --
.../src/Gauge/EchartsGauge.tsx | 4 +--
.../src/Gauge/controlPanel.tsx | 2 --
.../src/Gauge/transformProps.ts | 15 +++++---
.../plugin-chart-echarts/src/Gauge/types.ts | 2 --
.../src/MixedTimeseries/EchartsMixedTimeseries.tsx | 6 ++--
.../src/MixedTimeseries/controlPanel.tsx | 9 -----
.../src/MixedTimeseries/transformProps.ts | 6 ++--
.../src/MixedTimeseries/types.ts | 2 --
.../src/Radar/EchartsRadar.tsx | 4 +--
.../src/Radar/controlPanel.tsx | 2 --
.../src/Radar/transformProps.ts | 4 +--
.../plugin-chart-echarts/src/Radar/types.ts | 2 --
.../src/Timeseries/EchartsTimeseries.tsx | 7 ++--
.../src/Timeseries/constants.ts | 1 -
.../src/Timeseries/transformProps.ts | 4 +--
.../plugin-chart-echarts/src/Timeseries/types.ts | 1 -
.../src/Treemap/EchartsTreemap.tsx | 4 +--
.../src/Treemap/controlPanel.tsx | 2 --
.../src/Treemap/transformProps.ts | 4 +--
.../plugin-chart-echarts/src/Treemap/types.ts | 2 --
.../test/BoxPlot/buildQuery.test.ts | 1 -
.../test/MixedTimeseries/buildQuery.test.ts | 2 --
.../src/plugin/controlPanel.tsx | 2 --
.../plugins/plugin-chart-handlebars/src/types.ts | 1 -
.../src/PivotTableChart.tsx | 10 +++---
.../src/plugin/controlPanel.tsx | 2 --
.../src/plugin/transformProps.ts | 4 +--
.../plugins/plugin-chart-pivot-table/src/types.ts | 2 +-
.../test/plugin/transformProps.test.ts | 2 --
.../plugins/plugin-chart-table/src/TableChart.tsx | 28 ++++++---------
.../plugin-chart-table/src/controlPanel.tsx | 3 --
.../plugin-chart-table/src/transformProps.ts | 4 +--
.../plugins/plugin-chart-table/src/types.ts | 3 +-
.../src/components/Chart/ChartRenderer.jsx | 3 +-
.../src/dashboard/actions/dashboardInfo.ts | 6 ++--
.../src/dashboard/actions/dashboardState.js | 7 ++--
superset-frontend/src/dashboard/actions/hydrate.js | 8 +++--
.../src/dashboard/components/SliceHeader/index.tsx | 4 +++
.../components/SliceHeaderControls/index.tsx | 8 +++--
.../dashboard/components/gridComponents/Chart.jsx | 7 ----
.../FilterBar/FilterBarSettings/index.tsx | 40 +++++++++++++++-------
.../src/dashboard/reducers/dashboardInfo.js | 10 +++---
superset-frontend/src/dashboard/types.ts | 1 +
.../controlUtils/standardizedFormData.test.ts | 1 -
57 files changed, 119 insertions(+), 224 deletions(-)
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 296f8d9da8..cd58780d89 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
@@ -20,7 +20,6 @@ import { hasGenericChartAxes, t } from '@superset-ui/core';
import { ControlPanelSectionConfig, ControlSetRow } from '../types';
import {
contributionModeControl,
- emitFilterControl,
xAxisSortControl,
xAxisSortAscControl,
} from '../shared-controls';
@@ -30,7 +29,6 @@ const controlsWithoutXAxis: ControlSetRow[] = [
['groupby'],
[contributionModeControl],
['adhoc_filters'],
- emitFilterControl,
['limit'],
['timeseries_limit_metric'],
['order_desc'],
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/ColumnConfigControl.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/ColumnConfigControl.tsx
index 55c560cb79..548dd4ae4d 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/ColumnConfigControl.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/ColumnConfigControl.tsx
@@ -40,7 +40,6 @@ export type ColumnConfigControlProps<T extends ColumnConfig> =
queryResponse?: ChartDataResponseResult;
configFormLayout?: ColumnConfigFormLayout;
appliedColumnNames?: string[];
- emitFilter: boolean;
};
/**
@@ -57,24 +56,8 @@ export default function ColumnConfigControl<T extends ColumnConfig>({
value,
onChange,
configFormLayout = DEFAULT_CONFIG_FORM_LAYOUT,
- emitFilter,
...props
}: ColumnConfigControlProps<T>) {
- if (emitFilter) {
- Object.values(configFormLayout).forEach(array_of_array => {
- if (!array_of_array.some(arr => arr.includes('emitTarget'))) {
- array_of_array.push(['emitTarget']);
- }
- });
- } else {
- Object.values(configFormLayout).forEach(array_of_array => {
- const index = array_of_array.findIndex(arr => arr.includes('emitTarget'));
- if (index > -1) {
- array_of_array.splice(index, 1);
- }
- });
- }
-
const { colnames: _colnames, coltypes: _coltypes } = queryResponse || {};
let colnames: string[] = [];
let coltypes: GenericDataType[] = [];
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx
index a749e5a7cc..b940375aa9 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx
@@ -35,7 +35,6 @@ export type SharedColumnConfigProp =
| 'colorPositiveNegative'
| 'columnWidth'
| 'fractionDigits'
- | 'emitTarget'
| 'd3NumberFormat'
| 'd3SmallNumberFormat'
| 'd3TimeFormat'
@@ -43,17 +42,6 @@ export type SharedColumnConfigProp =
| 'truncateLongCells'
| 'showCellBars';
-const emitTarget: ControlFormItemSpec<'Input'> = {
- controlType: 'Input',
- label: t('Emit Target'),
- description: t(
- 'If you wish to specify a different target column than the original column, it can be entered here',
- ),
- defaultValue: '',
- debounceDelay: 500,
- validators: undefined,
-};
-
const d3NumberFormat: ControlFormItemSpec<'Select'> = {
controlType: 'Select',
label: t('D3 format'),
@@ -156,7 +144,6 @@ const truncateLongCells: ControlFormItemSpec<'Checkbox'> = {
*/
export const SHARED_COLUMN_CONFIG_PROPS = {
d3NumberFormat,
- emitTarget,
d3SmallNumberFormat: {
...d3NumberFormat,
label: t('Small number format'),
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx
index 5ece20ac06..979912e58f 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx
@@ -20,12 +20,10 @@
import {
ContributionType,
ensureIsArray,
- FeatureFlag,
getColumnLabel,
getMetricLabel,
isDefined,
isEqualArray,
- isFeatureEnabled,
QueryFormColumn,
QueryFormMetric,
t,
@@ -33,23 +31,6 @@ import {
import { ControlPanelState, ControlState, ControlStateMapping } from '../types';
import { isTemporalColumn } from '../utils';
-export const emitFilterControl = isFeatureEnabled(
- FeatureFlag.DASHBOARD_CROSS_FILTERS,
-)
- ? [
- {
- name: 'emit_filter',
- config: {
- type: 'CheckboxControl',
- label: t('Enable dashboard cross filters'),
- default: false,
- renderTrigger: true,
- description: t('Enable dashboard cross filters'),
- },
- },
- ]
- : [];
-
export const contributionModeControl = {
name: 'contributionMode',
config: {
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/shared-controls/emitFilterControl.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/shared-controls/emitFilterControl.test.tsx
deleted file mode 100644
index 6070ccccfd..0000000000
--- a/superset-frontend/packages/superset-ui-chart-controls/test/shared-controls/emitFilterControl.test.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { emitFilterControl } from '@superset-ui/chart-controls';
-
-describe('isFeatureFlagEnabled', () => {
- it('returns empty array for unset feature flag', () => {
- expect(emitFilterControl).toHaveLength(0);
- });
-});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/EchartsBoxPlot.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/EchartsBoxPlot.tsx
index 135d31317e..4c18f7f7d6 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/EchartsBoxPlot.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/EchartsBoxPlot.tsx
@@ -30,12 +30,12 @@ export default function EchartsBoxPlot(props: BoxPlotChartTransformedProps) {
labelMap,
groupby,
selectedValues,
- formData,
refs,
+ emitCrossFilters,
} = props;
const handleChange = useCallback(
(values: string[]) => {
- if (!formData.emitFilter) {
+ if (!emitCrossFilters) {
return;
}
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 95b8e6d966..f1db7534d0 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts
@@ -28,7 +28,6 @@ import {
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
sections,
- emitFilterControl,
ControlPanelConfig,
getStandardizedControls,
ControlState,
@@ -77,7 +76,6 @@ const config: ControlPanelConfig = {
['groupby'],
['metrics'],
['adhoc_filters'],
- emitFilterControl,
['series_limit'],
['series_limit_metric'],
[
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
index 337807e229..54a1cbfd20 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
@@ -53,6 +53,7 @@ export default function transformProps(
filterState,
queriesData,
inContextMenu,
+ emitCrossFilters,
} = chartProps;
const { data = [] } = queriesData[0];
const { setDataMask = () => {}, onContextMenu } = hooks;
@@ -64,7 +65,6 @@ export default function transformProps(
numberFormat,
dateFormat,
xTicksLayout,
- emitFilter,
legendOrientation = 'top',
xAxisTitle,
yAxisTitle,
@@ -291,7 +291,7 @@ export default function transformProps(
height,
echartOptions,
setDataMask,
- emitFilter,
+ emitCrossFilters,
labelMap,
groupby,
selectedValues,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts
index dcbc9da17a..6cdc57a26d 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/types.ts
@@ -30,7 +30,6 @@ export type BoxPlotQueryFormData = QueryFormData & {
numberFormat?: string;
whiskerOptions?: BoxPlotFormDataWhiskerOptions;
xTickLayout?: BoxPlotFormXTickLayout;
- emitFilter: boolean;
} & TitleFormData;
export type BoxPlotFormDataWhiskerOptions =
@@ -48,7 +47,6 @@ export type BoxPlotFormXTickLayout =
// @ts-ignore
export const DEFAULT_FORM_DATA: BoxPlotQueryFormData = {
- emitFilter: false,
...DEFAULT_TITLE_FORM_DATA,
};
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/EchartsFunnel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/EchartsFunnel.tsx
index c492500e8e..88ccae8ecc 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/EchartsFunnel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/EchartsFunnel.tsx
@@ -30,12 +30,12 @@ export default function EchartsFunnel(props: FunnelChartTransformedProps) {
labelMap,
groupby,
selectedValues,
- formData,
+ emitCrossFilters,
refs,
} = props;
const handleChange = useCallback(
(values: string[]) => {
- if (!formData.emitFilter) {
+ if (!emitCrossFilters) {
return;
}
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 f8acdcf6be..929069b2ed 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/controlPanel.tsx
@@ -24,7 +24,6 @@ import {
sections,
sharedControls,
ControlStateMapping,
- emitFilterControl,
getStandardizedControls,
} from '@superset-ui/chart-controls';
import { DEFAULT_FORM_DATA, EchartsFunnelLabelTypeType } from './types';
@@ -45,7 +44,6 @@ const config: ControlPanelConfig = {
['groupby'],
['metric'],
['adhoc_filters'],
- emitFilterControl,
[
{
name: 'row_limit',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
index 30b5ccbfd9..282bc42381 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
@@ -92,6 +92,7 @@ export default function transformProps(
width,
theme,
inContextMenu,
+ emitCrossFilters,
} = chartProps;
const data: DataRecord[] = queriesData[0].data || [];
@@ -110,7 +111,6 @@ export default function transformProps(
numberFormat,
showLabels,
showLegend,
- emitFilter,
sliceId,
}: EchartsFunnelFormData = {
...DEFAULT_LEGEND_FORM_DATA,
@@ -238,7 +238,7 @@ export default function transformProps(
height,
echartOptions,
setDataMask,
- emitFilter,
+ emitCrossFilters,
labelMap,
groupby,
selectedValues,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
index 841722ce4b..15adbc2080 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Funnel/types.ts
@@ -40,7 +40,6 @@ export type EchartsFunnelFormData = QueryFormData &
gap: number;
sort: 'descending' | 'ascending' | 'none' | undefined;
orient: 'vertical' | 'horizontal' | undefined;
- emitFilter: boolean;
};
export enum EchartsFunnelLabelTypeType {
@@ -70,7 +69,6 @@ export const DEFAULT_FORM_DATA: EchartsFunnelFormData = {
sort: 'descending',
orient: 'vertical',
gap: 0,
- emitFilter: false,
};
export type FunnelChartTransformedProps =
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/EchartsGauge.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/EchartsGauge.tsx
index 7ffb571b79..8c4ca420d9 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/EchartsGauge.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/EchartsGauge.tsx
@@ -30,12 +30,12 @@ export default function EchartsGauge(props: GaugeChartTransformedProps) {
labelMap,
groupby,
selectedValues,
- formData: { emitFilter },
+ emitCrossFilters,
refs,
} = props;
const handleChange = useCallback(
(values: string[]) => {
- if (!emitFilter) {
+ if (!emitCrossFilters) {
return;
}
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 7ffa62fda0..1af718a989 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/controlPanel.tsx
@@ -23,7 +23,6 @@ import {
ControlPanelConfig,
D3_FORMAT_OPTIONS,
sections,
- emitFilterControl,
getStandardizedControls,
} from '@superset-ui/chart-controls';
import { DEFAULT_FORM_DATA } from './types';
@@ -46,7 +45,6 @@ const config: ControlPanelConfig = {
],
['metric'],
['adhoc_filters'],
- emitFilterControl,
[
{
name: 'row_limit',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
index d84078ad16..b2e31c3cc1 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
@@ -91,8 +91,16 @@ const calculateMax = (data: GaugeDataItemOption[]) =>
export default function transformProps(
chartProps: EchartsGaugeChartProps,
): GaugeChartTransformedProps {
- const { width, height, formData, queriesData, hooks, filterState, theme } =
- chartProps;
+ const {
+ width,
+ height,
+ formData,
+ queriesData,
+ hooks,
+ filterState,
+ theme,
+ emitCrossFilters,
+ } = chartProps;
const gaugeSeriesOptions = defaultGaugeSeriesOption(theme);
@@ -117,7 +125,6 @@ export default function transformProps(
intervals,
intervalColorIndices,
valueFormatter,
- emitFilter,
sliceId,
}: EchartsGaugeFormData = { ...DEFAULT_GAUGE_FORM_DATA, ...formData };
const refs: Refs = {};
@@ -327,7 +334,7 @@ export default function transformProps(
height,
echartOptions,
setDataMask,
- emitFilter,
+ emitCrossFilters,
labelMap: Object.fromEntries(columnsLabelMap),
groupby,
selectedValues: filterState.selectedValues || [],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/types.ts
index 9f2c08fd5f..02cda2db7f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gauge/types.ts
@@ -52,7 +52,6 @@ export type EchartsGaugeFormData = QueryFormData & {
intervals: string;
intervalColorIndices: string;
valueFormatter: string;
- emitFilter: boolean;
};
export const DEFAULT_FORM_DATA: Partial<EchartsGaugeFormData> = {
@@ -76,7 +75,6 @@ export const DEFAULT_FORM_DATA: Partial<EchartsGaugeFormData> = {
intervals: '',
intervalColorIndices: '',
valueFormatter: '{value}',
- emitFilter: false,
};
export interface EchartsGaugeChartProps
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
index 1d1cd65477..b532c7d9da 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
@@ -39,6 +39,7 @@ export default function EchartsMixedTimeseries({
groupbyB,
selectedValues,
formData,
+ emitCrossFilters,
seriesBreakdown,
onContextMenu,
xValueFormatter,
@@ -52,10 +53,7 @@ export default function EchartsMixedTimeseries({
const handleChange = useCallback(
(values: string[], seriesIndex: number) => {
- const emitFilter = isFirstQuery(seriesIndex)
- ? formData.emitFilter
- : formData.emitFilterB;
- if (!emitFilter) {
+ if (!emitCrossFilters) {
return;
}
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 6cbed6901b..c1a3007785 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
@@ -24,7 +24,6 @@ import {
ControlPanelSectionConfig,
ControlSetRow,
CustomControlItem,
- emitFilterControl,
getStandardizedControls,
sections,
sharedControls,
@@ -79,14 +78,6 @@ function createQuerySection(
config: sharedControls.adhoc_filters,
},
],
- emitFilterControl.length > 0
- ? [
- {
- ...emitFilterControl[0],
- name: `emit_filter${controlSuffix}`,
- },
- ]
- : [],
[
{
name: `limit${controlSuffix}`,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
index a39ca1d4d5..98367daf9a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -95,6 +95,7 @@ export default function transformProps(
datasource,
theme,
inContextMenu,
+ emitCrossFilters,
} = chartProps;
const { verboseMap = {} } = datasource;
const { label_map: labelMap } =
@@ -144,8 +145,6 @@ export default function transformProps(
xAxisLabelRotation,
groupby,
groupbyB,
- emitFilter,
- emitFilterB,
xAxis: xAxisOrig,
xAxisTitle,
yAxisTitle,
@@ -504,8 +503,7 @@ export default function transformProps(
height,
echartOptions,
setDataMask,
- emitFilter,
- emitFilterB,
+ emitCrossFilters,
labelMap,
labelMapB,
groupby,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
index a39e556cac..3ec9b2a4b6 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
@@ -86,7 +86,6 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & {
yAxisIndexB?: number;
groupby: QueryFormColumn[];
groupbyB: QueryFormColumn[];
- emitFilter: boolean;
} & LegendFormData &
TitleFormData;
@@ -143,7 +142,6 @@ export type EchartsMixedTimeseriesChartTransformedProps =
BaseTransformedProps<EchartsMixedTimeseriesFormData> &
ContextMenuTransformedProps &
CrossFilterTransformedProps & {
- emitFilterB: boolean;
groupbyB: QueryFormColumn[];
labelMapB: Record<string, string[]>;
seriesBreakdown: number;
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/EchartsRadar.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/EchartsRadar.tsx
index 1291b69c12..169240e8a4 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/EchartsRadar.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/EchartsRadar.tsx
@@ -30,12 +30,12 @@ export default function EchartsRadar(props: RadarChartTransformedProps) {
labelMap,
groupby,
selectedValues,
- formData,
+ emitCrossFilters,
refs,
} = props;
const handleChange = useCallback(
(values: string[]) => {
- if (!formData.emitFilter) {
+ if (!emitCrossFilters) {
return;
}
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 32659bb20f..3c320b05c4 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_TIME_FORMAT_OPTIONS,
sections,
sharedControls,
- emitFilterControl,
ControlFormItemSpec,
getStandardizedControls,
} from '@superset-ui/chart-controls';
@@ -68,7 +67,6 @@ const config: ControlPanelConfig = {
['metrics'],
['timeseries_limit_metric'],
['adhoc_filters'],
- emitFilterControl,
[
{
name: 'row_limit',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts
index 04c928036c..f185859f4e 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/transformProps.ts
@@ -80,6 +80,7 @@ export default function transformProps(
width,
theme,
inContextMenu,
+ emitCrossFilters,
} = chartProps;
const refs: Refs = {};
const { data = [] } = queriesData[0];
@@ -101,7 +102,6 @@ export default function transformProps(
isCircle,
columnConfig,
sliceId,
- emitFilter,
}: EchartsRadarFormData = {
...DEFAULT_LEGEND_FORM_DATA,
...DEFAULT_RADAR_FORM_DATA,
@@ -252,7 +252,7 @@ export default function transformProps(
width,
height,
echartOptions,
- emitFilter,
+ emitCrossFilters,
setDataMask,
labelMap: Object.fromEntries(columnsLabelMap),
groupby,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts
index 97e3c1a32a..ca7cdbd2c2 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/types.ts
@@ -50,7 +50,6 @@ export type EchartsRadarFormData = QueryFormData &
isCircle: boolean;
numberFormat: string;
dateFormat: string;
- emitFilter: boolean;
};
export enum EchartsRadarLabelType {
@@ -73,7 +72,6 @@ export const DEFAULT_FORM_DATA: EchartsRadarFormData = {
legendType: LegendType.Scroll,
numberFormat: 'SMART_NUMBER',
showLabels: true,
- emitFilter: false,
dateFormat: 'smart_date',
isCircle: false,
};
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
index 2ffdb0e87b..0cf7f3cf19 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
@@ -49,8 +49,9 @@ export default function EchartsTimeseries({
xValueFormatter,
xAxis,
refs,
+ emitCrossFilters,
}: TimeseriesChartTransformedProps) {
- const { emitFilter, stack } = formData;
+ const { stack } = formData;
const echartRef = useRef<EchartsHandler | null>(null);
// eslint-disable-next-line no-param-reassign
refs.echartRef = echartRef;
@@ -109,7 +110,7 @@ export default function EchartsTimeseries({
const handleChange = useCallback(
(values: string[]) => {
- if (!emitFilter) {
+ if (!emitCrossFilters) {
return;
}
const groupbyValues = values.map(value => labelMap[value]);
@@ -140,7 +141,7 @@ export default function EchartsTimeseries({
},
});
},
- [groupby, labelMap, setDataMask, emitFilter],
+ [groupby, labelMap, setDataMask, emitCrossFilters],
);
const eventHandlers: EventHandlers = {
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
index 2590441ef6..67a3b23416 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
@@ -57,7 +57,6 @@ export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
zoomable: false,
richTooltip: true,
xAxisLabelRotation: 0,
- emitFilter: false,
groupby: [],
showValue: false,
onlyTotal: false,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
index fa947b421b..eadded44a9 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
@@ -99,6 +99,7 @@ export default function transformProps(
datasource,
theme,
inContextMenu,
+ emitCrossFilters,
} = chartProps;
const { verboseMap = {} } = datasource;
const [queryData] = queriesData;
@@ -134,7 +135,6 @@ export default function transformProps(
richTooltip,
xAxis: xAxisOrig,
xAxisLabelRotation,
- emitFilter,
groupby,
showValue,
onlyTotal,
@@ -448,7 +448,7 @@ export default function transformProps(
return {
echartOptions,
- emitFilter,
+ emitCrossFilters,
formData,
groupby,
height,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts
index 82a204e38d..56527ebd63 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts
@@ -80,7 +80,6 @@ export type EchartsTimeseriesFormData = QueryFormData & {
zoomable: boolean;
richTooltip: boolean;
xAxisLabelRotation: number;
- emitFilter: boolean;
groupby: QueryFormColumn[];
showValue: boolean;
onlyTotal: boolean;
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/EchartsTreemap.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/EchartsTreemap.tsx
index 8559688939..0a2f01b404 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/EchartsTreemap.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/EchartsTreemap.tsx
@@ -29,7 +29,7 @@ import { TreemapTransformedProps } from './types';
export default function EchartsTreemap({
echartOptions,
- formData,
+ emitCrossFilters,
groupby,
height,
labelMap,
@@ -41,7 +41,7 @@ export default function EchartsTreemap({
}: TreemapTransformedProps) {
const handleChange = useCallback(
(values: string[]) => {
- if (!formData.emitFilter) {
+ if (!emitCrossFilters) {
return;
}
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 befdce1b10..dbe2e97e6e 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/controlPanel.tsx
@@ -24,7 +24,6 @@ import {
D3_FORMAT_OPTIONS,
D3_TIME_FORMAT_OPTIONS,
sections,
- emitFilterControl,
getStandardizedControls,
} from '@superset-ui/chart-controls';
import { DEFAULT_FORM_DATA } from './types';
@@ -55,7 +54,6 @@ const config: ControlPanelConfig = {
},
],
['adhoc_filters'],
- emitFilterControl,
],
},
{
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/transformProps.ts
index 5c4b4cd936..58dbd9879a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/transformProps.ts
@@ -118,6 +118,7 @@ export default function transformProps(
filterState,
theme,
inContextMenu,
+ emitCrossFilters,
} = chartProps;
const { data = [] } = queriesData[0];
const { setDataMask = () => {}, onContextMenu } = hooks;
@@ -134,7 +135,6 @@ export default function transformProps(
showLabels,
showUpperLabels,
dashboardId,
- emitFilter,
sliceId,
}: EchartsTreemapFormData = {
...DEFAULT_TREEMAP_FORM_DATA,
@@ -328,7 +328,7 @@ export default function transformProps(
height,
echartOptions,
setDataMask,
- emitFilter,
+ emitCrossFilters,
labelMap: Object.fromEntries(columnsLabelMap),
groupby,
selectedValues: filterState.selectedValues || [],
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/types.ts
index c318b2ac2a..81b53399f8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Treemap/types.ts
@@ -42,7 +42,6 @@ export type EchartsTreemapFormData = QueryFormData & {
numberFormat: string;
dateFormat: string;
dashboardId?: number;
- emitFilter: boolean;
};
export enum EchartsTreemapLabelType {
@@ -65,7 +64,6 @@ export const DEFAULT_FORM_DATA: Partial<EchartsTreemapFormData> = {
showLabels: true,
showUpperLabels: true,
dateFormat: 'smart_date',
- emitFilter: false,
};
export interface TreePathInfo {
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts
index 304f5b7065..0d0f2f8389 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts
@@ -27,7 +27,6 @@ import { BoxPlotQueryFormData } from '../../src/BoxPlot/types';
describe('BoxPlot buildQuery', () => {
const formData: BoxPlotQueryFormData = {
...DEFAULT_TITLE_FORM_DATA,
- emitFilter: false,
columns: [],
datasource: '5__table',
granularity_sqla: 'ds',
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 3796870fd8..066b796b59 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
@@ -46,7 +46,6 @@ const formDataMixedChart = {
row_limit: 10,
timeseries_limit_metric: 'count',
order_desc: true,
- emit_filter: true,
truncate_metric: true,
show_empty_columns: true,
// -- query b
@@ -63,7 +62,6 @@ const formDataMixedChart = {
row_limit_b: 100,
timeseries_limit_metric_b: undefined,
order_desc_b: false,
- emit_filter_b: undefined,
truncate_metric_b: true,
show_empty_columns_b: true,
// chart configs
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 e34394b304..03904e54c8 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controlPanel.tsx
@@ -18,7 +18,6 @@
*/
import {
ControlPanelConfig,
- emitFilterControl,
getStandardizedControls,
sections,
} from '@superset-ui/chart-controls';
@@ -65,7 +64,6 @@ const config: ControlPanelConfig = {
[includeTimeControlSetItem],
[showTotalsControlSetItem],
['adhoc_filters'],
- emitFilterControl,
],
},
{
diff --git a/superset-frontend/plugins/plugin-chart-handlebars/src/types.ts b/superset-frontend/plugins/plugin-chart-handlebars/src/types.ts
index 2a363059fa..741d3b982c 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/src/types.ts
+++ b/superset-frontend/plugins/plugin-chart-handlebars/src/types.ts
@@ -51,7 +51,6 @@ export type HandlebarsQueryFormData = QueryFormData &
all_columns?: QueryFormMetric[] | null;
order_desc?: boolean;
table_timestamp_format?: string;
- emit_filter?: boolean;
granularitySqla?: string;
time_grain_sqla?: TimeGranularity;
column_config?: Record<string, ColumnConfig>;
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx
index 2063ab95de..a5feed70f2 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx
@@ -135,7 +135,7 @@ export default function PivotTableChart(props: PivotTableProps) {
colTotals,
rowTotals,
valueFormat,
- emitFilter,
+ emitCrossFilters,
setDataMask,
selectedFilters,
verboseMap,
@@ -287,7 +287,7 @@ export default function PivotTableChart(props: PivotTableProps) {
isSubtotal: boolean,
isGrandTotal: boolean,
) => {
- if (isSubtotal || isGrandTotal || !emitFilter) {
+ if (isSubtotal || isGrandTotal || !emitCrossFilters) {
return;
}
@@ -327,7 +327,7 @@ export default function PivotTableChart(props: PivotTableProps) {
}
handleChange(updatedFilters);
},
- [emitFilter, selectedFilters, handleChange],
+ [emitCrossFilters, selectedFilters, handleChange],
);
const tableOptions = useMemo(
@@ -336,7 +336,7 @@ export default function PivotTableChart(props: PivotTableProps) {
clickColumnHeaderCallback: toggleFilter,
colTotals,
rowTotals,
- highlightHeaderCellsOnHover: emitFilter,
+ highlightHeaderCellsOnHover: emitCrossFilters,
highlightedHeaderCells: selectedFilters,
omittedHighlightHeaderGroups: [METRIC_KEY],
cellColorFormatters: { [METRIC_KEY]: metricColorFormatters },
@@ -345,7 +345,7 @@ export default function PivotTableChart(props: PivotTableProps) {
[
colTotals,
dateFormatters,
- emitFilter,
+ emitCrossFilters,
metricColorFormatters,
rowTotals,
selectedFilters,
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 28d6361507..1b01e37a4c 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
@@ -32,7 +32,6 @@ import {
D3_TIME_FORMAT_OPTIONS,
sections,
sharedControls,
- emitFilterControl,
Dataset,
getStandardizedControls,
} from '@superset-ui/chart-controls';
@@ -127,7 +126,6 @@ const config: ControlPanelConfig = {
},
],
['adhoc_filters'],
- emitFilterControl,
['series_limit'],
[
{
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts
index 546882274f..43d73e6193 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/plugin/transformProps.ts
@@ -80,6 +80,7 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
hooks: { setDataMask = () => {}, onContextMenu },
filterState,
datasource: { verboseMap = {}, columnFormats = {} },
+ emitCrossFilters,
} = chartProps;
const { data, colnames, coltypes } = queriesData[0];
const {
@@ -98,7 +99,6 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
rowTotals,
valueFormat,
dateFormat,
- emitFilter,
metricsLayout,
conditionalFormatting,
timeGrainSqla,
@@ -157,7 +157,7 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
colTotals,
rowTotals,
valueFormat,
- emitFilter,
+ emitCrossFilters,
setDataMask,
selectedFilters,
verboseMap,
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/types.ts b/superset-frontend/plugins/plugin-chart-pivot-table/src/types.ts
index 9c0523b582..24d78e2dca 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/src/types.ts
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/types.ts
@@ -65,7 +65,7 @@ interface PivotTableCustomizeProps {
rowTotals: boolean;
valueFormat: string;
setDataMask: SetDataMaskHook;
- emitFilter?: boolean;
+ emitCrossFilters?: boolean;
selectedFilters?: SelectedFiltersType;
verboseMap: JsonObject;
columnFormats: JsonObject;
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts
index 26c938e371..5185c0ca7e 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts
@@ -38,7 +38,6 @@ describe('PivotTableChart transformProps', () => {
colTotals: true,
rowTotals: true,
valueFormat: 'SMART_NUMBER',
- emitFilter: false,
metricsLayout: MetricsLayoutEnum.COLUMNS,
viz_type: '',
datasource: '',
@@ -83,7 +82,6 @@ describe('PivotTableChart transformProps', () => {
rowTotals: true,
valueFormat: 'SMART_NUMBER',
data: [{ name: 'Hulk', sum__num: 1, __timestamp: 599616000000 }],
- emitFilter: false,
setDataMask,
selectedFilters: {},
verboseMap: {},
diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
index af490395f3..3c4c74af9e 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
@@ -222,13 +222,13 @@ export default function TableChart<D extends DataRecord = DataRecord>(
serverPaginationData,
setDataMask,
showCellBars = true,
- emitFilter = false,
sortDesc = false,
filters,
sticky = true, // whether to use sticky header
columnColorFormatters,
allowRearrangeColumns = false,
onContextMenu,
+ emitCrossFilters,
} = props;
const timestampFormatter = useCallback(
value => getTimeFormatterForGranularity(timeGrain)(value),
@@ -243,7 +243,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
const handleChange = useCallback(
(filters: { [x: string]: DataRecordValue[] }) => {
- if (!emitFilter) {
+ if (!emitCrossFilters) {
return;
}
@@ -289,7 +289,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
},
});
},
- [emitFilter, setDataMask],
+ [emitCrossFilters, setDataMask],
);
// only take relevant page size options
@@ -322,27 +322,21 @@ export default function TableChart<D extends DataRecord = DataRecord>(
[filters],
);
- function getEmitTarget(col: string) {
- const meta = columnsMeta?.find(x => x.key === col);
- return meta?.config?.emitTarget || col;
- }
-
const toggleFilter = useCallback(
function toggleFilter(key: string, val: DataRecordValue) {
let updatedFilters = { ...(filters || {}) };
- const target = getEmitTarget(key);
- if (filters && isActiveFilterValue(target, val)) {
+ if (filters && isActiveFilterValue(key, val)) {
updatedFilters = {};
} else {
updatedFilters = {
- [target]: [val],
+ [key]: [val],
};
}
if (
- Array.isArray(updatedFilters[target]) &&
- updatedFilters[target].length === 0
+ Array.isArray(updatedFilters[key]) &&
+ updatedFilters[key].length === 0
) {
- delete updatedFilters[target];
+ delete updatedFilters[key];
}
handleChange(updatedFilters);
},
@@ -396,7 +390,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
getValueRange(key, alignPositiveNegative);
let className = '';
- if (emitFilter) {
+ if (emitCrossFilters) {
className += ' dt-is-filter';
}
@@ -459,7 +453,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
// show raw number in title in case of numeric values
title: typeof value === 'number' ? String(value) : undefined,
onClick:
- emitFilter && !valueRange
+ emitCrossFilters && !valueRange
? () => toggleFilter(key, value)
: undefined,
className: [
@@ -567,7 +561,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
[
defaultAlignPN,
defaultColorPN,
- emitFilter,
+ emitCrossFilters,
getValueRange,
isActiveFilterValue,
isRawRecords,
diff --git a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
index e7e6b3d985..35c5d3970a 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
@@ -44,7 +44,6 @@ import {
sharedControls,
ControlPanelState,
ControlState,
- emitFilterControl,
Dataset,
ColumnMeta,
defineSavedMetrics,
@@ -369,7 +368,6 @@ const config: ControlPanelConfig = {
},
},
],
- emitFilterControl,
],
},
{
@@ -488,7 +486,6 @@ const config: ControlPanelConfig = {
queryResponse: chart?.queriesResponse?.[0] as
| ChartDataResponseResult
| undefined,
- emitFilter: explore?.controls?.table_filter?.value,
};
},
},
diff --git a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
index bca48e6340..2fae16c31c 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
@@ -209,6 +209,7 @@ const transformProps = (
setDataMask = () => {},
onContextMenu,
},
+ emitCrossFilters,
} = chartProps;
const {
@@ -217,7 +218,6 @@ const transformProps = (
show_cell_bars: showCellBars = true,
include_search: includeSearch = false,
page_length: pageLength,
- emit_filter: emitFilter,
server_pagination: serverPagination = false,
server_page_length: serverPageLength = 10,
order_desc: sortDesc = false,
@@ -273,7 +273,7 @@ const transformProps = (
? serverPageLength
: getPageSize(pageLength, data.length, columns.length),
filters: filterState.filters,
- emitFilter,
+ emitCrossFilters,
onChangeFilter,
columnColorFormatters,
timeGrain,
diff --git a/superset-frontend/plugins/plugin-chart-table/src/types.ts b/superset-frontend/plugins/plugin-chart-table/src/types.ts
index 1a6f06f4f8..3a591e8682 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/types.ts
+++ b/superset-frontend/plugins/plugin-chart-table/src/types.ts
@@ -69,7 +69,6 @@ export type TableChartFormData = QueryFormData & {
order_desc?: boolean;
show_cell_bars?: boolean;
table_timestamp_format?: string;
- emit_filter?: boolean;
time_grain_sqla?: TimeGranularity;
column_config?: Record<string, ColumnConfig>;
allow_rearrange_columns?: boolean;
@@ -108,7 +107,7 @@ export interface TableChartTransformedProps<D extends DataRecord = DataRecord> {
// These are dashboard filters, don't be confused with in-chart search filter
// enabled by `includeSearch`
filters?: DataRecordFilters;
- emitFilter?: boolean;
+ emitCrossFilters?: boolean;
onChangeFilter?: ChartProps['hooks']['onAddFilter'];
columnColorFormatters?: ColorFormatters;
allowRearrangeColumns?: boolean;
diff --git a/superset-frontend/src/components/Chart/ChartRenderer.jsx b/superset-frontend/src/components/Chart/ChartRenderer.jsx
index e719a30c07..6a056b95fc 100644
--- a/superset-frontend/src/components/Chart/ChartRenderer.jsx
+++ b/superset-frontend/src/components/Chart/ChartRenderer.jsx
@@ -144,7 +144,8 @@ class ChartRenderer extends React.Component {
nextProps.sharedLabelColors !== this.props.sharedLabelColors ||
nextProps.formData.color_scheme !== this.props.formData.color_scheme ||
nextProps.formData.stack !== this.props.formData.stack ||
- nextProps.cacheBusterProp !== this.props.cacheBusterProp
+ nextProps.cacheBusterProp !== this.props.cacheBusterProp ||
+ nextProps.emitCrossFilters !== this.props.emitCrossFilters
);
}
return false;
diff --git a/superset-frontend/src/dashboard/actions/dashboardInfo.ts b/superset-frontend/src/dashboard/actions/dashboardInfo.ts
index 3720df2bd5..b8f7632304 100644
--- a/superset-frontend/src/dashboard/actions/dashboardInfo.ts
+++ b/superset-frontend/src/dashboard/actions/dashboardInfo.ts
@@ -136,9 +136,7 @@ export interface SetCrossFiltersEnabled {
type: typeof SET_CROSS_FILTERS_ENABLED;
crossFiltersEnabled: boolean;
}
-export function setCrossFiltersEnabled(
- crossFiltersEnabled: boolean,
-) {
+export function setCrossFiltersEnabled(crossFiltersEnabled: boolean) {
return { type: SET_CROSS_FILTERS_ENABLED, crossFiltersEnabled };
}
@@ -232,4 +230,4 @@ export function saveCrossFiltersSetting(crossFiltersEnabled: boolean) {
throw errorObject;
}
};
-}
\ No newline at end of file
+}
diff --git a/superset-frontend/src/dashboard/actions/dashboardState.js b/superset-frontend/src/dashboard/actions/dashboardState.js
index 3e4cc73650..dccec1bbc7 100644
--- a/superset-frontend/src/dashboard/actions/dashboardState.js
+++ b/superset-frontend/src/dashboard/actions/dashboardState.js
@@ -267,8 +267,11 @@ export function saveDashboardRequest(data, id, saveType) {
refresh_frequency: data.metadata?.refresh_frequency || 0,
timed_refresh_immune_slices:
data.metadata?.timed_refresh_immune_slices || [],
- // cross-filters should be enabled by default
- cross_filters_enabled: metadataCrossFiltersEnabled === undefined ? true : metadataCrossFiltersEnabled,
+ // cross-filters should be enabled by default
+ cross_filters_enabled:
+ metadataCrossFiltersEnabled === undefined
+ ? true
+ : metadataCrossFiltersEnabled,
},
};
diff --git a/superset-frontend/src/dashboard/actions/hydrate.js b/superset-frontend/src/dashboard/actions/hydrate.js
index da6e1eecd2..4190d95c37 100644
--- a/superset-frontend/src/dashboard/actions/hydrate.js
+++ b/superset-frontend/src/dashboard/actions/hydrate.js
@@ -394,6 +394,11 @@ export const hydrateDashboard =
const { roles } = user;
const canEdit = canUserEditDashboard(dashboard, user);
+ const crossFiltersEnabled =
+ (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
+ (metadata.cross_filters_enabled === undefined ||
+ metadata.cross_filters_enabled)) ||
+ false;
return dispatch({
type: HYDRATE_DASHBOARD,
@@ -433,8 +438,7 @@ export const hydrateDashboard =
(isFeatureEnabled(FeatureFlag.HORIZONTAL_FILTER_BAR) &&
metadata.filter_bar_orientation) ||
FilterBarOrientation.VERTICAL,
- crossFiltersEnabled: (isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
- metadata.cross_filters_enabled === undefined || metadata.cross_filters_enabled) || false,
+ crossFiltersEnabled,
},
dataMask,
dashboardFilters,
diff --git a/superset-frontend/src/dashboard/components/SliceHeader/index.tsx b/superset-frontend/src/dashboard/components/SliceHeader/index.tsx
index eaf045c114..47f64641f6 100644
--- a/superset-frontend/src/dashboard/components/SliceHeader/index.tsx
+++ b/superset-frontend/src/dashboard/components/SliceHeader/index.tsx
@@ -105,6 +105,9 @@ const SliceHeader: FC<SliceHeaderProps> = ({
const crossFilterValue = useSelector<RootState, any>(
state => state.dataMask[slice?.slice_id]?.filterState?.value,
);
+ const isCrossFiltersEnabled = useSelector<RootState, boolean>(
+ ({ dashboardInfo }) => dashboardInfo.crossFiltersEnabled,
+ );
const indicator = useMemo(
() => ({
@@ -224,6 +227,7 @@ const SliceHeader: FC<SliceHeaderProps> = ({
chartStatus={chartStatus}
formData={formData}
exploreUrl={exploreUrl}
+ crossFiltersEnabled={isCrossFiltersEnabled}
/>
)}
</>
diff --git a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
index 5bdc442ba1..fe472355c7 100644
--- a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
+++ b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
@@ -111,7 +111,6 @@ export interface SliceHeaderControlsProps {
slice_name: string;
slice_id: number;
slice_description: string;
- form_data?: { emit_filter?: boolean };
datasource: string;
};
@@ -141,6 +140,8 @@ export interface SliceHeaderControlsProps {
supersetCanShare?: boolean;
supersetCanCSV?: boolean;
sliceCanEdit?: boolean;
+
+ crossFiltersEnabled?: boolean;
}
type SliceHeaderControlsPropsWithRouter = SliceHeaderControlsProps &
RouteComponentProps;
@@ -332,6 +333,7 @@ class SliceHeaderControls extends React.PureComponent<
addDangerToast = () => {},
supersetCanShare = false,
isCached = [],
+ crossFiltersEnabled,
} = this.props;
const crossFilterItems = getChartMetadataRegistry().items;
const isTable = slice.viz_type === 'table';
@@ -341,7 +343,6 @@ class SliceHeaderControls extends React.PureComponent<
value.behaviors?.includes(Behavior.INTERACTIVE_CHART),
)
.find(([key]) => key === slice.viz_type);
- const canEmitCrossFilter = slice.form_data?.emit_filter;
const cachedWhen = (cachedDttm || []).map(itemCachedDttm =>
moment.utc(itemCachedDttm).fromNow(),
@@ -368,6 +369,7 @@ class SliceHeaderControls extends React.PureComponent<
const fullscreenLabel = isFullSize
? t('Exit fullscreen')
: t('Enter fullscreen');
+
const menu = (
<Menu
onClick={this.handleMenuClick}
@@ -464,7 +466,7 @@ class SliceHeaderControls extends React.PureComponent<
{isFeatureEnabled(FeatureFlag.DASHBOARD_CROSS_FILTERS) &&
isCrossFilter &&
- canEmitCrossFilter && (
+ crossFiltersEnabled && (
<>
<Menu.Item key={MENU_KEYS.CROSS_FILTER_SCOPING}>
{t('Cross-filter scoping')}
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
index 9612189f1b..dc2212a223 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
@@ -176,13 +176,6 @@ class Chart extends React.Component {
return true;
}
- // allow chart to update if enable/disable cross-filters.
- if (
- this.props?.emitCrossFilters !== nextProps?.emitCrossFilters
- ) {
- return true;
- }
-
// allow chart update/re-render only if visible:
// under selected tab or no tab layout
if (nextProps.isComponentVisible) {
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx
index 1ea1880f5b..90f81e20a0 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx
@@ -17,15 +17,28 @@
* under the License.
*/
-import React, { useCallback, useEffect, useMemo, useState } from 'react';
+import React, { useCallback, useMemo, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import { FeatureFlag, isFeatureEnabled, styled, t, useTheme } from '@superset-ui/core';
+import {
+ DataMaskStateWithId,
+ FeatureFlag,
+ isFeatureEnabled,
+ styled,
+ t,
+ useTheme,
+} from '@superset-ui/core';
import { MenuProps } from 'src/components/Menu';
import { FilterBarOrientation, RootState } from 'src/dashboard/types';
-import { saveFilterBarOrientation, saveCrossFiltersSetting } from 'src/dashboard/actions/dashboardInfo';
+import {
+ saveFilterBarOrientation,
+ saveCrossFiltersSetting,
+} from 'src/dashboard/actions/dashboardInfo';
import Icons from 'src/components/Icons';
-import DropdownSelectableIcon, { DropDownSelectableProps } from 'src/components/DropdownSelectableIcon';
+import DropdownSelectableIcon, {
+ DropDownSelectableProps,
+} from 'src/components/DropdownSelectableIcon';
import Checkbox from 'src/components/Checkbox';
+import { clearDataMaskState } from 'src/dataMask/actions';
type SelectedKey = FilterBarOrientation | string | number;
@@ -49,18 +62,21 @@ const FilterBarSettings = () => {
const isCrossFiltersFeatureEnabled = isFeatureEnabled(
FeatureFlag.DASHBOARD_CROSS_FILTERS,
);
- const shouldEnableCrossFilters = !!isCrossFiltersEnabled && isCrossFiltersFeatureEnabled;
- const [crossFiltersEnabled, setCrossFiltersEnabled] =
- useState<boolean>(shouldEnableCrossFilters);
+ const shouldEnableCrossFilters =
+ !!isCrossFiltersEnabled && isCrossFiltersFeatureEnabled;
+ const [crossFiltersEnabled, setCrossFiltersEnabled] = useState<boolean>(
+ shouldEnableCrossFilters,
+ );
const crossFiltersMenuKey = 'cross-filters-menu-key';
const isOrientation = (o: SelectedKey): o is FilterBarOrientation =>
o === FilterBarOrientation.VERTICAL ||
o === FilterBarOrientation.HORIZONTAL;
const updateCrossFiltersSetting = useCallback(
- async (isEnabled) => {
- await dispatch(
- saveCrossFiltersSetting(isEnabled),
- );
+ async isEnabled => {
+ if (!isEnabled) {
+ dispatch(clearDataMaskState());
+ }
+ await dispatch(saveCrossFiltersSetting(isEnabled));
},
[dispatch, crossFiltersEnabled],
);
@@ -105,7 +121,7 @@ const FilterBarSettings = () => {
),
[crossFiltersEnabled],
);
- const menuItems: DropDownSelectableProps["menuItems"] = [
+ const menuItems: DropDownSelectableProps['menuItems'] = [
{
key: 'placement',
label: t('Placement of the filter bar'),
diff --git a/superset-frontend/src/dashboard/reducers/dashboardInfo.js b/superset-frontend/src/dashboard/reducers/dashboardInfo.js
index 166323af25..3503c441b6 100644
--- a/superset-frontend/src/dashboard/reducers/dashboardInfo.js
+++ b/superset-frontend/src/dashboard/reducers/dashboardInfo.js
@@ -44,11 +44,11 @@ export default function dashboardStateReducer(state = {}, action) {
...state,
filterBarOrientation: action.filterBarOrientation,
};
- case SET_CROSS_FILTERS_ENABLED:
- return {
- ...state,
- crossFiltersEnabled: action.crossFiltersEnabled,
- };
+ case SET_CROSS_FILTERS_ENABLED:
+ return {
+ ...state,
+ crossFiltersEnabled: action.crossFiltersEnabled,
+ };
default:
return state;
}
diff --git a/superset-frontend/src/dashboard/types.ts b/superset-frontend/src/dashboard/types.ts
index 694372f1f5..87dee0b05a 100644
--- a/superset-frontend/src/dashboard/types.ts
+++ b/superset-frontend/src/dashboard/types.ts
@@ -108,6 +108,7 @@ export type DashboardInfo = {
color_scheme_domain: string[];
label_colors: JsonObject;
shared_label_colors: JsonObject;
+ cross_filters_enabled: boolean;
};
crossFiltersEnabled: boolean;
filterBarOrientation: FilterBarOrientation;
diff --git a/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts b/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts
index 14e8975bd5..4f8de967a8 100644
--- a/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts
+++ b/superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts
@@ -145,7 +145,6 @@ const tableVizStore = {
value: true,
},
show_totals: {},
- emit_filter: {},
table_timestamp_format: {
value: 'smart_date',
},