From e1b6ee514ef565a724d16bb48887809d25ed3e3a Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 10 Aug 2023 10:51:01 -0600 Subject: [PATCH] take 1 --- .../FiltersConfigModal/DraggableFilter.tsx | 5 +++ .../FiltersConfigModal/FilterTitlePane.tsx | 44 +++++++++---------- superset/config.py | 2 +- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx index 556e3ed32df7b..1fdd2328a9cd9 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx @@ -130,6 +130,10 @@ export const DraggableFilter: React.FC = ({ }, }); drag(drop(ref)); + + //this is gross... we should pass in the filter/divider type, rather than inferring from the generated ID. + const filterIcon = filterIds[0].split('-')[0] == "NATIVE_FILTER" ? : ; + return ( = ({ className="dragIcon" viewBox="4 4 16 16" /> + {filterIcon}
{children}
); diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx index a080d35645131..dd978d34955d1 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx @@ -18,8 +18,10 @@ */ import React, { useRef } from 'react'; import { NativeFilterType, styled, t, useTheme } from '@superset-ui/core'; -import { AntdDropdown } from 'src/components'; -import { MainNav as Menu } from 'src/components/Menu'; +import { DropdownButton } from 'src/components/DropdownButton'; +import { DropdownButtonProps } from 'antd/lib/dropdown'; +import Icons from 'src/components/Icons'; +import { MainNav } from 'src/components/Menu'; import FilterTitleContainer from './FilterTitleContainer'; import { FilterRemoval } from './types'; @@ -52,11 +54,6 @@ const TabsContainer = styled.div` flex-direction: column; `; -const options = [ - { label: t('Filter'), type: NativeFilterType.NATIVE_FILTER }, - { label: t('Divider'), type: NativeFilterType.DIVIDER }, -]; - const FilterTitlePane: React.FC = ({ getFilterTitle, onChange, @@ -88,27 +85,30 @@ const FilterTitlePane: React.FC = ({ }, 0); }; const menu = ( - - {options.map(item => ( - handleOnAdd(item.type)}> - {item.label} - - ))} - + + handleOnAdd(NativeFilterType.DIVIDER)}> + {t('Add Divider')} + + ); + + const StyledDropdownButton = styled( + DropdownButton as React.FC, + )` + padding: ${theme.gridUnit * 2}px ${theme.gridUnit * 4}px; + `; + return ( - } > - -
{' '} - {t('Add filters and dividers')} - - + handleOnAdd(NativeFilterType.NATIVE_FILTER)}> + {t('Add Filter')} + +