mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
Added timer to explore v2 and share it with sqllab (#1802)
* Added timer to explore v2 and share it with sqllab * Fixed js tests * Add timer to initial load * Make timer smaller * nits
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { defaultFormData } from '../stores/store';
|
||||
import * as actions from '../actions/exploreActions';
|
||||
import { addToArr, removeFromArr, alterInArr } from '../../../utils/reducerUtils';
|
||||
import { now } from '../../modules/dates';
|
||||
|
||||
export const exploreReducer = function (state, action) {
|
||||
const actionHandlers = {
|
||||
@@ -113,19 +114,32 @@ export const exploreReducer = function (state, action) {
|
||||
query: action.viz.query,
|
||||
data: action.viz.data,
|
||||
};
|
||||
const chartUpdateEndTime = now();
|
||||
return Object.assign(
|
||||
{},
|
||||
state,
|
||||
{
|
||||
viz: Object.assign({}, state.viz, vizUpdates),
|
||||
isChartLoading: false,
|
||||
chartStatus: 'success',
|
||||
chartUpdateEndTime,
|
||||
});
|
||||
},
|
||||
[actions.CHART_UPDATE_STARTED]() {
|
||||
return Object.assign({}, state, { isChartLoading: true });
|
||||
const chartUpdateStartTime = now();
|
||||
return Object.assign({}, state,
|
||||
{ chartStatus: 'loading', chartUpdateEndTime: null, chartUpdateStartTime });
|
||||
},
|
||||
[actions.CHART_UPDATE_FAILED]() {
|
||||
return Object.assign({}, state, { isChartLoading: false, chartAlert: action.error });
|
||||
const chartUpdateEndTime = now();
|
||||
return Object.assign({}, state,
|
||||
{ chartStatus: 'failed', chartAlert: action.error, chartUpdateEndTime });
|
||||
},
|
||||
[actions.UPDATE_CHART_STATUS]() {
|
||||
const newState = Object.assign({}, state, { chartStatus: action.status });
|
||||
if (action.status === 'success' || action.status === 'failed') {
|
||||
newState.chartUpdateEndTime = now();
|
||||
}
|
||||
return newState;
|
||||
},
|
||||
[actions.REMOVE_CHART_ALERT]() {
|
||||
return Object.assign({}, state, { chartAlert: null });
|
||||
|
||||
Reference in New Issue
Block a user