chore: Restructure explore redux state (#20448)

* chore: Restructure explore redux state

* fixes

* fix tests

* add new tests

* Fix type

* Address comments

* Fix bug

* Fix import

* Add new test

* Move unsaved chart id to a constant

* Add todo
This commit is contained in:
Kamil Gabryjelski
2022-06-24 15:26:07 +02:00
committed by GitHub
parent 20163361b9
commit c7f1c7d5bd
36 changed files with 533 additions and 223 deletions

View File

@@ -26,7 +26,6 @@ import ExploreViewContainer from '.';
const reduxState = {
explore: {
common: { conf: { SUPERSET_WEBSERVER_TIMEOUT: 60 } },
controls: {
datasource: { value: '1__table' },
viz_type: { value: 'table' },
@@ -37,10 +36,10 @@ const reduxState = {
columns: [{ is_dttm: false }],
metrics: [{ id: 1, metric_name: 'count' }],
},
user: {
userId: 1,
},
isStarred: false,
slice: {
slice_id: 1,
},
},
charts: {
1: {
@@ -50,6 +49,18 @@ const reduxState = {
},
},
},
user: {
userId: 1,
},
common: { conf: { SUPERSET_WEBSERVER_TIMEOUT: 60 } },
datasources: {
'1__table': {
id: 1,
type: 'table',
columns: [{ is_dttm: false }],
metrics: [{ id: 1, metric_name: 'count' }],
},
},
};
const key = 'aWrs7w29sd';
@@ -67,6 +78,7 @@ jest.mock('lodash/debounce', () => ({
fetchMock.post('glob:*/api/v1/explore/form_data*', { key });
fetchMock.put('glob:*/api/v1/explore/form_data*', { key });
fetchMock.get('glob:*/api/v1/explore/form_data*', {});
fetchMock.get('glob:*/favstar/slice*', { count: 0 });
const renderWithRouter = (withKey?: boolean) => {
const path = '/superset/explore/';