Use secondsToHms()

from grafana/data
This commit is contained in:
Alexander Zobnin
2021-01-20 12:20:46 +03:00
parent b220b407d3
commit 926631da96
2 changed files with 2 additions and 10 deletions

View File

@@ -1,9 +1,8 @@
import _ from 'lodash';
import moment from 'moment';
import kbn from 'grafana/app/core/utils/kbn';
import * as c from './constants';
import { VariableQuery, VariableQueryTypes } from './types';
import { arrowTableToDataFrame, isTableData, MappingType, ValueMap, ValueMapping, getValueFormats, DataFrame, FieldType } from '@grafana/data';
import { MappingType, ValueMapping, getValueFormats, DataFrame, FieldType, rangeUtil } from '@grafana/data';
/*
* This regex matches 3 types of variable reference with an optional format specifier
@@ -214,7 +213,7 @@ export function isTemplateVariable(str, templateVariables) {
export function getRangeScopedVars(range) {
const msRange = range.to.diff(range.from);
const sRange = Math.round(msRange / 1000);
const regularRange = kbn.secondsToHms(msRange / 1000);
const regularRange = rangeUtil.secondsToHms(msRange / 1000);
return {
__range_ms: { text: msRange, value: msRange },
__range_s: { text: sRange, value: sRange },

View File

@@ -68,13 +68,6 @@ jest.mock('grafana/app/core/utils/datemath', () => {
};
}, {virtual: true});
jest.mock('grafana/app/core/utils/kbn', () => {
return {
round_interval: n => n,
secondsToHms: n => n + 'ms'
};
}, {virtual: true});
jest.mock('grafana/app/core/table_model', () => {
return class TableModel {
constructor() {