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(dashboard): Dashboard-Native Filters #11814

Merged
merged 191 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
aa427c0
wip: filter create modal
suddjian Nov 3, 2020
12d2d4e
add a feature flag
suddjian Nov 3, 2020
a5e33ae
automatic changes to package lock
suddjian Nov 3, 2020
82b83d8
wip
suddjian Nov 10, 2020
78bf0e9
filter sidebar and basic state management
suddjian Nov 13, 2020
7624042
move create button to the sidebar
suddjian Nov 13, 2020
8026e42
Merge branch 'master' into dashboard-native-filters
suddjian Nov 13, 2020
c1afcb6
first step for edit filterconfig
pkdotson Nov 14, 2020
056d4d3
partially fix tests...
suddjian Nov 14, 2020
b1b40ea
edits to types and comments
suddjian Nov 14, 2020
7388ced
respect feature flag on the filter sidebar
suddjian Nov 16, 2020
eddd87e
add filterconfig form
pkdotson Nov 16, 2020
869f36e
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
pkdotson Nov 16, 2020
40801fc
get input state working
pkdotson Nov 16, 2020
3a2da31
feat: tree filter scopes UI
simcha90 Nov 17, 2020
44c3e0c
fix: turn on flag
Nov 17, 2020
a06b3cb
sticky filter bar
suddjian Nov 18, 2020
a4117f3
stop preferring default export
suddjian Nov 18, 2020
d602700
feat: finish filter scoping
simcha90 Nov 18, 2020
cac8416
Merge branch 'scopes' of github.com:simchaNielsen/incubator-superset …
simcha90 Nov 18, 2020
dce5f46
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
simcha90 Nov 18, 2020
21d2b28
fix: under toggle
simcha90 Nov 18, 2020
8422d54
Merge branch 'master' into dashboard-native-filters
villebro Nov 18, 2020
0949085
fix: title
simcha90 Nov 18, 2020
344cd94
fix: add licence
simcha90 Nov 18, 2020
ae33570
refactor: update TS
simcha90 Nov 18, 2020
3f5ea72
fix: fix on reopen modal + validation
simcha90 Nov 18, 2020
d5d75f6
new filter bar menu
rusackas Nov 18, 2020
cbb2c65
adding, but commenting out, bulk scoping action
rusackas Nov 18, 2020
b62e06d
adding some placeholder buttons and styles therefor
rusackas Nov 18, 2020
b1302d3
feat: add filter chart
villebro Nov 10, 2020
26a7b40
add relative path to package.json
villebro Nov 18, 2020
66dd647
update modal
pkdotson Nov 18, 2020
0445f3e
update branch
pkdotson Nov 18, 2020
3f9a0f9
Merge branch 'dashboard-native-filters' into scopes
suddjian Nov 19, 2020
05193e7
Merge pull request #44 from simchaNielsen/scopes
suddjian Nov 19, 2020
e9a5204
a little input styling... just getting warmed up
rusackas Nov 19, 2020
5fc2346
Revert "feat: add filter chart"
suddjian Nov 19, 2020
faea463
Revert "add relative path to package.json"
suddjian Nov 19, 2020
5c96faa
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
suddjian Nov 19, 2020
845e79a
https package lock idk
suddjian Nov 19, 2020
3b5f5a6
feat: add filter chart
villebro Nov 10, 2020
d53feb0
add relative path to package.json
villebro Nov 18, 2020
4a509a2
flexboxes all the way down
rusackas Nov 19, 2020
941d1d0
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
rusackas Nov 19, 2020
28d562f
dynamically generate groupby and datasource in select control
villebro Nov 19, 2020
0774764
big wip
suddjian Nov 19, 2020
882668f
fix target column name
villebro Nov 19, 2020
c331e23
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
suddjian Nov 19, 2020
93f0dcd
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
suddjian Nov 19, 2020
091f8b2
no importing nonexistent things
suddjian Nov 19, 2020
35e8702
styles and name editing
suddjian Nov 19, 2020
8c1a7f3
Add hook for retrieval of all filter states
villebro Nov 19, 2020
a044f4b
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
villebro Nov 19, 2020
aa0b847
start with a new filter when clicking add filter
suddjian Nov 19, 2020
b445023
handle removed filters gracefully
suddjian Nov 19, 2020
fe736f2
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
suddjian Nov 19, 2020
03b0b5c
fix incorrect default filter configuration
villebro Nov 19, 2020
84c1504
add fields to useAllFilterState
villebro Nov 19, 2020
392924b
add redux for filterconfigs
pkdotson Nov 19, 2020
24195bf
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
pkdotson Nov 19, 2020
c40ac69
add support for native_filters
villebro Nov 19, 2020
a4506c3
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
villebro Nov 19, 2020
bc243a7
remove consoles
pkdotson Nov 19, 2020
2b744e7
improve filter removal
suddjian Nov 19, 2020
53bd174
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
suddjian Nov 19, 2020
4cc44e6
unbreak infinite loop
villebro Nov 19, 2020
5363697
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
villebro Nov 19, 2020
3fa6f05
basic sidebar toggling working!
rusackas Nov 20, 2020
d7d98d6
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
rusackas Nov 20, 2020
ec2c2db
collapsing and menu working more smoothly
rusackas Nov 20, 2020
e8a142b
linting
rusackas Nov 20, 2020
f7fc973
make dataset and column inputs work
suddjian Nov 20, 2020
869b409
save filter values properly
suddjian Nov 20, 2020
9d9d5c8
add dashboard event for filter updates
villebro Nov 20, 2020
8682b84
guarded
suddjian Nov 20, 2020
c0ba458
Merge branch 'dashboard-native-filters' of github.com:preset-io/incub…
villebro Nov 20, 2020
f91f5af
apply filters properly
villebro Nov 20, 2020
3b6dedb
fix schema
villebro Nov 20, 2020
bb20872
making New Filter button a link
rusackas Nov 21, 2020
83cf69d
gridunits ftw
rusackas Nov 21, 2020
aa44002
centering modal
rusackas Nov 21, 2020
7507b15
tis not a button anymore! nixing type.
rusackas Nov 21, 2020
ecb8780
plus and collapse buttons instead of "more" menu
rusackas Nov 21, 2020
deae5b9
updating full size filter icons
rusackas Nov 21, 2020
bb3e435
adding icons to filter collapsing/expanding
rusackas Nov 21, 2020
da1c779
turning off animation, but leaving class-based animation css
rusackas Nov 22, 2020
9957c92
Merge branch 'master' into dashboard-native-filters
villebro Nov 24, 2020
fb4ff44
fix linting error
villebro Nov 24, 2020
9ba1e32
fix native filters for legacy charts
villebro Nov 24, 2020
b147aaf
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
rusackas Nov 24, 2020
ea8600f
updates test
pkdotson Nov 24, 2020
1315f46
no individual apply buttons
suddjian Nov 24, 2020
fb356fa
fix bugs with filter config modal
suddjian Nov 25, 2020
a029be5
remove redundant code
villebro Nov 25, 2020
0c0e04c
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Nov 25, 2020
bf471c8
switch to the filter with validation errors on submit
suddjian Nov 25, 2020
6e7a4a6
separate form validation
suddjian Nov 25, 2020
c921ee9
switch config button from add to edit
suddjian Nov 25, 2020
2cd0af9
Merge branch 'master' into dashboard-native-filters
suddjian Nov 25, 2020
de76686
update tests
pkdotson Nov 25, 2020
f66e575
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Nov 25, 2020
badf227
oops forgot to add the fancy new useChangeEffect hook
suddjian Nov 25, 2020
c9e8e72
comments and code reorganization
suddjian Nov 25, 2020
7cd48b8
rename native_filters to extr_form_data and move hook
villebro Nov 26, 2020
af29eec
Merge branch 'master' into dashboard-native-filters
villebro Nov 27, 2020
5b3b2f7
disable native filters in viz selector
villebro Nov 27, 2020
759516d
add cascading
villebro Nov 27, 2020
e8ccf4f
implement new extra form data api
villebro Nov 30, 2020
a94d733
cleanup
villebro Dec 1, 2020
2c624f9
updates tests
pkdotson Dec 1, 2020
bfa0644
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Dec 1, 2020
1d5191f
bump npm packages
villebro Dec 2, 2020
1b4cf7b
Merge branch 'master' into dashboard-native-filters
villebro Dec 2, 2020
6652a69
fix bad merge on package.json + lock
villebro Dec 2, 2020
6488877
lint
villebro Dec 2, 2020
a6b4f69
replace in and not in with uppercase
villebro Dec 2, 2020
1ba6e3f
lint
villebro Dec 2, 2020
3b95a61
lint
villebro Dec 2, 2020
830cb18
lint
villebro Dec 3, 2020
bca3b58
lint
villebro Dec 3, 2020
7c64b0f
bulk test fix
pkdotson Dec 4, 2020
c529840
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Dec 4, 2020
40fe216
Sort select input alphabetically
agatapst Dec 3, 2020
d52a419
Change type for sorting elements
agatapst Dec 4, 2020
6592543
Merge pull request #51 from agatapst/native-filters/sort-select-input
villebro Dec 4, 2020
81b81d6
fix rest of unit tests
pkdotson Dec 5, 2020
01f5b7c
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Dec 5, 2020
2c7e5a2
make filter operators all uppercase
villebro Dec 7, 2020
4b831bd
Merge branch 'master' into dashboard-native-filters
villebro Dec 7, 2020
9f004e8
Hide Filter bar when there are no filters
agatapst Dec 4, 2020
e0c1a77
Show edit button for dashboard owners only
agatapst Dec 4, 2020
f0f1888
Add visible argument to filters toggle function to avoid future regre…
agatapst Dec 7, 2020
a143c4f
Improve Toggle filters bar function
agatapst Dec 7, 2020
102d956
Merge pull request #52 from agatapst/native-filters/filter-bar-elements
villebro Dec 7, 2020
71a0542
lint
villebro Dec 7, 2020
b50956d
fix js lint + set createNewOnOpen
villebro Dec 7, 2020
0adfa03
Handle setting extra form data in Filter Bar instead of Filter Control
agatapst Dec 7, 2020
4cc9a03
Add Handle apply filter function to Apply button
agatapst Dec 7, 2020
3b9ab43
Allow applying changes instantly
agatapst Dec 7, 2020
edff7fd
Fix types
agatapst Dec 7, 2020
00027db
remove console logs
suddjian Dec 7, 2020
d80738b
Merge branch 'master' into dashboard-native-filters
suddjian Dec 7, 2020
661e377
Add Error Boundary component to Filter bar and Filter Config Modal
agatapst Dec 8, 2020
61065ec
Merge pull request #54 from agatapst/native-filters/error-boundary
villebro Dec 8, 2020
87a6f34
fix jest tests
villebro Dec 8, 2020
1ebaf46
update native filters tests to pass
pkdotson Dec 8, 2020
55b3d98
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Dec 8, 2020
b4b1506
Merge pull request #53 from agatapst/native-filters/apply-button
villebro Dec 8, 2020
f675fc2
reset cypress baseUrl
suddjian Dec 8, 2020
1b9eb9b
Merge branch 'master' into dashboard-native-filters
suddjian Dec 9, 2020
5c44d6f
remove unnecessary field
suddjian Dec 10, 2020
72f8989
cleanup: remove unused state fields
suddjian Dec 14, 2020
3319f95
move unrelated types to an appropriate location
suddjian Dec 15, 2020
9233753
remove misplaced resource fetch error logic
suddjian Dec 15, 2020
24a759d
fix cascadeParentIds error
suddjian Dec 15, 2020
e6e7bc6
fix cypress password
villebro Dec 15, 2020
296675d
Merge branch 'master' into dashboard-native-filters
villebro Dec 15, 2020
679e992
initial attempt at fixing scope issue
suddjian Dec 15, 2020
18e9188
fix bad merge
villebro Dec 15, 2020
0cbdb44
fix lint
villebro Dec 15, 2020
4c0b34e
trying out makeApi for saving filters
suddjian Dec 15, 2020
6af4dea
remove unused import
suddjian Dec 15, 2020
7762b4f
fix test
suddjian Dec 16, 2020
2e5423c
silence bad test
suddjian Dec 16, 2020
0a75d7f
Merge branch 'master' into dashboard-native-filters
villebro Dec 16, 2020
c91e00a
add native-filter feat flag config
pkdotson Dec 16, 2020
292c9c6
oops fix here
pkdotson Dec 16, 2020
a35d4a0
remove space
pkdotson Dec 16, 2020
d888de2
Merge branch 'master' into dashboard-native-filters
villebro Dec 16, 2020
07c3044
Update superset-frontend/src/common/components/index.tsx
suddjian Dec 17, 2020
633ba0a
Update superset-frontend/cypress-base/cypress/integration/dashboard/n…
suddjian Dec 17, 2020
9331bfc
Merge branch 'master' into dashboard-native-filters
villebro Dec 17, 2020
3a61724
use styledMount in tests
suddjian Dec 17, 2020
0a7d7d3
comment
suddjian Dec 17, 2020
08aa50e
Update superset-frontend/src/dashboard/components/nativeFilters/Filte…
suddjian Dec 17, 2020
5d352e2
Update superset-frontend/src/dashboard/components/nativeFilters/Filte…
suddjian Dec 17, 2020
f9cfae2
Update superset-frontend/src/dashboard/components/nativeFilters/Filte…
suddjian Dec 17, 2020
b7ee19b
Update superset-frontend/src/dashboard/components/nativeFilters/Filte…
suddjian Dec 17, 2020
15cce2c
address PR feedback
suddjian Dec 17, 2020
fa013d2
fix package lock
suddjian Dec 17, 2020
57b7428
null guards
suddjian Dec 17, 2020
ff1875f
Merge branch 'master' into dashboard-native-filters
villebro Dec 18, 2020
57450d1
Fix charts resizing
agatapst Dec 18, 2020
52cbe90
Merge pull request #66 from agatapst/native-filters/fix-resizing
villebro Dec 18, 2020
0f991f7
fix cypress tests
pkdotson Dec 18, 2020
700dbfd
Merge branch 'dashboard-native-filters' of https://github.com/preset-…
pkdotson Dec 18, 2020
cf58305
Merge branch 'master' into dashboard-native-filters
pkdotson Dec 18, 2020
522b7b6
Merge branch 'master' into dashboard-native-filters
pkdotson Dec 18, 2020
f91e9bc
add in nativefilters to form data
pkdotson Dec 18, 2020
800951f
fix lint and test
pkdotson Dec 18, 2020
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
4 changes: 3 additions & 1 deletion superset-frontend/src/common/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export const StyledModal = styled(BaseModal)<StyledModalProps>`
}

// styling for Tabs component
.ant-tabs {
// Aaron note 20-11-19: this seems to be exclusively here for the Edit Database modal.
// TODO: remove this as it is a special case.
rusackas marked this conversation as resolved.
Show resolved Hide resolved
.ant-tabs-top {
margin-top: -${({ theme }) => theme.gridUnit * 4}px;
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,20 @@ const FilterConfigForm: React.FC<FilterConfigFormProps> = ({
}); // TODO: when connect to store read from there

return (
<Form
form={form}
onValuesChange={changes => {
// un-set the "column" value whenever the dataset changes.
// Doing this in the onChange handler of the
// dataset selector doesn't work for some reason.
if ('dataset' in changes && changes.dataset?.value !== datasetId) {
form.setFieldsValue({ column: null });
setDatasetId(changes.dataset.value);
}
}}
>
<>
<Form.Item
name="name"
name={['filters', filterId, 'name']}
label="Filter Name"
initialValue={filterToEdit?.name}
rules={[{ required: true }]}
>
<Input />
</Form.Item>
<Form.Item name="dataset" label="Datasource" rules={[{ required: true }]}>
<Form.Item
name={['filters', filterId, 'dataset']}
label="Datasource"
rules={[{ required: true }]}
>
<SupersetResourceSelect
resource="dataset"
searchColumn="table_name"
Expand All @@ -146,7 +139,7 @@ const FilterConfigForm: React.FC<FilterConfigFormProps> = ({
<Form.Item
// don't show the column select unless we have a dataset
style={{ display: datasetId == null ? undefined : 'none' }}
name="column"
name={['filters', filterId, 'column']}
initialValue={
filterToEdit?.targets?.length && filterToEdit?.targets[0]?.datasetId
}
Expand All @@ -155,23 +148,32 @@ const FilterConfigForm: React.FC<FilterConfigFormProps> = ({
>
<ColumnSelect datasetId={datasetId} />
</Form.Item>
<Form.Item name="defaultValue" label="Default Value">
<Form.Item
name={['filters', filterId, 'defaultValue']}
label="Default Value"
>
<Input />
</Form.Item>
<Form.Item name="isInstant" label={t('Apply changes instantly')}>
<Form.Item
name={['filters', filterId, 'isInstant']}
label={t('Apply changes instantly')}
>
<Input type="checkbox" />
</Form.Item>
<Form.Item
name="allowsMultipleValues"
name={['filters', filterId, 'allowsMultipleValues']}
label={t('Allow multiple selections')}
>
<Input type="checkbox" />
</Form.Item>
<Form.Item name="isRequired" label={t('Required')}>
<Form.Item
name={['filters', filterId, 'isRequired']}
label={t('Required')}
>
<Input type="checkbox" />
</Form.Item>
<Typography.Title level={5}>{t('Scoping')}</Typography.Title>
<Form.Item name="scoping" initialValue={scoping}>
<Form.Item name={['filters', filterId, 'scoping']} initialValue={scoping}>
<Radio.Group
onChange={({ target: { value } }) => {
setScoping(value as Scoping);
Expand All @@ -193,7 +195,7 @@ const FilterConfigForm: React.FC<FilterConfigFormProps> = ({
<ScopingTree setFilterScope={setFilterScope} />
</>
)}
</Form>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import shortid from 'shortid';
import { Store } from 'antd/lib/form/interface';
import { DeleteFilled } from '@ant-design/icons';
rusackas marked this conversation as resolved.
Show resolved Hide resolved
import { styled, t } from '@superset-ui/core';
import { Button, Form, Icon } from 'src/common/components';
import { Button, Form } from 'src/common/components';
import Icon from 'src/components/Icon';
import { StyledModal } from 'src/common/components/Modal';
import Tabs from 'src/common/components/Tabs';
import { LineEditableTabs } from 'src/common/components/Tabs';
import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants';
import { useFilterConfigMap, useFilterConfiguration } from './state';
import FilterConfigForm from './FilterConfigForm';
Expand Down Expand Up @@ -80,6 +82,13 @@ export function FilterConfigModal({
const [removedFilters, setRemovedFilters] = useState<Record<string, boolean>>(
{},
);
const [formValues, setFormValues] = useState<NativeFiltersForm>({
filters: {},
});

useEffect(() => {
form.setFieldsValue({ filters: {} });
}, [form, filterConfig]);

function resetForm() {
form.resetFields();
Expand All @@ -101,8 +110,9 @@ export function FilterConfigModal({
}

function getFilterTitle(id: string) {
// TODO use edited name from the form here
return filterConfigMap[id]?.name ?? 'New Filter';
return (
formValues.filters[id]?.name ?? filterConfigMap[id]?.name ?? 'New Filter'
rusackas marked this conversation as resolved.
Show resolved Hide resolved
);
}

async function onOk() {
Expand Down Expand Up @@ -144,6 +154,7 @@ export function FilterConfigModal({
<StyledModal
visible={isOpen}
title={t('Filter Configuration and Scoping')}
width="55%"
onCancel={() => {
resetForm();
onCancel();
Expand All @@ -153,31 +164,34 @@ export function FilterConfigModal({
cancelText={t('Cancel')}
>
<StyledModalBody>
<Form>
<Tabs
type="editable-card"
<Form
form={form}
onValuesChange={(changes, values) => setFormValues(values)}
>
<LineEditableTabs
tabPosition="left"
onChange={setCurrentFilterId}
activeKey={currentFilterId}
onEdit={onTabEdit}
>
{filterIds.map(id => (
<Tabs.TabPane
<LineEditableTabs.TabPane
tab={
<RemovedStatus removed={!!removedFilters[id]}>
{getFilterTitle(id)}
</RemovedStatus>
}
key={id}
closeIcon={<Icon name="trash" />}
closeIcon={<DeleteFilled />}
>
<FilterConfigForm
form={form}
filterId={id}
filterToEdit={filterConfigMap[id]}
/>
</Tabs.TabPane>
</LineEditableTabs.TabPane>
))}
</Tabs>
</LineEditableTabs>
</Form>
</StyledModalBody>
</StyledModal>
Expand Down