Skip to content

Commit 662bab1

Browse files
feat: Renders Explore in SPA (apache#20572)
* feat: Renders Explore in SPA * Adds permalink support * Replaces navigation from Welcome page * Fix initializing feature flags * Remove redundant import * Adds saveSlice workaround * Fixes paths * Fixes lint error * Fixes tests * Fix url to explore from Datasets view * Fix explore page height Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com>
1 parent 1a80668 commit 662bab1

File tree

36 files changed

+167
-224
lines changed

36 files changed

+167
-224
lines changed

superset-frontend/cypress-base/cypress/integration/explore/advanced_analytics.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Advanced analytics', () => {
2222
cy.intercept('POST', '/superset/explore_json/**').as('postJson');
2323
cy.intercept('GET', '/superset/explore_json/**').as('getJson');
2424
cy.intercept('PUT', '/api/v1/explore/**').as('putExplore');
25-
cy.intercept('GET', '/superset/explore/**').as('getExplore');
25+
cy.intercept('GET', '/explore/**').as('getExplore');
2626
});
2727

2828
it('Create custom time compare', () => {

superset-frontend/cypress-base/cypress/support/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import '@cypress/code-coverage/support';
2020
import '@applitools/eyes-cypress/commands';
2121

22-
const BASE_EXPLORE_URL = '/superset/explore/?form_data=';
22+
const BASE_EXPLORE_URL = '/explore/?form_data=';
2323
const TokenName = Cypress.env('TOKEN_NAME');
2424

2525
require('cy-verify-downloads').addCustomCommand();
@@ -90,7 +90,7 @@ Cypress.Commands.add(
9090
},
9191
}).then(response => {
9292
const formDataKey = response.body.key;
93-
const url = `/superset/explore/?form_data_key=${formDataKey}`;
93+
const url = `/explore/?form_data_key=${formDataKey}`;
9494
cy.visit(url);
9595
});
9696
},

superset-frontend/src/addSlice/AddSliceContainer.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,6 @@ test('formats Explore url', async () => {
138138
datasource,
139139
vizType: 'table',
140140
});
141-
const formattedUrl = '/superset/explore/?viz_type=table&datasource=1';
141+
const formattedUrl = '/explore/?viz_type=table&datasource=1';
142142
expect(wrapper.instance().exploreUrl()).toBe(formattedUrl);
143143
});

superset-frontend/src/addSlice/AddSliceContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export default class AddSliceContainer extends React.PureComponent<
226226

227227
exploreUrl() {
228228
const dashboardId = getUrlParam(URL_PARAMS.dashboardId);
229-
let url = `/superset/explore/?viz_type=${this.state.vizType}&datasource=${this.state.datasource?.value}`;
229+
let url = `/explore/?viz_type=${this.state.vizType}&datasource=${this.state.datasource?.value}`;
230230
if (!isNullish(dashboardId)) {
231231
url += `&dashboard_id=${dashboardId}`;
232232
}

superset-frontend/src/dashboard/components/SliceHeader/SliceHeader.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const createProps = (overrides: any = {}) => ({
115115
sliceCanEdit: false,
116116
slice: {
117117
slice_id: 312,
118-
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
118+
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20312%7D',
119119
slice_name: 'Vaccine Candidates per Phase',
120120
form_data: {
121121
adhoc_filters: [],

superset-frontend/src/dashboard/components/SliceHeaderControls/SliceHeaderControls.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const createProps = (viz_type = 'sunburst') => ({
4848
onExploreChart: jest.fn(),
4949
slice: {
5050
slice_id: 371,
51-
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%20371%7D',
51+
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20371%7D',
5252
slice_name: 'Vaccine Candidates per Country & Stage',
5353
slice_description: 'Table of vaccine candidates for 100 countries',
5454
form_data: {

superset-frontend/src/dashboard/util/filterboxMigrationHelper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const regionFilter = {
6161
},
6262
modified: '<bound method AuditMixinNullable.modified of Region Filter>',
6363
slice_name: 'Region Filter',
64-
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%2032%7D',
64+
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%2032%7D',
6565
slice_id: 32,
6666
};
6767
const chart1 = {
@@ -88,7 +88,7 @@ const chart1 = {
8888
},
8989
modified: "<bound method AuditMixinNullable.modified of World's Population>",
9090
slice_name: "World's Population",
91-
slice_url: '/superset/explore/?form_data=%7B%22slice_id%22%3A%2033%7D',
91+
slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%2033%7D',
9292
slice_id: 33,
9393
};
9494
const chartData = [regionFilter, chart1];

superset-frontend/src/explore/App.jsx

Lines changed: 0 additions & 52 deletions
This file was deleted.

superset-frontend/src/explore/ExplorePage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const fetchExploreData = () => {
3838
})(exploreUrlParams);
3939
};
4040

41-
export const ExplorePage = () => {
41+
const ExplorePage = () => {
4242
const [isLoaded, setIsLoaded] = useState(false);
4343
const dispatch = useDispatch();
4444

@@ -66,3 +66,5 @@ export const ExplorePage = () => {
6666
}
6767
return <ExploreViewContainer />;
6868
};
69+
70+
export default ExplorePage;

superset-frontend/src/explore/actions/saveModalActions.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,17 @@ export function removeSaveModalAlert() {
6262

6363
export function saveSlice(formData, requestParams) {
6464
return dispatch => {
65-
const url = getExploreUrl({
65+
let url = getExploreUrl({
6666
formData,
6767
endpointType: 'base',
6868
force: false,
6969
curUrl: null,
7070
requestParams,
7171
});
7272

73+
// TODO: This will be removed in the next PR that will change the logic to save a slice
74+
url = url.replace('/explore', '/superset/explore');
75+
7376
// Save the query context so we can re-generate the data from Python
7477
// for alerts and reports
7578
const queryContext = buildV1ChartDataPayload({

0 commit comments

Comments
 (0)