forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(filter-set): Filter set history (apache#13529)
* refactor(native-filters): move data mask to root reducer * refactor: update rest stuff for dataMask * refactor: add ownCrrentState to explore * fix: fix immer reducer * fix: merge with master * refactor: support explore dataMask * refactor: support explore dataMask * docs: add comment * refactor: remove json stringify * fix: fix failed cases * feat: filter bat buttons start * fix: fix CR notes * fix: fix cascade filters * fix: fix CR notes * refactor: add clear all * fix: fix CR notes * fix: fix CR notes * fix: fix CR notes * feat: buttons in filter bar * lint: update imports * feat: add tabs for filter sets * feat: add buttons to filter set * feat: first phase add filter sets * fix: undo FF * refactor: continue filter sets * fix: fix CR notes * refactor: header * fix: fix CR notes * fix: fix CR notes * refactor: continue filter sets * lint: fix lint * refactor: continue filter sets * fix: fix filter bar opening * refactor: continue filter sets * refactor: continue filter sets * refactor: continue filter sets * feat: filters sets history * feat: filters sets history * fix: filter set name * refactor: fix expand filters case * fix: fix CR notes * refactor: filter sets * fix: fix CR notes * refactor: filter sets
- Loading branch information
Showing
8 changed files
with
287 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
...et-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterSets/FilterSetUnit.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { Typography, Dropdown, Menu } from 'src/common/components'; | ||
import React, { FC } from 'react'; | ||
import { FilterSet } from 'src/dashboard/reducers/types'; | ||
import { DataMaskUnitWithId } from 'src/dataMask/types'; | ||
import { CheckOutlined, EllipsisOutlined } from '@ant-design/icons'; | ||
import { HandlerFunction, styled, supersetTheme, t } from '@superset-ui/core'; | ||
import FiltersHeader from './FiltersHeader'; | ||
import { Filter } from '../../types'; | ||
|
||
const TitleText = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
`; | ||
|
||
const IconsBlock = styled.div` | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: flex-start; | ||
& > * { | ||
${({ theme }) => `padding-left: ${theme.gridUnit * 2}px`}; | ||
} | ||
`; | ||
|
||
type FilterSetUnitProps = { | ||
filters: Filter[]; | ||
editMode?: boolean; | ||
isApplied?: boolean; | ||
filterSet?: FilterSet; | ||
filterSetName?: string; | ||
dataMaskApplied: DataMaskUnitWithId; | ||
setFilterSetName?: (name: string) => void; | ||
onDelete?: HandlerFunction; | ||
}; | ||
|
||
const FilterSetUnit: FC<FilterSetUnitProps> = ({ | ||
filters, | ||
editMode, | ||
setFilterSetName, | ||
onDelete, | ||
filterSetName, | ||
dataMaskApplied, | ||
filterSet, | ||
isApplied, | ||
}) => { | ||
const menu = ( | ||
<Menu> | ||
<Menu.Item onClick={onDelete}>{t('Delete')}</Menu.Item> | ||
</Menu> | ||
); | ||
return ( | ||
<> | ||
<TitleText> | ||
<Typography.Text | ||
strong | ||
editable={{ | ||
editing: editMode, | ||
icon: <span />, | ||
onChange: setFilterSetName, | ||
}} | ||
> | ||
{filterSet?.name ?? filterSetName} | ||
</Typography.Text> | ||
<IconsBlock> | ||
{isApplied && ( | ||
<CheckOutlined | ||
style={{ color: supersetTheme.colors.success.base }} | ||
/> | ||
)} | ||
{onDelete && ( | ||
<Dropdown | ||
overlay={menu} | ||
placement="bottomRight" | ||
trigger={['click']} | ||
> | ||
<EllipsisOutlined | ||
onClick={e => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}} | ||
/> | ||
</Dropdown> | ||
)} | ||
</IconsBlock> | ||
</TitleText> | ||
<FiltersHeader | ||
expanded={!filterSet} | ||
dataMask={filterSet?.dataMask?.nativeFilters ?? dataMaskApplied} | ||
filters={filters} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default FilterSetUnit; |
Oops, something went wrong.