Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [WIP] Screwing around with improving the UI to add/manage filters... #24951

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@
},
});
drag(drop(ref));

//this is gross... we should pass in the filter/divider type, rather than inferring from the generated ID.

Check failure on line 134 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Expected exception block, space or tab after '//' in comment
const filterIcon = filterIds[0].split('-')[0] == "NATIVE_FILTER" ? <Icons.FilterSmall /> : <Icons.BorderVerticleOutlined />;

Check failure on line 135 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Replace `·filterIds[0].split('-')[0]·==·"NATIVE_FILTER"·?·<Icons.FilterSmall·/>·:·<Icons.BorderVerticleOutlined·/>` with `⏎····filterIds[0].split('-')[0]·==·'NATIVE_FILTER'·?·(⏎······<Icons.FilterSmall·/>⏎····)·:·(⏎······<Icons.BorderVerticleOutlined·/>⏎····)`

Check failure on line 135 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Expected '===' and instead saw '=='

return (
<Container ref={ref} isDragging={isDragging}>
<DragIcon
Expand All @@ -138,6 +142,7 @@
className="dragIcon"
viewBox="4 4 16 16"
/>
{filterIcon}
<div css={{ flex: 1 }}>{children}</div>
</Container>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
import { useRef, FC } 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';

Expand Down Expand Up @@ -58,7 +60,7 @@
{ label: t('Divider'), type: NativeFilterType.Divider },
];

const FilterTitlePane: FC<Props> = ({
const FilterTitlePane: React.FC<Props> = ({
getFilterTitle,
onChange,
onAdd,
Expand Down Expand Up @@ -89,27 +91,30 @@
}, 0);
};
const menu = (
<Menu mode="horizontal">
{options.map(item => (
<Menu.Item onClick={() => handleOnAdd(item.type)}>
{item.label}
</Menu.Item>
))}
</Menu>
<MainNav mode="horizontal">
<MainNav.Item onClick={() => handleOnAdd(NativeFilterType.DIVIDER)}>

Check failure on line 95 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Delete `··`
{t('Add Divider')}

Check failure on line 96 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Delete `····`
</MainNav.Item>

Check failure on line 97 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Delete `··`
</MainNav>
);

const StyledDropdownButton = styled(
DropdownButton as React.FC<DropdownButtonProps>,
)`
padding: ${theme.gridUnit * 2}px ${theme.gridUnit * 4}px;
`;

return (
<TabsContainer>
<AntdDropdown
<StyledDropdownButton
overlay={menu}
arrow
placement="topLeft"
trigger={['hover']}
icon={<Icons.CaretDown />}
>
<StyledAddBox>
<div data-test="new-dropdown-icon" className="fa fa-plus" />{' '}
<span>{t('Add filters and dividers')}</span>
</StyledAddBox>
</AntdDropdown>
<span onClick={() => handleOnAdd(NativeFilterType.NATIVE_FILTER)}>

Check failure on line 114 in superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx

View workflow job for this annotation

GitHub Actions / frontend-build

Static HTML elements with event handlers require a role
{t('Add Filter')}
</span>
</StyledDropdownButton>
<div
css={{
height: '100%',
Expand Down
Loading