|
@@ -105,10 +105,10 @@ export function changeDatasource(exploreId: ExploreId, datasource: string): Thun
|
|
|
const currentDataSourceInstance = getState().explore[exploreId].datasourceInstance;
|
|
const currentDataSourceInstance = getState().explore[exploreId].datasourceInstance;
|
|
|
const queries = getState().explore[exploreId].queries;
|
|
const queries = getState().explore[exploreId].queries;
|
|
|
|
|
|
|
|
- await dispatch(importQueries(exploreId, queries, currentDataSourceInstance, newDataSourceInstance));
|
|
|
|
|
-
|
|
|
|
|
dispatch(updateDatasourceInstanceAction({ exploreId, datasourceInstance: newDataSourceInstance }));
|
|
dispatch(updateDatasourceInstanceAction({ exploreId, datasourceInstance: newDataSourceInstance }));
|
|
|
|
|
|
|
|
|
|
+ await dispatch(importQueries(exploreId, queries, currentDataSourceInstance, newDataSourceInstance));
|
|
|
|
|
+
|
|
|
if (getState().explore[exploreId].isLive) {
|
|
if (getState().explore[exploreId].isLive) {
|
|
|
dispatch(changeRefreshInterval(exploreId, offOption.value));
|
|
dispatch(changeRefreshInterval(exploreId, offOption.value));
|
|
|
}
|
|
}
|
|
@@ -123,9 +123,8 @@ export function changeDatasource(exploreId: ExploreId, datasource: string): Thun
|
|
|
*/
|
|
*/
|
|
|
export function changeMode(exploreId: ExploreId, mode: ExploreMode): ThunkResult<void> {
|
|
export function changeMode(exploreId: ExploreId, mode: ExploreMode): ThunkResult<void> {
|
|
|
return dispatch => {
|
|
return dispatch => {
|
|
|
- dispatch(clearQueries(exploreId));
|
|
|
|
|
|
|
+ dispatch(clearQueriesAction({ exploreId }));
|
|
|
dispatch(changeModeAction({ exploreId, mode }));
|
|
dispatch(changeModeAction({ exploreId, mode }));
|
|
|
- dispatch(runQueries(exploreId));
|
|
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -236,6 +235,7 @@ export function initializeExplore(
|
|
|
datasourceName: string,
|
|
datasourceName: string,
|
|
|
queries: DataQuery[],
|
|
queries: DataQuery[],
|
|
|
rawRange: RawTimeRange,
|
|
rawRange: RawTimeRange,
|
|
|
|
|
+ mode: ExploreMode,
|
|
|
containerWidth: number,
|
|
containerWidth: number,
|
|
|
eventBridge: Emitter,
|
|
eventBridge: Emitter,
|
|
|
ui: ExploreUIState
|
|
ui: ExploreUIState
|
|
@@ -251,6 +251,7 @@ export function initializeExplore(
|
|
|
eventBridge,
|
|
eventBridge,
|
|
|
queries,
|
|
queries,
|
|
|
range,
|
|
range,
|
|
|
|
|
+ mode,
|
|
|
ui,
|
|
ui,
|
|
|
})
|
|
})
|
|
|
);
|
|
);
|
|
@@ -527,7 +528,7 @@ export function refreshExplore(exploreId: ExploreId): ThunkResult<void> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const { urlState, update, containerWidth, eventBridge } = itemState;
|
|
const { urlState, update, containerWidth, eventBridge } = itemState;
|
|
|
- const { datasource, queries, range: urlRange, ui } = urlState;
|
|
|
|
|
|
|
+ const { datasource, queries, range: urlRange, mode, ui } = urlState;
|
|
|
const refreshQueries: DataQuery[] = [];
|
|
const refreshQueries: DataQuery[] = [];
|
|
|
for (let index = 0; index < queries.length; index++) {
|
|
for (let index = 0; index < queries.length; index++) {
|
|
|
const query = queries[index];
|
|
const query = queries[index];
|
|
@@ -539,7 +540,7 @@ export function refreshExplore(exploreId: ExploreId): ThunkResult<void> {
|
|
|
// need to refresh datasource
|
|
// need to refresh datasource
|
|
|
if (update.datasource) {
|
|
if (update.datasource) {
|
|
|
const initialQueries = ensureQueries(queries);
|
|
const initialQueries = ensureQueries(queries);
|
|
|
- dispatch(initializeExplore(exploreId, datasource, initialQueries, range, containerWidth, eventBridge, ui));
|
|
|
|
|
|
|
+ dispatch(initializeExplore(exploreId, datasource, initialQueries, range, mode, containerWidth, eventBridge, ui));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -557,6 +558,11 @@ export function refreshExplore(exploreId: ExploreId): ThunkResult<void> {
|
|
|
dispatch(setQueriesAction({ exploreId, queries: refreshQueries }));
|
|
dispatch(setQueriesAction({ exploreId, queries: refreshQueries }));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // need to refresh mode
|
|
|
|
|
+ if (update.mode) {
|
|
|
|
|
+ dispatch(changeModeAction({ exploreId, mode }));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// always run queries when refresh is needed
|
|
// always run queries when refresh is needed
|
|
|
if (update.queries || update.ui || update.range) {
|
|
if (update.queries || update.ui || update.range) {
|
|
|
dispatch(runQueries(exploreId));
|
|
dispatch(runQueries(exploreId));
|