mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeRangePicker: Use week start (#89765)
This commit is contained in:
@@ -2,8 +2,8 @@ import { Component } from 'react';
|
||||
import { Unsubscribable } from 'rxjs';
|
||||
|
||||
import { dateMath, TimeRange, TimeZone } from '@grafana/data';
|
||||
import { TimeRangeUpdatedEvent } from '@grafana/runtime';
|
||||
import { defaultIntervals, RefreshPicker } from '@grafana/ui';
|
||||
import { config, TimeRangeUpdatedEvent } from '@grafana/runtime';
|
||||
import { defaultIntervals, getWeekStart, RefreshPicker } from '@grafana/ui';
|
||||
import { TimePickerWithHistory } from 'app/core/components/TimePicker/TimePickerWithHistory';
|
||||
import { appEvents } from 'app/core/core';
|
||||
import { t } from 'app/core/internationalization';
|
||||
@@ -100,6 +100,7 @@ export class DashNavTimeControls extends Component<Props> {
|
||||
const timeZone = dashboard.getTimezone();
|
||||
const fiscalYearStartMonth = dashboard.fiscalYearStartMonth;
|
||||
const hideIntervalPicker = dashboard.panelInEdit?.isEditing;
|
||||
const weekStart = dashboard.weekStart || getWeekStart(config.bootData.user.weekStart);
|
||||
|
||||
let text: string | undefined = undefined;
|
||||
if (dashboard.refresh === AutoRefreshInterval) {
|
||||
@@ -120,6 +121,7 @@ export class DashNavTimeControls extends Component<Props> {
|
||||
onChangeFiscalYearStartMonth={this.onChangeFiscalYearStartMonth}
|
||||
isOnCanvas={isOnCanvas}
|
||||
onToolbarTimePickerClick={this.props.onToolbarTimePickerClick}
|
||||
weekStart={weekStart}
|
||||
/>
|
||||
<RefreshPicker
|
||||
onIntervalChanged={this.onChangeRefreshInterval}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Component } from 'react';
|
||||
|
||||
import { TimeRange, RawTimeRange, dateTimeForTimeZone, dateMath } from '@grafana/data';
|
||||
import { reportInteraction } from '@grafana/runtime';
|
||||
import { config, reportInteraction } from '@grafana/runtime';
|
||||
import { TimeZone } from '@grafana/schema';
|
||||
import { getWeekStart } from '@grafana/ui';
|
||||
import { TimePickerWithHistory } from 'app/core/components/TimePicker/TimePickerWithHistory';
|
||||
import { getShiftedTimeRange, getZoomedTimeRange } from 'app/core/utils/timePicker';
|
||||
|
||||
@@ -85,7 +86,7 @@ export class ExploreTimeControls extends Component<Props> {
|
||||
onZoom: this.onZoom,
|
||||
hideText,
|
||||
};
|
||||
|
||||
const weekStart = getWeekStart(config.bootData.user.weekStart);
|
||||
return (
|
||||
<TimePickerWithHistory
|
||||
isOnCanvas
|
||||
@@ -96,6 +97,7 @@ export class ExploreTimeControls extends Component<Props> {
|
||||
onChange={this.onChangeTimePicker}
|
||||
onChangeTimeZone={onChangeTimeZone}
|
||||
onChangeFiscalYearStartMonth={onChangeFiscalYearStartMonth}
|
||||
weekStart={weekStart}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user