mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 08:35:43 -06:00
Explore: Fix timepicker when browsing back after switching datasource (#21454)
This commit is contained in:
parent
a1579283a6
commit
ba7d8c1a3d
@ -31,6 +31,7 @@ import {
|
||||
DataSourceApi,
|
||||
PanelData,
|
||||
RawTimeRange,
|
||||
TimeRange,
|
||||
GraphSeriesXY,
|
||||
TimeZone,
|
||||
AbsoluteTimeRange,
|
||||
@ -51,6 +52,7 @@ import {
|
||||
DEFAULT_RANGE,
|
||||
DEFAULT_UI_STATE,
|
||||
getTimeRangeFromUrl,
|
||||
getTimeRange,
|
||||
lastUsedDatasourceKeyForOrgId,
|
||||
} from 'app/core/utils/explore';
|
||||
import { Emitter } from 'app/core/utils/emitter';
|
||||
@ -93,7 +95,7 @@ interface ExploreProps {
|
||||
queryKeys: string[];
|
||||
initialDatasource: string;
|
||||
initialQueries: DataQuery[];
|
||||
initialRange: RawTimeRange;
|
||||
initialRange: TimeRange;
|
||||
mode: ExploreMode;
|
||||
initialUI: ExploreUIState;
|
||||
isLive: boolean;
|
||||
@ -394,7 +396,9 @@ function mapStateToProps(state: StoreState, { exploreId }: ExploreProps): Partia
|
||||
{}) as ExploreUrlState;
|
||||
const initialDatasource = datasource || store.get(lastUsedDatasourceKeyForOrgId(state.user.orgId));
|
||||
const initialQueries: DataQuery[] = ensureQueriesMemoized(queries);
|
||||
const initialRange = urlRange ? getTimeRangeFromUrlMemoized(urlRange, timeZone).raw : DEFAULT_RANGE;
|
||||
const initialRange = urlRange
|
||||
? getTimeRangeFromUrlMemoized(urlRange, timeZone)
|
||||
: getTimeRange(timeZone, DEFAULT_RANGE);
|
||||
|
||||
let newMode: ExploreMode | undefined;
|
||||
|
||||
|
@ -265,7 +265,7 @@ export function initializeExplore(
|
||||
exploreId: ExploreId,
|
||||
datasourceName: string,
|
||||
queries: DataQuery[],
|
||||
rawRange: RawTimeRange,
|
||||
range: TimeRange,
|
||||
mode: ExploreMode,
|
||||
containerWidth: number,
|
||||
eventBridge: Emitter,
|
||||
@ -273,8 +273,6 @@ export function initializeExplore(
|
||||
originPanelId: number
|
||||
): ThunkResult<void> {
|
||||
return async (dispatch, getState) => {
|
||||
const timeZone = getTimeZone(getState().user);
|
||||
const range = getTimeRange(timeZone, rawRange);
|
||||
dispatch(loadExploreDatasourcesAndSetDatasource(exploreId, datasourceName));
|
||||
dispatch(
|
||||
initializeExploreAction({
|
||||
|
Loading…
Reference in New Issue
Block a user