mirror of
https://github.com/apache/superset.git
synced 2026-04-21 17:14:57 +00:00
feat(sqllab): SPA migration (#25151)
This commit is contained in:
@@ -17,12 +17,13 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { combineReducers } from 'redux';
|
||||
import configureStore from 'redux-mock-store';
|
||||
import thunk from 'redux-thunk';
|
||||
import { render } from 'spec/helpers/testing-library';
|
||||
|
||||
import App from 'src/SqlLab/components/App';
|
||||
import sqlLabReducer from 'src/SqlLab/reducers/index';
|
||||
import reducers from 'spec/helpers/reducerIndex';
|
||||
import { LOCALSTORAGE_MAX_USAGE_KB } from 'src/SqlLab/constants';
|
||||
import { LOG_EVENT } from 'src/logger/actions';
|
||||
import {
|
||||
@@ -37,6 +38,8 @@ jest.mock('src/SqlLab/components/QueryAutoRefresh', () => () => (
|
||||
<div data-test="mock-query-auto-refresh" />
|
||||
));
|
||||
|
||||
const sqlLabReducer = combineReducers(reducers);
|
||||
|
||||
describe('SqlLab App', () => {
|
||||
const middlewares = [thunk];
|
||||
const mockStore = configureStore(middlewares);
|
||||
|
||||
@@ -20,9 +20,9 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
import { Redirect } from 'react-router-dom';
|
||||
import { css, styled, t } from '@superset-ui/core';
|
||||
import throttle from 'lodash/throttle';
|
||||
import ToastContainer from 'src/components/MessageToasts/ToastContainer';
|
||||
import {
|
||||
LOCALSTORAGE_MAX_USAGE_KB,
|
||||
LOCALSTORAGE_WARNING_THRESHOLD,
|
||||
@@ -186,7 +186,14 @@ class App extends React.PureComponent {
|
||||
render() {
|
||||
const { queries, queriesLastUpdate } = this.props;
|
||||
if (this.state.hash && this.state.hash === '#search') {
|
||||
return window.location.replace('/superset/sqllab/history/');
|
||||
return (
|
||||
<Redirect
|
||||
to={{
|
||||
pathname: '/sqllab/history/',
|
||||
replace: true,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<SqlLabStyles data-test="SqlLabApp" className="App SqlLab">
|
||||
@@ -195,7 +202,6 @@ class App extends React.PureComponent {
|
||||
queriesLastUpdate={queriesLastUpdate}
|
||||
/>
|
||||
<TabbedSqlEditors />
|
||||
<ToastContainer />
|
||||
</SqlLabStyles>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user