diff --git a/cccs-build/superset/Dockerfile b/cccs-build/superset/Dockerfile index e9c1e83983a3..0af9e966c06f 100644 --- a/cccs-build/superset/Dockerfile +++ b/cccs-build/superset/Dockerfile @@ -1,7 +1,7 @@ # Vault CA container import ARG VAULT_CA_CONTAINER=uchimera.azurecr.io/cccs/hogwarts/vault-ca:master_11376_a25c34e1 FROM $VAULT_CA_CONTAINER AS vault_ca -FROM uchimera.azurecr.io/cccs/superset-base:cccs-4.1_20251203214830_b13300 +FROM uchimera.azurecr.io/cccs/superset-base:cyber-jessie_cccs-4.1_remove-dataset-explorer_20251216182719_b13377 USER root diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index e0766078d75a..130208d27c2e 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -49455,9 +49455,10 @@ } }, "node_modules/sax": { - "version": "1.2.4", - "dev": true, - "license": "ISC" + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz", + "integrity": "sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==", + "dev": true }, "node_modules/scheduler": { "version": "0.19.1", @@ -91735,7 +91736,9 @@ } }, "sax": { - "version": "1.2.4", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz", + "integrity": "sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==", "dev": true }, "scheduler": { diff --git a/superset-frontend/src/cccs-viz/plugins/index.ts b/superset-frontend/src/cccs-viz/plugins/index.ts index c9771e12b640..e832552d13d3 100644 --- a/superset-frontend/src/cccs-viz/plugins/index.ts +++ b/superset-frontend/src/cccs-viz/plugins/index.ts @@ -18,7 +18,6 @@ */ export { default as CccsTableChartPlugin } from './plugin-chart-ag-grid/src/cccs-grid/plugin'; -export { default as DatasetExplorerChartPlugin } from './plugin-chart-dataset-explorer/src/plugin'; export { default as IFrameVisualizationChartPlugin } from './plugin-chart-iframe/src/plugin'; export { default as EmailRendererChartPlugin } from './plugin-chart-email-renderer/src/plugin'; export { default as JSONViewChartPlugin } from './plugin-chart-json-view/plugin'; diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/advancedDataTypeValueControl/index.tsx b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/advancedDataTypeValueControl/index.tsx deleted file mode 100644 index 3efc0195f93a..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/advancedDataTypeValueControl/index.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import { useEffect, useState } from 'react'; -import { ensureIsArray, withTheme } from '@superset-ui/core'; -import { connect } from 'react-redux'; -import SelectControl from 'src/explore/components/controls/SelectControl'; -import useAdvancedDataTypes from 'src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/useAdvancedDataTypes'; - -export interface Props { - colorScheme: string; - annotationError: object; - annotationQuery: object; - vizType: string; - theme: any; - validationErrors: string[]; - externalValidationErrors: string[]; - name: string; - actions: object; - label: string; - value?: any[] | any; - datasource: any; - multi: boolean; - freeForm: boolean; - advancedDataType: string; - onChange: (values: any, errors: any[]) => void; - disabled: boolean; - description: any; -} - -const AdvancedDataTypeValueControlValueControl: React.FC = ({ - onChange, - externalValidationErrors, - datasource, - multi, - freeForm, - advancedDataType, - label, - disabled, - value = [], - description, -}) => { - const [rawValues, setRawValues] = useState( - value && ensureIsArray(value).length === 1 ? value[0].rawData : [], - ); - const [validationErrors, setValidationErrors] = useState([]); - const [currentAdvancedDataType, setCurrentAdvancedDataType] = - useState(advancedDataType); - - const { - advancedDataTypesState, - subjectAdvancedDataType, - fetchAdvancedDataTypeValueCallback, - } = useAdvancedDataTypes(() => {}); - - const onChangeWrapper = (selection: any) => { - setValidationErrors( - selection.length > 0 - ? [...validationErrors, 'Validation in progress'] - : [...validationErrors], - ); - setRawValues(selection); - }; - - // clear selection on advancedDataType change - useEffect(() => { - const rawData = value[0] ? value[0].rawData : []; - onChangeWrapper( - (currentAdvancedDataType && - currentAdvancedDataType !== advancedDataType) || - !advancedDataType - ? [] - : rawData, - ); - setCurrentAdvancedDataType(advancedDataType); - }, [advancedDataType]); - - useEffect(() => { - const data = - advancedDataTypesState.values.length > 0 - ? { - data: advancedDataTypesState.values, - columns: datasource.columns - .filter((col: any) => col.advanced_data_type === advancedDataType) - .map((col: any) => col.column_name), - rawData: rawValues, - } - : { data: [], columns: [], rawData: [] }; - onChange(data, validationErrors); - }, [advancedDataTypesState, validationErrors]); - - useEffect(() => { - if (rawValues.length > 0) { - fetchAdvancedDataTypeValueCallback( - rawValues, - advancedDataTypesState, - ensureIsArray(advancedDataType)[0], - ); - } - }, [advancedDataType, rawValues, subjectAdvancedDataType]); - - useEffect(() => { - setValidationErrors( - advancedDataTypesState.errorMessage - ? [advancedDataTypesState.errorMessage] - : [], - ); - }, [advancedDataTypesState]); - - return ( - - ); -}; - -function mapStateToProps({ charts, explore }: any) { - return { - // eslint-disable-next-line camelcase - colorScheme: explore.controls?.color_scheme?.value, - vizType: explore.controls.viz_type.value, - }; -} - -const themedAdvancedDataTypeValueControlValueControl = withTheme( - AdvancedDataTypeValueControlValueControl, -); - -export default connect(mapStateToProps)( - themedAdvancedDataTypeValueControlValueControl, -); diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/changeDatasourceButton/index.tsx b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/changeDatasourceButton/index.tsx deleted file mode 100644 index f33e2997cc60..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/changeDatasourceButton/index.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import { useState } from 'react'; -import { ChangeDatasourceModal } from 'src/components/Datasource'; -import { withTheme } from '@superset-ui/core'; -import { connect, useDispatch } from 'react-redux'; -import Button from 'src/components/Button'; -import { updateCCCSFormDataByDatasource } from 'src/explore/actions/exploreActions'; - -export interface Props { - colorScheme: string; - annotationError: object; - annotationQuery: object; - vizType: string; - theme: any; - validationErrors: string[]; - name: string; - actions: object; - label: string; - value?: object[]; - datasource: any; - onChange: (a: any) => void; -} - -const ChangeDatasourceButtonControll: React.FC = ({ - onChange, - datasource, -}) => { - const dispatch = useDispatch(); - const [showChangeDatasourceModal, setShowChangeDatasourceModal] = - useState(false); - - const toggleChangeDatasourceModal = () => { - setShowChangeDatasourceModal(!showChangeDatasourceModal); - }; - const onDatasourceSave = (new_datasource: any) => { - dispatch(updateCCCSFormDataByDatasource(datasource, new_datasource)); - }; - const onChangeWrapper = (a: any) => { - onChange(a); - }; - - return ( - <> - - {showChangeDatasourceModal && ( - - )} - - ); -}; - -function mapStateToProps({ explore }: any) { - return { - // eslint-disable-next-line camelcase - colorScheme: explore.controls?.color_scheme?.value, - vizType: explore.controls.viz_type.value, - }; -} - -const themedChangeDatasourceButtonControll = withTheme( - ChangeDatasourceButtonControll, -); - -export default connect(mapStateToProps)(themedChangeDatasourceButtonControll); diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/datetimeControl/index.tsx b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/datetimeControl/index.tsx deleted file mode 100644 index 24494afcaf57..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/components/controls/datetimeControl/index.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { useEffect, useState } from 'react'; -import { - getClientErrorObject, - NO_TIME_RANGE, - SLOW_DEBOUNCE, - SupersetClient, - t, - withTheme, -} from '@superset-ui/core'; -import { Input } from 'src/components/Input'; -import { connect } from 'react-redux'; -import rison from 'rison'; -import ControlHeader from 'src/explore/components/ControlHeader'; -import { useDebouncedEffect } from 'src/explore/exploreUtils'; -import { - buildTimeRangeString, - formatTimeRange, -} from '../../../../../../../../packages/superset-ui-core/src/time-comparison/fetchTimeRange'; - -export interface Props { - colorScheme: string; - annotationError: object; - annotationQuery: object; - vizType: string; - theme: any; - validationErrors: string[]; - name: string; - actions: object; - label: string; - value?: string; - onChange: (value: any, errors: any[]) => void; - default: string; - disabled: boolean; -} - -const SEPARATOR = ' : '; -const fetchTimeRange = async (timeRange: string) => { - const query = rison.encode_uri(timeRange); - const endpoint = `/api/v1/time_range/?q=${query}`; - try { - const response = await SupersetClient.get({ endpoint }); - const timeRangeString = buildTimeRangeString( - response?.json?.result?.since || '', - response?.json?.result?.until || '', - ); - return { - value: formatTimeRange(timeRangeString), - }; - } catch (response) { - const clientError = await getClientErrorObject(response); - return { - // keep labelling consistent in error messages - error: (clientError.message || clientError.error) - .replace('From date', 'Start date') - .replace('to date', 'end date'), - }; - } -}; - -const DatetimeControl: React.FC = props => { - // if the value passed in is "no filter", leave the control empty - // if the value does not exist, set it to the default - const [timeRange, setTimeRange] = useState( - props.value - ? props.value === NO_TIME_RANGE - ? '' - : props.value - : props.default, - ); - const [validationErrors, setValidationErrors] = useState([]); - const [actualTimeRange, setActualTimeRange] = useState(); - - const [since, until] = timeRange.split(SEPARATOR); - - useEffect(() => { - props.onChange(timeRange, validationErrors); - }, [timeRange, since, until, validationErrors]); - - function onChange(control: 'since' | 'until', value: string) { - if (control === 'since') { - setTimeRange( - until ? `${value}${SEPARATOR}${until}` : `${value}${SEPARATOR}`, - ); - } else { - setTimeRange(`${since}${SEPARATOR}${value}`); - } - } - - useDebouncedEffect( - () => { - fetchTimeRange(timeRange) - .then(value => { - setActualTimeRange( - value?.value ? `Actual Time Range ${value?.value}` : '', - ); - setValidationErrors(value?.error ? [value?.error] : []); - }) - .catch(error => { - setValidationErrors(error); - }); - }, - SLOW_DEBOUNCE, - [timeRange], - ); - - const headerProps = { - name: props.name, - label: props.label, - validationErrors, - description: actualTimeRange, - hovered: true, - }; - - return ( - <> - -
{t('START (INCLUSIVE)')}
- onChange('since', e.target.value)} - disabled={props.disabled} - /> -
{t('END (EXCLUSIVE)')}
- onChange('until', e.target.value)} - disabled={props.disabled} - /> - - ); -}; - -// Tried to hook this up through stores/control.jsx instead of using redux -// directly, could not figure out how to get access to the color_scheme -function mapStateToProps({ charts, explore }: any) { - return { - // eslint-disable-next-line camelcase - colorScheme: explore.controls?.color_scheme?.value, - vizType: explore.controls.viz_type.value, - }; -} - -const themedDrillActionConfigControl = withTheme(DatetimeControl); - -export default connect(mapStateToProps)(themedDrillActionConfigControl); diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/images/Table1.png b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/images/Table1.png deleted file mode 100644 index 1c9791782465..000000000000 Binary files a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/images/Table1.png and /dev/null differ diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/images/thumbnail.png b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/images/thumbnail.png deleted file mode 100644 index 23755b13f6e5..000000000000 Binary files a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/images/thumbnail.png and /dev/null differ diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/index.ts b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/index.ts deleted file mode 100644 index 7a3040d0f760..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/index.ts +++ /dev/null @@ -1,27 +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. - */ -// eslint-disable-next-line import/prefer-default-export -export { default as CccsDataSetExplorerPlugin } from './plugin'; -/** - * Note: this file exports the default export from CccsGrid.tsx. - * If you want to export multiple visualization modules, you will need to - * either add additional plugin folders (similar in structure to ./plugin) - * OR export multiple instances of `ChartPlugin` extensions in ./plugin/index.ts - * which in turn load exports from CccsGrid.tsx - */ diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/buildQuery.ts b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/buildQuery.ts deleted file mode 100644 index 7eaddb406799..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/buildQuery.ts +++ /dev/null @@ -1,250 +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 { - buildQueryContext, - ensureIsArray, - getMetricLabel, - PostProcessingRule, - QueryFormColumn, - QueryMode, - QueryObject, - removeDuplicates, -} from '@superset-ui/core'; -import { BuildQuery } from '@superset-ui/core/src/chart/registries/ChartBuildQueryRegistrySingleton'; -import { CccsGridQueryFormData, DEFAULT_FORM_DATA } from '../types'; -/** - * The buildQuery function is used to create an instance of QueryContext that's - * sent to the chart data endpoint. In addition to containing information of which - * datasource to use, it specifies the type (e.g. full payload, samples, query) and - * format (e.g. CSV or JSON) of the result and whether or not to force refresh the data from - * the datasource as opposed to using a cached copy of the data, if available. - * - * More importantly though, QueryContext contains a property `queries`, which is an array of - * QueryObjects specifying individual data requests to be made. A QueryObject specifies which - * columns, metrics and filters, among others, to use during the query. Usually it will be enough - * to specify just one query based on the baseQueryObject, but for some more advanced use cases - * it is possible to define post processing operations in the QueryObject, or multiple queries - * if a viz needs multiple different result sets. - */ -export function getQueryMode(formData: CccsGridQueryFormData) { - const { query_mode: mode } = formData; - if (mode === QueryMode.Aggregate || mode === QueryMode.Raw) { - return mode; - } - const rawColumns = formData?.all_columns; - const hasRawColumns = rawColumns && rawColumns.length > 0; - return hasRawColumns ? QueryMode.Raw : QueryMode.Aggregate; -} - -const isRange = (data: any) => { - const v = data.hasOwnProperty('start'); - return v; -}; - -const buildQuery: BuildQuery = ( - formData: CccsGridQueryFormData, - options: any, -) => { - const queryMode = getQueryMode(formData); - const sortByMetric = ensureIsArray(formData.timeseries_limit_metric)[0]; - let formDataCopy = { - ...formData, - ...DEFAULT_FORM_DATA, - }; - const { percent_metrics: percentMetrics, order_desc: orderDesc = false } = - formData; - // never include time in raw records mode - if (queryMode === QueryMode.Raw) { - formDataCopy = { - ...formData, - ...DEFAULT_FORM_DATA, - include_time: false, - }; - } - - formDataCopy.adhoc_filters = formData.adhoc_filters_no_date_default; - - return buildQueryContext(formDataCopy, baseQueryObject => { - let { metrics, orderby = [] } = baseQueryObject; - const postProcessing: PostProcessingRule[] = []; - - if (queryMode === QueryMode.Aggregate) { - metrics = metrics || []; - if (sortByMetric) { - orderby = [[sortByMetric, !orderDesc]]; - } else if (metrics?.length > 0) { - // default to ordering by first metric in descending order - orderby = [[metrics[0], false]]; - } - // add postprocessing for percent metrics only when in aggregation mode - if (percentMetrics && percentMetrics.length > 0) { - const percentMetricLabels = removeDuplicates( - percentMetrics.map(getMetricLabel), - ); - metrics = removeDuplicates( - metrics.concat(percentMetrics), - getMetricLabel, - ); - postProcessing.push({ - operation: 'contribution', - options: { - columns: percentMetricLabels as string[], - rename_columns: percentMetricLabels.map(x => `%${x}`), - }, - }); - } - } - - const moreProps: Partial = {}; - const ownState = options?.ownState ?? {}; - if (formDataCopy.server_pagination) { - moreProps.row_limit = - ownState.pageSize ?? formDataCopy.server_page_length; - moreProps.row_offset = - (ownState.currentPage ?? 0) * (ownState.pageSize ?? 0); - } - - const { datasource_config } = formData; - formDataCopy.datasource = datasource_config || formDataCopy.datasource; - - const { advanced_data_type_value } = formData; - const { advanced_data_type_selection } = formData; - let filter = []; - if (ensureIsArray(advanced_data_type_selection).length > 0) { - // in the case of ipv4s sometimes they can be ranges and not simple values - // this will be handled in the advanced data type definition in the future - // to avoid this complex logic - let simple: any[] = []; - let range: any[] = []; - advanced_data_type_value[0].data.map((d: any) => { - if (isRange(d)) { - range = [...range, d]; - } else { - simple = [...simple, d]; - } - return d; - }); - filter = advanced_data_type_value[0].columns.reduce( - (arr: string[], curr: string) => { - const new_arr = [ - ...arr, - ...range.map(r => `${curr} BETWEEN ${r.start} AND ${r.end}`), - ]; - return simple.length > 0 - ? new_arr.concat(`${curr} IN ('${simple.map((s: any) => `${s}`)}')`) - : new_arr; - }, - [], - ); - } - - // load the time range as a filter if it exists - if (baseQueryObject.granularity) { - baseQueryObject.filters?.push({ - col: baseQueryObject.granularity as QueryFormColumn, - op: 'TEMPORAL_RANGE', - val: baseQueryObject.time_range || '', - }); - } - - const baseQueryObjectCopy = baseQueryObject; - baseQueryObjectCopy.granularity = undefined; - - const queryObject = { - ...baseQueryObjectCopy, - formData: formDataCopy, - orderby, - metrics, - post_processing: postProcessing, - ...moreProps, - extras: { - ...baseQueryObject.extras, - where: filter.join(' OR '), - }, - }; - - // Because we use same buildQuery for all table on the page we need split them by id - options?.hooks?.setCachedChanges({ - [formData.slice_id]: queryObject.filters, - }); - - const extraQueries: QueryObject[] = []; - if ( - metrics?.length && - formData.show_totals && - queryMode === QueryMode.Aggregate - ) { - extraQueries.push({ - ...queryObject, - columns: [], - row_limit: 0, - row_offset: 0, - post_processing: [], - }); - } - - const interactiveGroupBy = formData.extra_form_data?.interactive_groupby; - if (interactiveGroupBy && queryObject.columns) { - queryObject.columns = [ - ...new Set([...queryObject.columns, ...interactiveGroupBy]), - ]; - } - - if (formData.server_pagination) { - return [ - { ...queryObject }, - { - ...queryObject, - row_limit: 0, - row_offset: 0, - post_processing: [], - is_rowcount: true, - }, - ...extraQueries, - ]; - } - - return [queryObject, ...extraQueries]; - }); -}; - -// Use this closure to cache changing of external filters, if we have server pagination we need reset page to 0, after -// external filter changed -export const cachedBuildQuery = (): BuildQuery => { - let cachedChanges: any = {}; - const setCachedChanges = (newChanges: any) => { - cachedChanges = { ...cachedChanges, ...newChanges }; - }; - - return (formData: any, options: any) => - buildQuery( - { ...formData }, - { - extras: { cachedChanges }, - ownState: options?.ownState ?? {}, - hooks: { - ...options?.hooks, - setDataMask: () => {}, - setCachedChanges, - }, - }, - ); -}; - -export default cachedBuildQuery(); diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/controlPanel.tsx b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/controlPanel.tsx deleted file mode 100644 index f830cdd57a43..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/controlPanel.tsx +++ /dev/null @@ -1,404 +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 { - t, - QueryMode, - ensureIsArray, - validateNonEmpty, -} from '@superset-ui/core'; -import { - Dataset, - ControlConfig, - ControlStateMapping, - ControlPanelConfig, - ControlPanelsContainerProps, - QueryModeLabel, - sharedControls, - ControlPanelState, - ControlState, - formatSelectOptions, - ColumnMeta, -} from '@superset-ui/chart-controls'; -import { StyledColumnOption } from 'src/explore/components/optionRenderers'; - -import { bootstrapData } from 'src/preamble'; -import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl'; -import ChangeDataSourceButton from '../components/controls/changeDatasourceButton'; -import AdvancedDataTypeValue from '../components/controls/advancedDataTypeValueControl'; -import DateTimeControl from '../components/controls/datetimeControl'; - -export const PAGE_SIZE_OPTIONS = formatSelectOptions([ - [0, t('page_size.all')], - 10, - 20, - 50, - 100, - 200, -]); - -function getQueryMode(controls: ControlStateMapping): QueryMode { - const mode = controls?.query_mode?.value; - if (mode === QueryMode.Aggregate || mode === QueryMode.Raw) { - return mode as QueryMode; - } - return QueryMode.Raw; -} - -/** - * Visibility check - */ -function isQueryMode(mode: QueryMode) { - return ({ controls }: Pick) => - getQueryMode(controls) === mode; -} - -const isAggMode = isQueryMode(QueryMode.Aggregate); -const isRawMode = isQueryMode(QueryMode.Raw); -const isTimeColumnSelected = ({ - controls, -}: Pick) => - controls.granularity_sqla && !!controls.granularity_sqla.value; - -const queryMode: ControlConfig<'RadioButtonControl'> = { - type: 'RadioButtonControl', - label: t('Query mode'), - default: QueryMode.Raw, - value: QueryMode.Raw, - options: [ - [QueryMode.Aggregate, QueryModeLabel[QueryMode.Aggregate]], - [QueryMode.Raw, QueryModeLabel[QueryMode.Raw]], - ], - mapStateToProps: ({ controls }) => ({ value: getQueryMode(controls) }), - rerender: ['columns', 'groupby'], -}; - -const config: ControlPanelConfig = { - // For control input types, see: superset-frontend/src/explore/components/controls/index.js - controlPanelSections: [ - { - label: t('Query'), - expanded: true, - controlSetRows: [ - [ - { - name: 'datasource_config', - config: { - type: ChangeDataSourceButton, - label: t('Jump Actions'), - description: t('Configure dashboard jump actions.'), - mapStateToProps: (state: ControlPanelState) => ({ - datasource: state.datasource, - }), - }, - }, - ], - [ - { - name: 'query_mode', - config: queryMode, - }, - ], - [ - { - name: 'granularity_sqla', - config: { - type: 'SelectControl', - label: 'Time Column', - description: t( - 'The time column for the visualization. Note that you ' + - 'can define arbitrary expression that return a DATETIME ' + - 'column in the table. Also note that the ' + - 'filter below is applied against this column or ' + - 'expression', - ), - clearable: false, - valueKey: 'column_name', - rerender: ['time_range'], - mapStateToProps: state => { - const props: any = {}; - if ( - state.datasource && - 'granularity_sqla' in state.datasource - ) { - props.options = state.datasource.columns - .filter(c => - ensureIsArray( - (state.datasource as Dataset)?.granularity_sqla, - ) - .map(g => g[0]) - .includes(c.column_name), - ) - .map(c => ({ - label: c.verbose_name ? c.verbose_name : c.column_name, - column_name: c.column_name, - })); - props.default = undefined; - if (state.datasource.main_dttm_col) { - props.default = state.datasource.main_dttm_col; - } else if (props.options && props.options.length > 0) { - props.default = props.options.column_name; - } - } - return props; - }, - }, - }, - ], - [ - { - name: 'time_range', - config: { - type: DateTimeControl, - label: t('Time Range'), - default: 'Today : Tomorrow', - resetOnHide: false, - mapStateToProps: (state: ControlPanelState) => { - const disabled = !isTimeColumnSelected(state); - return { disabled }; - }, - }, - }, - ], - [ - { - name: 'groupby', - config: { - type: 'SelectControl', - label: t('Dimensions'), - description: t('Columns to display'), - multi: true, - freeForm: true, - allowAll: true, - default: [], - canSelectAll: true, - rerender: ['advanced_data_type_selection'], - optionRenderer: (c: ColumnMeta) => ( - // eslint-disable-next-line react/react-in-jsx-scope - - ), - // eslint-disable-next-line react/react-in-jsx-scope - valueRenderer: (c: ColumnMeta) => ( - // eslint-disable-next-line react/react-in-jsx-scope - - ), - valueKey: 'column_name', - mapStateToProps: ( - state: ControlPanelState, - controlState: ControlState, - ) => { - const { controls } = state; - const originalMapStateToProps = - sharedControls?.groupby?.mapStateToProps; - const newState = - originalMapStateToProps?.(state, controlState) ?? {}; - newState.externalValidationErrors = - // @ts-ignore - isAggMode({ controls }) && - ensureIsArray(controlState.value).length === 0 - ? [t('must have a value')] - : []; - return newState; - }, - visibility: isAggMode, - canCopy: true, - }, - }, - ], - [ - { - name: 'columns', - config: { - type: 'SelectControl', - label: t('Dimensions'), - description: t('Columns to display'), - multi: true, - freeForm: true, - allowAll: true, - default: [], - canSelectAll: true, - rerender: ['advanced_data_type_selection'], - optionRenderer: (c: ColumnMeta) => ( - // eslint-disable-next-line react/react-in-jsx-scope - - ), - // eslint-disable-next-line react/react-in-jsx-scope - valueRenderer: (c: ColumnMeta) => ( - // eslint-disable-next-line react/react-in-jsx-scope - - ), - valueKey: 'column_name', - mapStateToProps: ( - state: ControlPanelState, - controlState: ControlState, - ) => { - const { controls } = state; - const originalMapStateToProps = - sharedControls?.columns?.mapStateToProps; - const newState = - originalMapStateToProps?.(state, controlState) ?? {}; - newState.externalValidationErrors = - // @ts-ignore - isRawMode({ controls }) && - ensureIsArray(controlState.value).length === 0 - ? [t('must have a value')] - : []; - return newState; - }, - visibility: isRawMode, - canCopy: true, - }, - }, - ], - [ - { - name: 'advanced_data_type_selection', - config: { - type: 'SelectControl', - label: t('Advanced Data Type'), - description: t( - 'The advanced data type used to filter the rows to display', - ), - multi: false, - rerender: ['advanced_data_type_value'], - default: [], - valueKey: 'value', - mapStateToProps: (state: ControlPanelState) => { - const options = state.datasource?.columns - ? bootstrapData?.common?.advanced_data_types - ?.filter(v => - (state.datasource as Dataset).columns.some( - c => c.advanced_data_type === v.id, - ), - ) - .map(v => ({ value: v.id, label: v.verbose_name })) - : []; - return { options }; - }, - resetOnHide: false, - }, - }, - ], - [ - { - name: 'advanced_data_type_value', - config: { - type: AdvancedDataTypeValue, - freeForm: true, - label: t('Values'), - description: t( - 'The value to be used along with the advanced data type to filter the rows to display', - ), - multi: true, - default: [], - resetOnHide: false, - mapStateToProps: ( - state: ControlPanelState, - controlState: ControlState, - ) => { - const { datasource } = state; - const advancedDataType = - state.controls?.advanced_data_type_selection?.value || ''; - const disabled = ensureIsArray(advancedDataType).length === 0; - const val: any = controlState.value; - const externalValidationErrors = - !disabled && ensureIsArray(val)[0]?.columns.length === 0 - ? [t('Must have a valid entry')] - : []; - return { - datasource, - advancedDataType, - disabled, - externalValidationErrors, - }; - }, - }, - }, - ], - [ - { - name: 'adhoc_filters_no_date_default', - config: { - type: AdhocFilterControl, - label: t('Filters'), - mapStateToProps(state, controlState, chartState) { - const { datasource } = state; - const columns = datasource?.columns; - return { datasource, columns }; - }, - }, - }, - ], - [ - { - name: 'order_by_cols', - config: { - type: 'SelectControl', - label: t('Ordering'), - description: t('Order results by selected columns'), - multi: true, - default: [], - mapStateToProps: ({ datasource }) => ({ - choices: datasource?.hasOwnProperty('order_by_choices') - ? (datasource as Dataset)?.order_by_choices - : datasource?.columns || [], - }), - resetOnHide: false, - }, - }, - ], - [ - { - name: 'row_limit', - override: { - label: t('Row Limit'), - default: 100, - }, - }, - ], - [ - { - name: 'column_state', - config: { - type: 'HiddenControl', - hidden: true, - label: t('Column state'), - description: t('State of AG Grid columns'), - dontRefreshOnChange: true, - }, - }, - ], - ], - }, - ], - // override controls that are inherited by the default configuration - controlOverrides: { - series: { - validators: [validateNonEmpty], - clearable: false, - }, - viz_type: { - default: 'cccs_grid', - }, - time_range: { - default: t('Last day'), - }, - }, -}; - -export default config; diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/index.ts b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/index.ts deleted file mode 100644 index 576c88d801a1..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/index.ts +++ /dev/null @@ -1,70 +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 { t, Behavior, ChartMetadata, ChartPlugin } from '@superset-ui/core'; -import buildQuery from './buildQuery'; -import controlPanel from './controlPanel'; -import transformProps from './transformProps'; -import thumbnail from '../images/thumbnail.png'; -import { CccsGridQueryFormData, CccsGridChartProps } from '../types'; -import example1 from '../images/Table1.png'; - -export default class CccsDataSetExplorerPlugin extends ChartPlugin< - CccsGridQueryFormData, - CccsGridChartProps -> { - /** - * The constructor is used to pass relevant metadata and callbacks that get - * registered in respective registries that are used throughout the library - * and application. A more thorough description of each property is given in - * the respective imported file. - * - * It is worth noting that `buildQuery` and is optional, and only needed for - * advanced visualizations that require either post processing operations - * (pivoting, rolling aggregations, sorting etc) or submitting multiple queries. - */ - constructor() { - const metadata = new ChartMetadata({ - description: t( - 'Dataset Explorer: An AG Grid control for adhoc data exploration.', - ), - name: t('Dataset Explorer'), - category: t('Table'), - tags: [ - t('Hogwarts'), - t('Table'), - t('Grid'), - t('Popular'), - t('Report'), - t('Tabular'), - ], - exampleGallery: [{ url: example1 }], - thumbnail, - behaviors: [Behavior.InteractiveChart], - }); - - super({ - buildQuery, - controlPanel, - loadChart: () => - import('../../../plugin-chart-ag-grid/src/ag-grid/AGGridViz'), - metadata, - transformProps, - }); - } -} diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/transformProps.ts b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/transformProps.ts deleted file mode 100644 index ba8126f5b370..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/plugin/transformProps.ts +++ /dev/null @@ -1,373 +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 { ValueFormatterParams } from 'ag-grid-enterprise'; -import { - Column, - GenericDataType, - getNumberFormatter, - Metric, - NumberFormats, - QueryMode, - TimeseriesDataRecord, -} from '@superset-ui/core'; -import { - formatIpv4, - rendererMap, -} from 'src/cccs-viz/plugins/plugin-chart-ag-grid/src/types/advancedDataTypes'; -import { - CccsGridChartProps, - CccsGridQueryFormData, - DEFAULT_FORM_DATA, -} from '../types'; - -export default function transformProps(chartProps: CccsGridChartProps) { - /** - * This function is called after a successful response has been - * received from the chart data endpoint, and is used to transform - * the incoming data prior to being sent to the Visualization. - * - * The transformProps function is also quite useful to return - * additional/modified props to your data viz component. The formData - * can also be accessed from your CccsGrid.tsx file, but - * supplying custom props here is often handy for integrating third - * party libraries that rely on specific props. - * - * A description of properties in `chartProps`: - * - `height`, `width`: the height/width of the DOM element in which - * the chart is located - * - `formData`: the chart data request payload that was sent to the - * backend. - * - `queriesData`: the chart data response payload that was received - * from the backend. Some notable properties of `queriesData`: - * - `data`: an array with data, each row with an object mapping - * the column/alias to its value. Example: - * `[{ col1: 'abc', metric1: 10 }, { col1: 'xyz', metric1: 20 }]` - * - `rowcount`: the number of rows in `data` - * - `query`: the query that was issued. - * - * Please note: the transformProps function gets cached when the - * application loads. When making changes to the `transformProps` - * function during development with hot reloading, changes won't - * be seen until restarting the development server. - */ - const { - datasource, - hooks, - width, - height, - rawFormData: formData, - queriesData, - } = chartProps; - const { - boldText, - headerFontSize, - headerText, - principalColumns, - query_mode, - column_state, - }: CccsGridQueryFormData = { ...DEFAULT_FORM_DATA, ...formData }; - const data = queriesData[0].data as TimeseriesDataRecord[]; - const agGridLicenseKey = queriesData[0].agGridLicenseKey as String; - - const default_group_by: any[] = []; - const enable_row_numbers = true; - const jump_action_configs: string[] = []; - const enable_json_expand = false; - - const include_search = true; - const page_length = 50; - const enable_grouping = true; - - const { setDataMask = () => {}, setControlValue } = hooks; - const columns = datasource?.columns as Column[]; - const metrics = datasource?.metrics as Metric[]; - - const columnTypeMap = new Map(); - columns.reduce(function (columnMap, column: Column) { - const newColumnMap = { ...columnMap }; - // @ts-ignore - const name = column.column_name; - // @ts-ignore - newColumnMap[name] = column.type; - return newColumnMap; - }, columnTypeMap); - - // Map of column advanced types, key is column name, value is column type - const columnAdvancedTypeMap = new Map(); - columns.reduce(function (columnMap, column: Column) { - const newColumnMap = { ...columnMap }; - // @ts-ignore - const name = column.column_name; - // @ts-ignore - newColumnMap[name] = ( - (column.advanced_data_type as string) ?? '' - ).toUpperCase(); - return newColumnMap; - }, columnAdvancedTypeMap); - - // Map of verbose names, key is column name, value is verbose name - const columnVerboseNameMap = new Map(); - columns.reduce(function (columnMap, column: Column) { - const newColumnMap = { ...columnMap }; - // @ts-ignore - const name = column.column_name; - // @ts-ignore - newColumnMap[name] = column.verbose_name; - return newColumnMap; - }, columnVerboseNameMap); - - // Map of column descriptions, key is column name, value is the description - const columnDescriptionMap = new Map(); - columns.reduce(function (columnMap, column: Column) { - const newColumnMap = { ...columnMap }; - const name = column.column_name; - newColumnMap[name] = column.description; - return newColumnMap; - }, columnDescriptionMap); - - // Map of verbose names, key is metric name, value is verbose name - const metricVerboseNameMap = new Map(); - metrics.reduce(function (metricMap, metric: Metric) { - const newMetricMap = { ...metricMap }; - // @ts-ignore - const name = metric.metric_name; - // @ts-ignore - newMetricMap[name] = metric.verbose_name; - return newMetricMap; - }, metricVerboseNameMap); - - const valueFormatter = (params: any) => { - if ( - params.value != null && - params.colDef.cellRenderer === 'ipv4ValueRenderer' - ) { - return formatIpv4(params.value.toString()); - } - return params.value != null ? params.value.toString() : ''; - }; - - let columnDefs: Column[] = []; - - const columnDataMap = columns.reduce( - (columnMap, column: Column) => ({ - ...columnMap, - [column.column_name]: { - type: column.type, - is_dttm: column.is_dttm, - type_generic: column.type_generic, - advanced_data_type: (column.advanced_data_type as string) ?? '', - verbose_name: column.verbose_name, - description: column.description, - }, - }), - {} as { [index: string]: Partial }, - ); - - if (query_mode === QueryMode.Raw) { - columnDefs = formData.columns.map((column: any) => { - const columnType = columnDataMap[column]?.type || ''; - const isDate = !!columnDataMap[column]?.is_dttm; - const columnTypeGeneric = columnDataMap[column]?.type_generic || -1; - const columnAdvancedType = - columnDataMap[column]?.advanced_data_type || ''; - const columnHeader = columnDataMap[column]?.verbose_name - ? columnDataMap[column]?.verbose_name - : column; - const cellRenderer = - isDate || columnTypeGeneric === GenericDataType.Temporal - ? rendererMap.DATE - : rendererMap[columnAdvancedType.toUpperCase()] ?? - rendererMap[columnType] ?? - undefined; - const isSortable = true; - const enableRowGroup = true; - const columnDescription = columnDescriptionMap[column]; - const autoHeight = true; - const rowGroupIndex = default_group_by.findIndex( - (element: any) => element === column, - ); - const rowGroup = rowGroupIndex >= 0; - const hide = rowGroup; - return { - field: column, - headerName: columnHeader, - cellRenderer, - sortable: isSortable, - enableRowGroup, - rowGroup, - hide, - rowGroupIndex, - getQuickFilterText: (params: any) => valueFormatter(params), - headerTooltip: columnDescription, - autoHeight, - }; - }); - } else { - if (formData.groupby) { - const groupByColumnDefs = formData.groupby.map((column: any) => { - const columnType = columnTypeMap[column]; - const columnAdvancedType = columnAdvancedTypeMap[column]; - const columnHeader = columnVerboseNameMap[column] - ? columnVerboseNameMap[column] - : column; - const cellRenderer = - columnAdvancedType in rendererMap - ? rendererMap[columnAdvancedType] - : columnType in rendererMap - ? rendererMap[columnType] - : undefined; - const isSortable = true; - const enableRowGroup = true; - const columnDescription = columnDescriptionMap[column]; - const autoHeight = true; - const rowGroupIndex = default_group_by.findIndex( - (element: any) => element === column, - ); - const initialRowGroupIndex = rowGroupIndex; - const rowGroup = rowGroupIndex >= 0; - const hide = rowGroup; - return { - field: column, - headerName: columnHeader, - cellRenderer, - sortable: isSortable, - enableRowGroup, - rowGroup, - rowGroupIndex, - initialRowGroupIndex, - hide, - getQuickFilterText: (params: any) => valueFormatter(params), - headerTooltip: columnDescription, - autoHeight, - }; - }); - columnDefs = columnDefs.concat(groupByColumnDefs); - } - - const percentMetricValueFormatter = function ( - params: ValueFormatterParams, - ) { - return getNumberFormatter(NumberFormats.PERCENT_3_POINT).format( - params.value, - ); - }; - - if (metrics) { - const metricsColumnDefs = formData.metrics?.map((metric: any) => { - const metricLabel = metric.label ? metric.label : metric; - const metricHeader = metricVerboseNameMap[metric] - ? metricVerboseNameMap[metric] - : metricLabel; - return { - field: metricLabel, - headerName: metricHeader, - sortable: true, - enableRowGroup: true, - }; - }); - columnDefs = columnDefs.concat(metricsColumnDefs || []); - } - - if (formData.percent_metrics) { - const percentMetricsColumnDefs = formData.percent_metrics.map( - (metric: any) => { - const metricLabel = metric.label ? metric.label : metric; - const metricHeader = metricVerboseNameMap[metric] - ? metricVerboseNameMap[metric] - : metricLabel; - return { - field: `%${metricLabel}`, - headerName: `%${metricHeader}`, - sortable: true, - valueFormatter: percentMetricValueFormatter, - }; - }, - ); - columnDefs = columnDefs.concat(percentMetricsColumnDefs); - } - } - - if (enable_row_numbers) { - columnDefs.splice(0, 0, { - headerName: '#', - colId: 'rowNum', - pinned: 'left', - lockVisible: true, - valueGetter: (params: any) => - params.node ? params.node.rowIndex + 1 : null, - } as any); - } - const parsed_jump_action_configs = {}; - jump_action_configs?.forEach((e: any) => { - if (e.dashboardID in parsed_jump_action_configs) { - parsed_jump_action_configs[e.dashboardID] = parsed_jump_action_configs[ - e.dashboardID - ].concat({ - advancedDataType: e.advancedDataType, - nativefilters: e.filters, - name: e.dashBoardName, - }); - } else { - parsed_jump_action_configs[e.dashboardID] = [ - { - advancedDataType: e.advancedDataType, - nativefilters: e.filters, - name: e.dashBoardName, - }, - ]; - } - }); - - // If the flag is set to true, add a column which will contain - // a button to expand all JSON blobs in the row - if (enable_json_expand) { - columnDefs.splice(1, 0, { - colId: 'jsonExpand', - pinned: 'left', - cellRenderer: 'expandAllValueRenderer', - autoHeight: true, - minWidth: 105, - lockVisible: true, - } as any); - } - - return { - formData, - setDataMask, - setControlValue, - width, - height, - columnDefs, - rowData: data, - // and now your control data, manipulated as needed, and passed through as props! - boldText, - headerFontSize, - headerText, - emitFilter: true, - emitCrossFilters: true, - principalColumns, - include_search, - page_length, - enable_grouping, - column_state, - agGridLicenseKey, - datasetColumns: columns, - jumpActionConfigs: parsed_jump_action_configs, - }; -} diff --git a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/types.ts b/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/types.ts deleted file mode 100644 index 0a81dc8f7f03..000000000000 --- a/superset-frontend/src/cccs-viz/plugins/plugin-chart-dataset-explorer/src/types.ts +++ /dev/null @@ -1,103 +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 { ColumnState } from 'ag-grid-enterprise'; -import { - ChartDataResponseResult, - ChartProps, - HandlerFunction, - QueryFormData, - SetDataMaskHook, - supersetTheme, - TimeseriesDataRecord, - Column, - AdhocFilter, -} from '@superset-ui/core'; - -export type CccsGridQueryFormData = QueryFormData & { - headerText?: string; - setDataMask?: SetDataMaskHook; - selectedValues?: Record; - emitFilter: boolean; - include_search: boolean; - page_length: number; - enable_grouping: boolean; - column_state: ColumnState[]; - enable_row_numbers: boolean; - jump_action_configs?: any[]; - datasource_config?: string; - advanced_data_type_selection: string[]; - advanced_data_type_value: { - columns: string[]; - data: string[]; - rawData: string[]; - }; - adhoc_filters_no_date_default: AdhocFilter[]; -}; - -export interface CccsGridStylesProps { - height: number; - width: number; - headerFontSize?: keyof typeof supersetTheme.typography.sizes; - boldText?: boolean; -} - -// @ts-ignore -export const DEFAULT_FORM_DATA: CccsGridQueryFormData = { - result_type: 'post_processed', - viz_type: 'cccs_grid', -}; - -export interface CccsGridChartDataResponseResult - extends ChartDataResponseResult { - agGridLicenseKey: string; -} - -export class CccsGridChartProps extends ChartProps { - declare formData: CccsGridQueryFormData; - - declare queriesData: CccsGridChartDataResponseResult[]; -} - -export interface CccsGridTransformedProps extends CccsGridStylesProps { - formData: CccsGridQueryFormData; - setDataMask: SetDataMaskHook; - setControlValue: HandlerFunction; - selectedValues: Record; - emitFilter: boolean; - principalColumns: any; - data: TimeseriesDataRecord[]; - columnDefs: any; - rowData: any; - tooltipShowDelay: any; - frameworkComponents: any; - modules: any; - defaultColDef: any; - rowSelection: any; - filters: any; - include_search: boolean; - page_length: number; - enable_grouping: boolean; - column_state: ColumnState[]; - // add typing here for the props you pass in from transformProps.ts! - agGridLicenseKey: string; - datasetColumns: Column[]; - jumpActionConfigs?: any[]; -} - -export type EventHandlers = Record; diff --git a/superset-frontend/src/visualizations/presets/MainPreset.js b/superset-frontend/src/visualizations/presets/MainPreset.js index 87f3382a6cf9..9a90dbc3b096 100644 --- a/superset-frontend/src/visualizations/presets/MainPreset.js +++ b/superset-frontend/src/visualizations/presets/MainPreset.js @@ -73,7 +73,6 @@ import { } from '@superset-ui/plugin-chart-echarts'; import { CccsTableChartPlugin, - DatasetExplorerChartPlugin, EmailRendererChartPlugin, IFrameVisualizationChartPlugin, JSONViewChartPlugin, @@ -113,7 +112,6 @@ export default class MainPreset extends Preset { new IFrameVisualizationChartPlugin().configure({ key: 'i_frame' }), new EmailRendererChartPlugin().configure({ key: 'email' }), new JSONViewChartPlugin().configure({ key: 'json_view' }), - new DatasetExplorerChartPlugin().configure({ key: 'dataset_explorer' }), new CccsTableChartPlugin().configure({ key: 'cccs_grid' }), new AreaChartPlugin().configure({ key: 'area' }), new BarChartPlugin().configure({ key: 'bar' }),