mirror of
https://github.com/grafana/grafana.git
synced 2025-09-21 07:23:09 +08:00
Alerting: Lower the default timerange (#34280)
* use a custom default * use default function
This commit is contained in:
@ -67,7 +67,7 @@ export function getDefaultTimeRange(): TimeRange {
|
|||||||
*/
|
*/
|
||||||
export function getDefaultRelativeTimeRange(): RelativeTimeRange {
|
export function getDefaultRelativeTimeRange(): RelativeTimeRange {
|
||||||
return {
|
return {
|
||||||
from: 21600,
|
from: 600,
|
||||||
to: 0,
|
to: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { DataQuery, getDefaultTimeRange, rangeUtil, RelativeTimeRange } from '@grafana/data';
|
import { DataQuery, rangeUtil, RelativeTimeRange } from '@grafana/data';
|
||||||
import { getDataSourceSrv } from '@grafana/runtime';
|
import { getDataSourceSrv } from '@grafana/runtime';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import { getNextRefIdChar } from 'app/core/utils/query';
|
import { getNextRefIdChar } from 'app/core/utils/query';
|
||||||
@ -22,6 +22,7 @@ import { isGrafanaRulesSource } from './datasource';
|
|||||||
import { arrayToRecord, recordToArray } from './misc';
|
import { arrayToRecord, recordToArray } from './misc';
|
||||||
import { isAlertingRulerRule, isGrafanaRulerRule } from './rules';
|
import { isAlertingRulerRule, isGrafanaRulerRule } from './rules';
|
||||||
import { parseInterval } from './time';
|
import { parseInterval } from './time';
|
||||||
|
import { getDefaultRelativeTimeRange } from '../../../../../../packages/grafana-data';
|
||||||
|
|
||||||
export const getDefaultFormValues = (): RuleFormValues =>
|
export const getDefaultFormValues = (): RuleFormValues =>
|
||||||
Object.freeze({
|
Object.freeze({
|
||||||
@ -140,9 +141,7 @@ export const getDefaultQueries = (): GrafanaQuery[] => {
|
|||||||
if (!dataSource) {
|
if (!dataSource) {
|
||||||
return [getDefaultExpression('A')];
|
return [getDefaultExpression('A')];
|
||||||
}
|
}
|
||||||
|
const relativeTimeRange = getDefaultRelativeTimeRange();
|
||||||
const timeRange = getDefaultTimeRange();
|
|
||||||
const relativeTimeRange = rangeUtil.timeRangeToRelative(timeRange);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user