From fce3de19a038f7a280b16efc42e05f271e2698ae Mon Sep 17 00:00:00 2001 From: Ajay Mancheery Date: Thu, 14 Oct 2021 13:32:10 -0400 Subject: [PATCH] Fix warnings --- .../FilterBar/FilterControls/FilterControls.tsx | 7 +++++-- .../nativeFilters/FiltersConfigModal/DraggableFilter.tsx | 9 ++++++--- .../FiltersConfigModal/FilterTitleContainer.tsx | 4 ++-- .../FiltersConfigForm/FiltersConfigForm.tsx | 2 +- .../FiltersConfigModal/FiltersConfigModal.tsx | 4 ++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx index 134f8d240f6eb..7ff084425f7eb 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx @@ -26,8 +26,11 @@ import { } from 'react-reverse-portal'; import { Collapse } from 'src/common/components'; import { DataMaskStateWithId } from 'src/dataMask/types'; -import { useDashboardHasTabs, useSelectFiltersInScope } from '../../state'; -import { Filter } from '../../types'; +import { + useDashboardHasTabs, + useSelectFiltersInScope, +} from 'src/dashboard/components/nativeFilters/state'; +import { Filter } from 'src/dashboard/components/nativeFilters/types'; import CascadePopover from '../CascadeFilters/CascadePopover'; import { useFilters } from '../state'; import { buildCascadeFiltersTree } from './utils'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx index 9e86a685a6528..dbaba821c84b8 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx @@ -30,6 +30,7 @@ import Icons, { IconType } from 'src/components/Icons'; interface TitleContainerProps { readonly isDragging: boolean; } + const FILTER_TYPE = 'FILTER'; const Container = styled.div` @@ -39,16 +40,18 @@ const Container = styled.div` width: 100%; display: flex; padding: ${theme.gridUnit}px -`} + `} `; -const DragIcon = styled(Icons.Drag)` +const DragIcon = styled(Icons.Drag, { + shouldForwardProp: propName => propName !== 'isDragging', +})` ${({ isDragging, theme }) => ` font-size: ${theme.typography.sizes.m}px; margin-top: 15px; cursor: ${isDragging ? 'grabbing' : 'grab'}; padding-left: ${theme.gridUnit}px; -`} + `} `; interface FilterTabTitleProps { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx index 1f6f233ec14fd..daaee69dc1cb6 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx @@ -42,10 +42,10 @@ const FilterTitle = styled.div` color: ${theme.colors.primary.light1}; } } - &.errored div, &.errored .warning{ + &.errored div, &.errored .warning { color: ${theme.colors.error.base}; } -`} + `} `; const StyledTrashIcon = styled(Icons.Trash)` 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 5b550d3a51d40..5f496b3fb04d1 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx @@ -102,7 +102,7 @@ const StyledContainer = styled.div` flex-direction: row-reverse; justify-content: space-between; padding: 0px ${theme.gridUnit * 4}px; -`} + `} `; const StyledRowContainer = styled.div` diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx index 58cc02d206a60..caeefa7ba0ba7 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx @@ -214,12 +214,12 @@ export function FiltersConfigModal({ setRemovedFilters({}); setSaveAlertVisible(false); setFormValues({ filters: {} }); + setErroredFilters([]); if (!isSaving) { setOrderedFilters(buildFilterGroup(getInitialFilterHierarchy())); + form.resetFields(); } - form.resetFields(); form.setFieldsValue({ changed: false }); - setErroredFilters([]); }; const getFilterTitle = (id: string) =>