fix: replace datamask with key from new key value api (#17680)

* afirst stage to ccheck to get initial datamask

* clean up code and update typescript

* remove consoles

* fix ts and update copy dashboard url

* use key when one doesn't exists

* lint clean up

* fix errors

* add suggested changes

* remove line

* add tests and add changes for copydashboard

* fix lint

* fix lint

* fix lint

* Update superset-frontend/src/dashboard/components/Header/index.jsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add timeout

* fix test

* fix test, add qs to cypress and add suggestions

* add suggestions

* fix lint

* more suggested changes for backwards comapat

* fix lint

* cleanup naming and add qs parse to tests

* Update superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Update superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* more changes and fix lint

* remove nativefiler param

* fix path

* remove con

* simplify logic

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
Phillip Kelley-Dotson
2021-12-21 09:08:48 -08:00
committed by GitHub
parent 2c3f39f3f2
commit cfd851aa13
24 changed files with 304 additions and 78 deletions

View File

@@ -73,25 +73,21 @@ describe('getChartIdsFromLayout', () => {
);
});
it('should encode native filters', () => {
it('should process native filters key', () => {
const windowSpy = jest.spyOn(window, 'window', 'get');
windowSpy.mockImplementation(() => ({
location: {
origin: 'https://localhost',
search:
'?preselect_filters=%7B%7D&native_filters_key=024380498jdkjf-2094838',
},
}));
const urlWithNativeFilters = getDashboardUrl({
pathname: 'path',
dataMask: {
'NATIVE_FILTER-foo123': {
filterState: {
label: 'custom label',
value: ['a', 'b'],
},
},
'NATIVE_FILTER-bar456': {
filterState: {
value: undefined,
},
},
},
});
expect(urlWithNativeFilters).toBe(
'path?preselect_filters=%7B%7D&native_filters=%28NATIVE_FILTER-bar456%3A%28filterState%3A%28value%3A%21n%29%29%2CNATIVE_FILTER-foo123%3A%28filterState%3A%28label%3A%27custom+label%27%2Cvalue%3A%21%28a%2Cb%29%29%29%29',
'path?preselect_filters=%7B%7D&native_filters_key=024380498jdkjf-2094838',
);
});
});