From 1753e7d16edd02c0cb31e8ec2c093d0e4fe5daf1 Mon Sep 17 00:00:00 2001 From: Ajay Mancheery Date: Wed, 6 Oct 2021 14:23:07 -0400 Subject: [PATCH 1/7] Adding description works --- .../spec/fixtures/mockNativeFilters.ts | 2 + .../dashboard/fixtures/mockNativeFilters.ts | 1 + .../FiltersConfigForm/FiltersConfigForm.tsx | 79 ++++++++++--------- .../getControlItemsMap.test.tsx | 1 + .../nativeFilters/FiltersConfigModal/types.ts | 1 + .../nativeFilters/FiltersConfigModal/utils.ts | 1 + .../components/nativeFilters/types.ts | 1 + 7 files changed, 50 insertions(+), 36 deletions(-) diff --git a/superset-frontend/spec/fixtures/mockNativeFilters.ts b/superset-frontend/spec/fixtures/mockNativeFilters.ts index 6da3a3561df3e..30bf3d85120ef 100644 --- a/superset-frontend/spec/fixtures/mockNativeFilters.ts +++ b/superset-frontend/spec/fixtures/mockNativeFilters.ts @@ -52,6 +52,7 @@ export const nativeFilters: NativeFiltersState = { inverseSelection: false, }, type: NativeFilterType.NATIVE_FILTER, + description: '', }, 'NATIVE_FILTER-x9QPw0so1': { id: 'NATIVE_FILTER-x9QPw0so1', @@ -81,6 +82,7 @@ export const nativeFilters: NativeFiltersState = { inverseSelection: false, }, type: NativeFilterType.NATIVE_FILTER, + description: '2 letter code', }, }, }; diff --git a/superset-frontend/spec/javascripts/dashboard/fixtures/mockNativeFilters.ts b/superset-frontend/spec/javascripts/dashboard/fixtures/mockNativeFilters.ts index 1a309fdfc1a33..f4ab60dc57137 100644 --- a/superset-frontend/spec/javascripts/dashboard/fixtures/mockNativeFilters.ts +++ b/superset-frontend/spec/javascripts/dashboard/fixtures/mockNativeFilters.ts @@ -68,6 +68,7 @@ export const nativeFiltersInfo: NativeFiltersState = { isRequired: false, }, type: NativeFilterType.NATIVE_FILTER, + description: '', }, }, }; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx index a4caf6bf89faf..35a3811b0a3ea 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx @@ -16,6 +16,11 @@ * specific language governing permissions and limitations * under the License. */ +import { + ColumnMeta, + InfoTooltipWithTrigger, + Metric, +} from '@superset-ui/chart-controls'; import { AdhocFilter, Behavior, @@ -26,15 +31,11 @@ import { JsonResponse, styled, SupersetApiError, - t, SupersetClient, + t, } from '@superset-ui/core'; -import { - ColumnMeta, - InfoTooltipWithTrigger, - Metric, -} from '@superset-ui/chart-controls'; import { FormInstance } from 'antd/lib/form'; +import { isEmpty, isEqual } from 'lodash'; import React, { forwardRef, useCallback, @@ -44,53 +45,52 @@ import React, { useState, } from 'react'; import { useSelector } from 'react-redux'; -import { isEqual, isEmpty } from 'lodash'; -import { FormItem } from 'src/components/Form'; -import { Input } from 'src/common/components'; +import { getChartDataRequest } from 'src/chart/chartAction'; +import { Input, TextArea } from 'src/common/components'; import { Select } from 'src/components'; -import { cacheWrapper } from 'src/utils/cacheWrapper'; -import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl'; -import DateFilterControl from 'src/explore/components/controls/DateFilterControl'; -import { addDangerToast } from 'src/components/MessageToasts/actions'; -import { ClientErrorObject } from 'src/utils/getClientErrorObject'; import Collapse from 'src/components/Collapse'; -import { getChartDataRequest } from 'src/chart/chartAction'; -import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; -import { waitForAsyncData } from 'src/middleware/asyncEvent'; -import Tabs from 'src/components/Tabs'; +import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert'; +import { FormItem } from 'src/components/Form'; import Icons from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; +import Loading from 'src/components/Loading'; +import { addDangerToast } from 'src/components/MessageToasts/actions'; import { Radio } from 'src/components/Radio'; -import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert'; +import Tabs from 'src/components/Tabs'; +import { Tooltip } from 'src/components/Tooltip'; import { Chart, ChartsState, DatasourcesState, RootState, } from 'src/dashboard/types'; -import Loading from 'src/components/Loading'; +import DateFilterControl from 'src/explore/components/controls/DateFilterControl'; +import AdhocFilterControl from 'src/explore/components/controls/FilterControl/AdhocFilterControl'; +import { FeatureFlag, isFeatureEnabled } from 'src/featureFlags'; +import { waitForAsyncData } from 'src/middleware/asyncEvent'; +import { cacheWrapper } from 'src/utils/cacheWrapper'; +import { ClientErrorObject } from 'src/utils/getClientErrorObject'; +import { Filter, NativeFilterType } from '../../types'; +import { getFormData } from '../../utils'; +import { + CASCADING_FILTERS, + getFiltersConfigModalTestId, +} from '../FiltersConfigModal'; +import { FilterRemoval, NativeFiltersForm } from '../types'; +import { CollapsibleControl } from './CollapsibleControl'; import { ColumnSelect } from './ColumnSelect'; -import { NativeFiltersForm, FilterRemoval } from '../types'; +import DatasetSelect from './DatasetSelect'; +import DefaultValue from './DefaultValue'; +import FilterScope from './FilterScope/FilterScope'; +import getControlItemsMap from './getControlItemsMap'; +import RemovedFilter from './RemovedFilter'; +import { useBackendFormUpdate, useDefaultValue } from './state'; import { FILTER_SUPPORTED_TYPES, hasTemporalColumns, + mostUsedDataset, setNativeFilterFieldValues, useForceUpdate, - mostUsedDataset, } from './utils'; -import { useBackendFormUpdate, useDefaultValue } from './state'; -import { getFormData } from '../../utils'; -import { Filter, NativeFilterType } from '../../types'; -import getControlItemsMap from './getControlItemsMap'; -import FilterScope from './FilterScope/FilterScope'; -import RemovedFilter from './RemovedFilter'; -import DefaultValue from './DefaultValue'; -import { CollapsibleControl } from './CollapsibleControl'; -import { - CASCADING_FILTERS, - getFiltersConfigModalTestId, -} from '../FiltersConfigModal'; -import DatasetSelect from './DatasetSelect'; const { TabPane } = Tabs; @@ -931,6 +931,13 @@ const FiltersConfigForm = ( {Object.keys(controlItems) .filter(key => BASIC_CONTROL_ITEMS.includes(key)) .map(key => controlItems[key].element)} + {t('Description')}} + > +