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7}1CNbcfB*mh
literal 0
HcmV?d00001
diff --git a/superset-frontend/src/filters/components/Adhoc/index.ts b/superset-frontend/src/filters/components/Adhoc/index.ts
new file mode 100644
index 0000000000000..c9a090c9e03ea
--- /dev/null
+++ b/superset-frontend/src/filters/components/Adhoc/index.ts
@@ -0,0 +1,44 @@
+/**
+ * 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 { Behavior, ChartMetadata, ChartPlugin, t } from '@superset-ui/core';
+import buildQuery from './buildQuery';
+import controlPanel from './controlPanel';
+import transformProps from './transformProps';
+import thumbnail from './images/thumbnail.png';
+
+export default class FilterAdhocPlugin extends ChartPlugin {
+ constructor() {
+ const metadata = new ChartMetadata({
+ name: t('Adhoc filter'),
+ description: t('Adhoc filter plugin using AntD'),
+ behaviors: [Behavior.INTERACTIVE_CHART, Behavior.NATIVE_FILTER],
+ enableNoResults: false,
+ tags: [t('Experimental')],
+ thumbnail,
+ });
+
+ super({
+ buildQuery,
+ controlPanel,
+ loadChart: () => import('./AdhocFilterPlugin'),
+ metadata,
+ transformProps,
+ });
+ }
+}
diff --git a/superset-frontend/src/filters/components/Adhoc/transformProps.ts b/superset-frontend/src/filters/components/Adhoc/transformProps.ts
new file mode 100644
index 0000000000000..59d9adc57e930
--- /dev/null
+++ b/superset-frontend/src/filters/components/Adhoc/transformProps.ts
@@ -0,0 +1,68 @@
+/**
+ * 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 { GenericDataType } from '@superset-ui/core';
+import { noOp } from 'src/utils/common';
+import { DEFAULT_FORM_DATA, PluginFilterSelectChartProps } from './types';
+
+export default function transformProps(
+ chartProps: PluginFilterSelectChartProps,
+) {
+ const {
+ formData,
+ height,
+ hooks,
+ queriesData,
+ width,
+ behaviors,
+ appSection,
+ filterState,
+ isRefreshing,
+ inputRef,
+ } = chartProps;
+ const newFormData = { ...DEFAULT_FORM_DATA, ...formData };
+ const {
+ setDataMask = noOp,
+ setFocusedFilter = noOp,
+ unsetFocusedFilter = noOp,
+ setFilterActive = noOp,
+ } = hooks;
+ const [queryData] = queriesData;
+ const { colnames = [], coltypes = [], data = [] } = queryData || {};
+ const coltypeMap: Record = colnames.reduce(
+ (accumulator, item, index) => ({ ...accumulator, [item]: coltypes[index] }),
+ {},
+ );
+
+ return {
+ filterState,
+ coltypeMap,
+ appSection,
+ width,
+ behaviors,
+ height,
+ data,
+ formData: newFormData,
+ isRefreshing,
+ setDataMask,
+ setFocusedFilter,
+ unsetFocusedFilter,
+ setFilterActive,
+ inputRef,
+ };
+}
diff --git a/superset-frontend/src/filters/components/Adhoc/types.ts b/superset-frontend/src/filters/components/Adhoc/types.ts
new file mode 100644
index 0000000000000..5cb7a18ceb599
--- /dev/null
+++ b/superset-frontend/src/filters/components/Adhoc/types.ts
@@ -0,0 +1,87 @@
+/**
+ * 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 {
+ AppSection,
+ Behavior,
+ ChartProps,
+ DataRecord,
+ FilterState,
+ GenericDataType,
+ QueryFormData,
+ ChartDataResponseResult,
+} from '@superset-ui/core';
+import { RefObject } from 'react';
+import { PluginFilterHooks, PluginFilterStylesProps } from '../types';
+
+export type SelectValue = (number | string | null)[] | null | undefined;
+
+export interface PluginFilterSelectCustomizeProps {
+ defaultValue?: SelectValue;
+ enableEmptyFilter: boolean;
+ inverseSelection: boolean;
+ multiSelect: boolean;
+ defaultToFirstItem: boolean;
+ searchAllOptions: boolean;
+ sortAscending?: boolean;
+ sortMetric?: string;
+}
+
+export type PluginFilterSelectQueryFormData = QueryFormData &
+ PluginFilterStylesProps &
+ PluginFilterSelectCustomizeProps;
+
+export interface PluginFilterSelectChartProps extends ChartProps {
+ queriesData: ChartDataResponseResult[];
+}
+
+export type PluginFilterSelectProps = PluginFilterStylesProps & {
+ coltypeMap: Record;
+ data: DataRecord[];
+ behaviors: Behavior[];
+ appSection: AppSection;
+ formData: PluginFilterSelectQueryFormData;
+ filterState: FilterState;
+ isRefreshing: boolean;
+ showOverflow: boolean;
+ parentRef?: RefObject;
+ inputRef?: RefObject;
+} & PluginFilterHooks;
+
+export type PluginFilterAdhocProps = PluginFilterStylesProps & {
+ coltypeMap: Record;
+ data: DataRecord[];
+ behaviors: Behavior[];
+ appSection: AppSection;
+ formData: PluginFilterSelectQueryFormData;
+ filterState: FilterState;
+ isRefreshing: boolean;
+ showOverflow: boolean;
+ parentRef?: RefObject;
+ inputRef?: RefObject;
+} & PluginFilterHooks;
+
+export const DEFAULT_FORM_DATA: PluginFilterSelectCustomizeProps = {
+ defaultValue: null,
+ enableEmptyFilter: false,
+ inverseSelection: false,
+ defaultToFirstItem: false,
+ multiSelect: true,
+ searchAllOptions: false,
+ sortAscending: true,
+};
diff --git a/superset-frontend/src/filters/components/index.ts b/superset-frontend/src/filters/components/index.ts
index 11ad1a4fb588a..1fa2d5187a5bc 100644
--- a/superset-frontend/src/filters/components/index.ts
+++ b/superset-frontend/src/filters/components/index.ts
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+export { default as AdhocFilterPlugin } from './Adhoc';
export { default as SelectFilterPlugin } from './Select';
export { default as RangeFilterPlugin } from './Range';
export { default as TimeFilterPlugin } from './Time';
diff --git a/superset-frontend/src/filters/utils.ts b/superset-frontend/src/filters/utils.ts
index 4908f1a2893c5..1cb5965433af0 100644
--- a/superset-frontend/src/filters/utils.ts
+++ b/superset-frontend/src/filters/utils.ts
@@ -26,6 +26,44 @@ import {
} from '@superset-ui/core';
import { FALSE_STRING, NULL_STRING, TRUE_STRING } from 'src/utils/common';
+export const getAdhocExtraFormData = (
+ col: string,
+ value?: null | (string | number | boolean | null)[],
+ emptyFilter = false,
+ inverseSelection = false,
+): ExtraFormData => {
+ const extra: ExtraFormData = {};
+ if (emptyFilter) {
+ extra.adhoc_filters = [
+ {
+ expressionType: 'SQL',
+ clause: 'WHERE',
+ sqlExpression: '1 = 0',
+ },
+ ];
+ } else if (value !== undefined && value !== null && value.length !== 0) {
+ extra.filters = [
+ {
+ col,
+ op: inverseSelection ? ('NOT IN' as const) : ('IN' as const),
+ // @ts-ignore
+ val: value,
+ },
+ ];
+ // extra.adhoc_filters = [
+ // {
+ // expressionType: EXPRESSION_TYPES.SIMPLE,
+ // subject: option.column_name,
+ // operator: OPERATOR_ENUM_TO_OPERATOR_TYPE[Operators.EQUALS].operation,
+ // comparator: '',
+ // clause: CLAUSES.WHERE,
+ // isNew: true,
+ // },
+ // ];
+ }
+ return extra;
+};
+
export const getSelectExtraFormData = (
col: string,
value?: null | (string | number | boolean | null)[],
diff --git a/superset-frontend/src/visualizations/presets/MainPreset.js b/superset-frontend/src/visualizations/presets/MainPreset.js
index 3382e1d0c4c8a..d2e77bd1efac8 100644
--- a/superset-frontend/src/visualizations/presets/MainPreset.js
+++ b/superset-frontend/src/visualizations/presets/MainPreset.js
@@ -69,6 +69,7 @@ import {
EchartsTreeChartPlugin,
} from '@superset-ui/plugin-chart-echarts';
import {
+ AdhocFilterPlugin,
SelectFilterPlugin,
RangeFilterPlugin,
TimeFilterPlugin,
@@ -183,6 +184,7 @@ export default class MainPreset extends Preset {
new EchartsTimeseriesStepChartPlugin().configure({
key: 'echarts_timeseries_step',
}),
+ new AdhocFilterPlugin().configure({ key: 'adhoc_filter '}),
new SelectFilterPlugin().configure({ key: 'filter_select' }),
new RangeFilterPlugin().configure({ key: 'filter_range' }),
new TimeFilterPlugin().configure({ key: 'filter_time' }),
From 5b9d83d99661829a0a0a78f49b6226a2f8b10b5f Mon Sep 17 00:00:00 2001
From: cccs-Dustin <96579982+cccs-Dustin@users.noreply.github.com>
Date: Fri, 23 Sep 2022 14:56:19 -0400
Subject: [PATCH 02/24] Made sure that adhoc filter uses the adhoc filter
object
---
superset-frontend/src/filters/utils.ts | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/superset-frontend/src/filters/utils.ts b/superset-frontend/src/filters/utils.ts
index 1cb5965433af0..b5056df6616a2 100644
--- a/superset-frontend/src/filters/utils.ts
+++ b/superset-frontend/src/filters/utils.ts
@@ -42,24 +42,15 @@ export const getAdhocExtraFormData = (
},
];
} else if (value !== undefined && value !== null && value.length !== 0) {
- extra.filters = [
+ extra.adhoc_filters = [
{
- col,
- op: inverseSelection ? ('NOT IN' as const) : ('IN' as const),
- // @ts-ignore
- val: value,
+ expressionType: 'SIMPLE',
+ subject: col,
+ operator: 'IN',
+ comparator: value,
+ clause: 'WHERE',
},
];
- // extra.adhoc_filters = [
- // {
- // expressionType: EXPRESSION_TYPES.SIMPLE,
- // subject: option.column_name,
- // operator: OPERATOR_ENUM_TO_OPERATOR_TYPE[Operators.EQUALS].operation,
- // comparator: '',
- // clause: CLAUSES.WHERE,
- // isNew: true,
- // },
- // ];
}
return extra;
};
From 22285cda824e5ffa6f4ff57e0ee34fbe21691bae Mon Sep 17 00:00:00 2001
From: cccs-RyanK <102618419+cccs-RyanK@users.noreply.github.com>
Date: Tue, 27 Sep 2022 09:03:57 -0400
Subject: [PATCH 03/24] added adhocfiltercontrol to native adhoc filter
---
.../components/Adhoc/AdhocFilterPlugin.tsx | 178 +++++++++---------
superset-frontend/src/filters/utils.ts | 16 +-
.../src/visualizations/presets/MainPreset.js | 2 +-
3 files changed, 93 insertions(+), 103 deletions(-)
diff --git a/superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx b/superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx
index 8ae9404f0c563..1ca5ab29a84cf 100644
--- a/superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx
+++ b/superset-frontend/src/filters/components/Adhoc/AdhocFilterPlugin.tsx
@@ -26,17 +26,29 @@ import {
GenericDataType,
getColumnLabel,
JsonObject,
+ JsonResponse,
+ QueryFormColumn,
smartDateDetailedFormatter,
+ SupersetApiError,
+ SupersetClient,
t,
tn,
} from '@superset-ui/core';
import { LabeledValue as AntdLabeledValue } from 'antd/lib/select';
import React, { useCallback, useEffect, useState, useMemo } from 'react';
-import { Select } from 'src/components';
import debounce from 'lodash/debounce';
+// eslint-disable-next-line import/no-unresolved
import { SLOW_DEBOUNCE } from 'src/constants';
import { useImmerReducer } from 'use-immer';
import { propertyComparator } from 'src/components/Select/Select';
+import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl';
+import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
+// eslint-disable-next-line import/no-unresolved
+import { addDangerToast } from 'src/components/MessageToasts/actions';
+// eslint-disable-next-line import/no-unresolved
+import { cacheWrapper } from 'src/utils/cacheWrapper';
+// eslint-disable-next-line import/no-unresolved
+import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import { PluginFilterAdhocProps, SelectValue } from './types';
import { StyledFormItem, FilterPluginStyle, StatusMessage } from '../common';
import { getDataRecordFormatter, getAdhocExtraFormData } from '../../utils';
@@ -47,7 +59,11 @@ type DataMaskAction =
type: 'filterState';
__cache: JsonObject;
extraFormData: ExtraFormData;
- filterState: { value: SelectValue; label?: string };
+ filterState: {
+ label?: string;
+ filters?: AdhocFilter[];
+ value: AdhocFilter[];
+ };
};
function reducer(
@@ -102,7 +118,14 @@ export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
() => ensureIsArray(formData.groupby).map(getColumnLabel),
[formData.groupby],
);
- const [col] = groupby;
+ const datasetId = useMemo(
+ () => formData.datasource.split('_')[0],
+ [formData.datasource],
+ );
+ const [datasetDetails, setDatasetDetails] = useState>();
+ const [col, setCol] = useState('');
+ console.log(formData.columns);
+ const [columns, setColumns] = useState();
const [initialColtypeMap] = useState(coltypeMap);
const [dataMask, dispatchDataMask] = useImmerReducer(reducer, {
extraFormData: {},
@@ -117,33 +140,70 @@ export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
[],
);
+ const localCache = new Map();
+
+ const cachedSupersetGet = cacheWrapper(
+ SupersetClient.get,
+ localCache,
+ ({ endpoint }) => endpoint || '',
+ );
+
+ useEffect(() => {
+ if (datasetId) {
+ cachedSupersetGet({
+ endpoint: `/api/v1/dataset/${datasetId}`,
+ })
+ .then((response: JsonResponse) => {
+ const dataset = response.json?.result;
+ // modify the response to fit structure expected by AdhocFilterControl
+ dataset.type = dataset.datasource_type;
+ dataset.filter_select = true;
+ setDatasetDetails(dataset);
+ })
+ .catch((response: SupersetApiError) => {
+ addDangerToast(response.message);
+ });
+ }
+ }, [datasetId]);
+
+ useEffect(() => {
+ if (datasetId != null) {
+ cachedSupersetGet({
+ endpoint: `/api/v1/dataset/${datasetId}`,
+ }).then(
+ ({ json: { result } }) => {
+ setColumns(result.columns);
+ },
+ async badResponse => {
+ const { error, message } = await getClientErrorObject(badResponse);
+ let errorText = message || error || t('An error has occurred');
+ if (message === 'Forbidden') {
+ errorText = t('You do not have permission to edit this dashboard');
+ }
+ addDangerToast(errorText);
+ },
+ );
+ }
+ });
+
const updateDataMask = useCallback(
- (values: SelectValue) => {
+ (adhoc_filters: AdhocFilter[]) => {
const emptyFilter =
- enableEmptyFilter && !inverseSelection && !values?.length;
-
- const suffix = inverseSelection && values?.length ? t(' (excluded)') : '';
+ enableEmptyFilter && !inverseSelection && !adhoc_filters?.length;
dispatchDataMask({
type: 'filterState',
__cache: filterState,
extraFormData: getAdhocExtraFormData(
- col,
- values,
+ adhoc_filters,
emptyFilter,
inverseSelection,
),
filterState: {
...filterState,
- label: values?.length
- ? `${(values || [])
- .map(value => labelFormatter(value, datatype))
- .join(', ')}${suffix}`
- : undefined,
- value:
- appSection === AppSection.FILTER_CONFIG_MODAL && defaultToFirstItem
- ? undefined
- : values,
+ label: (adhoc_filters || []).map(f => String(f.subject)).join(', '),
+ value: adhoc_filters,
+ filters: adhoc_filters,
},
});
},
@@ -207,49 +267,6 @@ export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
unsetFocusedFilter();
}, [clearSuggestionSearch, unsetFocusedFilter]);
- const handleChange = useCallback(
- (value?: SelectValue | number | string) => {
- const values = value === null ? [null] : ensureIsArray(value);
-
- if (values.length === 0) {
- updateDataMask(null);
- } else {
- updateDataMask(values);
- }
- },
- [updateDataMask],
- );
-
- useEffect(() => {
- if (defaultToFirstItem && filterState.value === undefined) {
- // initialize to first value if set to default to first item
- const firstItem: SelectValue = data[0]
- ? (groupby.map(col => data[0][col]) as string[])
- : null;
- // firstItem[0] !== undefined for a case when groupby changed but new data still not fetched
- // TODO: still need repopulate default value in config modal when column changed
- if (firstItem && firstItem[0] !== undefined) {
- updateDataMask(firstItem);
- }
- } else if (isDisabled) {
- // empty selection if filter is disabled
- updateDataMask(null);
- } else {
- // reset data mask based on filter state
- updateDataMask(filterState.value);
- }
- }, [
- col,
- isDisabled,
- defaultToFirstItem,
- enableEmptyFilter,
- inverseSelection,
- updateDataMask,
- data,
- groupby,
- JSON.stringify(filterState),
- ]);
-
useEffect(() => {
setDataMask(dataMask);
}, [JSON.stringify(dataMask)]);
@@ -299,35 +316,16 @@ export default function PluginFilterAdhoc(props: PluginFilterAdhocProps) {
validateStatus={filterState.validateStatus}
extra={formItemExtra}
>
-