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(filter-set): Filter set edge cases #13576

Merged
merged 81 commits into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
2731518
refactor(native-filters): move data mask to root reducer
simcha90 Mar 3, 2021
de6a332
Merge branch 'master' of github.com:apache/superset into filtersState…
simcha90 Mar 3, 2021
6652d19
refactor: update rest stuff for dataMask
simcha90 Mar 3, 2021
266a0a3
refactor: add ownCrrentState to explore
simcha90 Mar 3, 2021
5344dd4
fix: fix immer reducer
simcha90 Mar 4, 2021
2b4bd8f
Merge branch 'master' of github.com:apache/superset into filtersState…
simcha90 Mar 4, 2021
dabfd24
fix: merge with master
simcha90 Mar 4, 2021
802823c
refactor: support explore dataMask
simcha90 Mar 4, 2021
8aed240
refactor: support explore dataMask
simcha90 Mar 4, 2021
a0fa114
docs: add comment
simcha90 Mar 4, 2021
eaec7ef
refactor: remove json stringify
simcha90 Mar 4, 2021
cba3467
fix: fix failed cases
simcha90 Mar 4, 2021
04d6398
feat: filter bat buttons start
simcha90 Mar 4, 2021
af9e35a
fix: fix CR notes
simcha90 Mar 4, 2021
64fb87d
fix: fix cascade filters
simcha90 Mar 4, 2021
57c954f
fix: fix CR notes
simcha90 Mar 4, 2021
bd9b767
Merge branch 'filtersState_to_data_mask' of github.com:simchaNielsen/…
simcha90 Mar 4, 2021
bff44d1
refactor: add clear all
simcha90 Mar 7, 2021
09b594a
fix: fix CR notes
simcha90 Mar 7, 2021
c522391
Merge branch 'master' of github.com:apache/superset into filtersState…
simcha90 Mar 7, 2021
1bf1552
Merge branch 'filtersState_to_data_mask' of github.com:simchaNielsen/…
simcha90 Mar 7, 2021
0527067
fix: fix CR notes
simcha90 Mar 7, 2021
9abe26e
Merge branch 'filtersState_to_data_mask' of github.com:simchaNielsen/…
simcha90 Mar 7, 2021
2d12c37
fix: fix CR notes
simcha90 Mar 7, 2021
84d8cbd
Merge branch 'filtersState_to_data_mask' of github.com:simchaNielsen/…
simcha90 Mar 7, 2021
a9202b1
feat: buttons in filter bar
simcha90 Mar 7, 2021
9ae46b9
Merge branch 'master' of github.com:apache/superset into filter_bar_a…
simcha90 Mar 7, 2021
cdcae95
lint: update imports
simcha90 Mar 7, 2021
6c91054
feat: add tabs for filter sets
simcha90 Mar 7, 2021
844adaa
Merge branch 'master' of github.com:apache/superset into filter-set_tabs
simcha90 Mar 7, 2021
93e5d97
Merge branch 'master' of github.com:apache/superset into filter-set_tabs
simcha90 Mar 7, 2021
04259c2
feat: add buttons to filter set
simcha90 Mar 7, 2021
c053836
Merge branch 'master' of github.com:apache/superset into filter_set_d…
simcha90 Mar 7, 2021
26a0f28
feat: first phase add filter sets
simcha90 Mar 8, 2021
60b1374
fix: undo FF
simcha90 Mar 8, 2021
7985f5d
refactor: continue filter sets
simcha90 Mar 8, 2021
6671c1d
Merge branch 'master' of github.com:apache/superset into filter_set_d…
simcha90 Mar 8, 2021
3af62be
fix: fix CR notes
simcha90 Mar 8, 2021
d7e6b23
Merge branch 'filter_set_design' of github.com:simchaNielsen/incubato…
simcha90 Mar 8, 2021
038e5cc
refactor: header
simcha90 Mar 8, 2021
c7a9849
fix: fix CR notes
simcha90 Mar 8, 2021
d47a1ea
fix: fix CR notes
simcha90 Mar 8, 2021
02800d9
Merge branch 'filter_set_design' of github.com:simchaNielsen/incubato…
simcha90 Mar 8, 2021
4182f51
refactor: continue filter sets
simcha90 Mar 8, 2021
68e32d8
lint: fix lint
simcha90 Mar 8, 2021
f0904de
Merge branch 'filter_set_design' of github.com:simchaNielsen/incubato…
simcha90 Mar 8, 2021
eb8e9b9
refactor: continue filter sets
simcha90 Mar 9, 2021
bdbd0f9
fix: fix filter bar opening
simcha90 Mar 9, 2021
18d39bb
Merge branch 'filter_set_design' of github.com:simchaNielsen/incubato…
simcha90 Mar 9, 2021
33adb45
refactor: continue filter sets
simcha90 Mar 9, 2021
cc82b6a
Merge branch 'master' of github.com:apache/superset into filter_set_d…
simcha90 Mar 9, 2021
8bd69ed
Merge branch 'filter_set_design' of github.com:simchaNielsen/incubato…
simcha90 Mar 9, 2021
376386b
refactor: continue filter sets
simcha90 Mar 9, 2021
db7eccb
refactor: continue filter sets
simcha90 Mar 9, 2021
5d6d39e
Merge branch 'master' of github.com:apache/superset into filter_set_d…
simcha90 Mar 9, 2021
33e182d
feat: filters sets history
simcha90 Mar 9, 2021
5fa0e07
feat: filters sets history
simcha90 Mar 9, 2021
7539f03
fix: filter set name
simcha90 Mar 9, 2021
d887995
refactor: fix expand filters case
simcha90 Mar 9, 2021
a6884a2
Merge branch 'master' of github.com:apache/superset into filter_set_d…
simcha90 Mar 9, 2021
01439b6
fix: fix CR notes
simcha90 Mar 9, 2021
c075d9a
refactor: filter sets
simcha90 Mar 9, 2021
52a66aa
refactor: filter sets
simcha90 Mar 10, 2021
0ee5881
Merge branch 'filter_set_design_2' of github.com:simchaNielsen/incuba…
simcha90 Mar 10, 2021
27c0ca1
refactor: filter sets
simcha90 Mar 10, 2021
34b26b6
refactor: filter sets
simcha90 Mar 10, 2021
a21a394
refactor: update sets
simcha90 Mar 10, 2021
041fe8b
Merge branch 'master' of github.com:apache/superset into filter_set_u…
simcha90 Mar 10, 2021
24dcd16
feat: edit filter set
simcha90 Mar 10, 2021
d8e1bd9
refactor: add warning icon
simcha90 Mar 10, 2021
e558783
fix: fix CR notes
simcha90 Mar 10, 2021
accd1f2
Update superset-frontend/src/dashboard/components/nativeFilters/Filte…
simcha90 Mar 10, 2021
5b3803a
fix: fix CR notes
simcha90 Mar 10, 2021
e882100
Merge branch 'master' of github.com:apache/superset into filter_set_m…
simcha90 Mar 10, 2021
2ada369
feat: filter set edge cases
simcha90 Mar 11, 2021
6a1cfb7
Merge branch 'master' of github.com:apache/superset into filter_set_m…
simcha90 Mar 11, 2021
d66e3ff
lint: fix lint
simcha90 Mar 11, 2021
51c5395
lint: fix TS
simcha90 Mar 14, 2021
3030e8d
refactor: fix CR notes
simcha90 Mar 15, 2021
d4c3fb0
fix: fix CR notes
simcha90 Mar 15, 2021
6c72bbb
fix: fix CR notes
simcha90 Mar 15, 2021
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 @@ -22,6 +22,7 @@ import { FilterSet } from 'src/dashboard/reducers/types';
import { DataMaskUnit } from 'src/dataMask/types';
import { CheckOutlined, EllipsisOutlined } from '@ant-design/icons';
import { HandlerFunction, styled, supersetTheme, t } from '@superset-ui/core';
import { Tooltip } from 'src/common/components/Tooltip';
import FiltersHeader from './FiltersHeader';

