mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix: Recalculate intervals in Explore on run queries (#16510)
Fixes: #16485
This commit is contained in:
@@ -209,6 +209,10 @@ export interface LoadExploreDataSourcesPayload {
|
|||||||
exploreDatasources: DataSourceSelectItem[];
|
exploreDatasources: DataSourceSelectItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RunQueriesPayload {
|
||||||
|
exploreId: ExploreId;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a query row after the row with the given index.
|
* Adds a query row after the row with the given index.
|
||||||
*/
|
*/
|
||||||
@@ -324,7 +328,8 @@ export const queryTransactionSuccessAction = actionCreatorFactory<QueryTransacti
|
|||||||
* Remove query row of the given index, as well as associated query results.
|
* Remove query row of the given index, as well as associated query results.
|
||||||
*/
|
*/
|
||||||
export const removeQueryRowAction = actionCreatorFactory<RemoveQueryRowPayload>('explore/REMOVE_QUERY_ROW').create();
|
export const removeQueryRowAction = actionCreatorFactory<RemoveQueryRowPayload>('explore/REMOVE_QUERY_ROW').create();
|
||||||
export const runQueriesAction = noPayloadActionCreatorFactory('explore/RUN_QUERIES').create();
|
|
||||||
|
export const runQueriesAction = actionCreatorFactory<RunQueriesPayload>('explore/RUN_QUERIES').create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a scan for more results using the given scanner.
|
* Start a scan for more results using the given scanner.
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ export function runQueries(exploreId: ExploreId, ignoreUIState = false): ThunkRe
|
|||||||
// but we're using the datasource interval limit for now
|
// but we're using the datasource interval limit for now
|
||||||
const interval = datasourceInstance.interval;
|
const interval = datasourceInstance.interval;
|
||||||
|
|
||||||
dispatch(runQueriesAction());
|
dispatch(runQueriesAction({ exploreId }));
|
||||||
// Keep table queries first since they need to return quickly
|
// Keep table queries first since they need to return quickly
|
||||||
if ((ignoreUIState || showingTable) && supportsTable) {
|
if ((ignoreUIState || showingTable) && supportsTable) {
|
||||||
dispatch(
|
dispatch(
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
splitCloseAction,
|
splitCloseAction,
|
||||||
SplitCloseActionPayload,
|
SplitCloseActionPayload,
|
||||||
loadExploreDatasources,
|
loadExploreDatasources,
|
||||||
|
runQueriesAction,
|
||||||
} from './actionTypes';
|
} from './actionTypes';
|
||||||
import { reducerFactory } from 'app/core/redux';
|
import { reducerFactory } from 'app/core/redux';
|
||||||
import {
|
import {
|
||||||
@@ -165,14 +166,8 @@ export const itemReducer = reducerFactory<ExploreItemState>({} as ExploreItemSta
|
|||||||
.addMapper({
|
.addMapper({
|
||||||
filter: changeSizeAction,
|
filter: changeSizeAction,
|
||||||
mapper: (state, action): ExploreItemState => {
|
mapper: (state, action): ExploreItemState => {
|
||||||
const { range, datasourceInstance } = state;
|
|
||||||
let interval = '1s';
|
|
||||||
if (datasourceInstance && datasourceInstance.interval) {
|
|
||||||
interval = datasourceInstance.interval;
|
|
||||||
}
|
|
||||||
const containerWidth = action.payload.width;
|
const containerWidth = action.payload.width;
|
||||||
const queryIntervals = getIntervals(range, interval, containerWidth);
|
return { ...state, containerWidth };
|
||||||
return { ...state, containerWidth, queryIntervals };
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.addMapper({
|
.addMapper({
|
||||||
@@ -266,13 +261,9 @@ export const itemReducer = reducerFactory<ExploreItemState>({} as ExploreItemSta
|
|||||||
.addMapper({
|
.addMapper({
|
||||||
filter: loadDatasourceReadyAction,
|
filter: loadDatasourceReadyAction,
|
||||||
mapper: (state, action): ExploreItemState => {
|
mapper: (state, action): ExploreItemState => {
|
||||||
const { containerWidth, range, datasourceInstance } = state;
|
|
||||||
const { history } = action.payload;
|
const { history } = action.payload;
|
||||||
const queryIntervals = getIntervals(range, datasourceInstance.interval, containerWidth);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
queryIntervals,
|
|
||||||
history,
|
history,
|
||||||
datasourceLoading: false,
|
datasourceLoading: false,
|
||||||
datasourceMissing: false,
|
datasourceMissing: false,
|
||||||
@@ -559,6 +550,21 @@ export const itemReducer = reducerFactory<ExploreItemState>({} as ExploreItemSta
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
.addMapper({
|
||||||
|
filter: runQueriesAction,
|
||||||
|
mapper: (state): ExploreItemState => {
|
||||||
|
const { range, datasourceInstance, containerWidth } = state;
|
||||||
|
let interval = '1s';
|
||||||
|
if (datasourceInstance && datasourceInstance.interval) {
|
||||||
|
interval = datasourceInstance.interval;
|
||||||
|
}
|
||||||
|
const queryIntervals = getIntervals(range, interval, containerWidth);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
queryIntervals,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
})
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
export const updateChildRefreshState = (
|
export const updateChildRefreshState = (
|
||||||
|
|||||||
Reference in New Issue
Block a user