const TitleText = styled.div`
Expand Down Expand Up @@ -65,7 +66,11 @@ const FilterSetUnit: FC<FilterSetUnitProps> = ({
const menu = (
<Menu>
<Menu.Item onClick={onEdit}>{t('Edit')}</Menu.Item>
<Menu.Item onClick={onInvalidate}>{t('Invalidate')}</Menu.Item>
<Menu.Item onClick={onInvalidate}>
simcha90 marked this conversation as resolved.
Show resolved Hide resolved
<Tooltip placement="right" title={t('It will remove invalid filters')}>
simcha90 marked this conversation as resolved.
Show resolved Hide resolved
{t('Rebuild')}
</Tooltip>
</Menu.Item>
<Menu.Item onClick={onDelete} danger>
{t('Delete')}
</Menu.Item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { HandlerFunction, styled, t } from '@superset-ui/core';
import { useDispatch } from 'react-redux';
import { DataMaskState, DataMaskUnit, MaskWithId } from 'src/dataMask/types';
import { setFilterSetsConfiguration } from 'src/dashboard/actions/nativeFilters';
import { Filters, FilterSet } from 'src/dashboard/reducers/types';
import { Filters, FilterSet, FilterSets } from 'src/dashboard/reducers/types';
import { areObjectsEqual } from 'src/reduxUtils';
import { findExistingFilterSet, generateFiltersSetId } from './utils';
import { Filter } from '../../types';
Expand Down Expand Up @@ -104,6 +104,10 @@ const FilterSets: React.FC<FilterSetsProps> = ({
setSelectedFiltersSetId(foundFilterSet?.id ?? null);
}, [isFilterSetChanged, dataMaskSelected, filterSetFilterValues]);

const hasInvalidData = (id: string, filtersSet?: FilterSet) =>
!filterValues.find(filter => filter?.id === id) ||
!areObjectsEqual(filters[id], filtersSet?.nativeFilters?.[id]);

const takeFilterSet = (id: string, target?: HTMLElement) => {
const ignoreSelectorHeader = 'ant-collapse-header';
const ignoreSelectorDropdown = 'ant-dropdown-menu-item';
Expand All @@ -125,15 +129,14 @@ const FilterSets: React.FC<FilterSetsProps> = ({
if (!id) {
return;
}

const filtersSet = filterSets[id];

simcha90 marked this conversation as resolved.
Show resolved Hide resolved
Object.values(filtersSet?.dataMask?.nativeFilters ?? []).forEach(
dataMask => {
const { extraFormData, currentState, id } = dataMask as MaskWithId;
// if we have extra filters in filter set don't add them to selected data mask || if we have filters with changed metadata not apply them
if (
simcha90 marked this conversation as resolved.
Show resolved Hide resolved
!filterValues.find(filter => filter?.id === id) ||
!areObjectsEqual(filters[id], filtersSet?.nativeFilters?.[id])
) {
if (hasInvalidData(id, filtersSet)) {
return;
}
onFilterSelectionChange(
Expand All @@ -151,10 +154,7 @@ const FilterSets: React.FC<FilterSetsProps> = ({
.filter(dataMask => {
const { id } = dataMask as MaskWithId;
// if we have extra filters in filter set don't add them to selected data mask || if we have filters with changed metadata not apply them
return !(
simcha90 marked this conversation as resolved.
Show resolved Hide resolved
!filterValues.find(filter => filter?.id === id) ||
!areObjectsEqual(filters[id], filtersSet?.nativeFilters?.[id])
);
return !hasInvalidData(id, filtersSet);
})
.reduce((prev, next) => ({ ...prev, [next.id]: filters[next.id] }), {});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ const FiltersHeader: FC<FiltersHeaderProps> = ({ dataMask, filterSet }) => {
const changedFilter =
filterSet &&
!areObjectsEqual(filters[id], filterSet?.nativeFilters?.[id]);
const nonExistedFilter = !Object.keys(filters).includes(id);
const removedFilter = !Object.keys(filters).includes(id);

return (
<Tooltip
title={
(nonExistedFilter &&
(removedFilter &&
t(
"This filter doesn't exist in dashboard. It will not be applied.",
)) ||
Expand All @@ -95,14 +95,10 @@ const FiltersHeader: FC<FiltersHeaderProps> = ({ dataMask, filterSet }) => {
placement="bottomLeft"
>
<div>
<Typography.Text
strong
delete={nonExistedFilter}
mark={changedFilter}
>
<Typography.Text strong delete={removedFilter} mark={changedFilter}>
{name}:&nbsp;
</Typography.Text>
<Typography.Text delete={nonExistedFilter} mark={changedFilter}>
<Typography.Text delete={removedFilter} mark={changedFilter}>
{getFilterValueForDisplay(dataMask?.[id]?.currentState?.value) || (
<Typography.Text type="secondary">{t('None')}</Typography.Text>
)}
Expand Down