mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(jsc): fixed javascript indenting
This commit is contained in:
parent
292db86c9e
commit
960a4f71a3
@ -163,20 +163,6 @@ function($, _, moment) {
|
|||||||
return info.sec * info.count;
|
return info.sec * info.count;
|
||||||
};
|
};
|
||||||
|
|
||||||
kbn.getRelativeTimeInfo = function(str) {
|
|
||||||
var info = {value: str};
|
|
||||||
if (str === 'today') {
|
|
||||||
info.text = 'Today';
|
|
||||||
info.from = 'today';
|
|
||||||
info.to = 'now';
|
|
||||||
} else {
|
|
||||||
info.text = 'Last ' + str;
|
|
||||||
info.from = 'now-'+str;
|
|
||||||
info.to = 'now';
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* This is a simplified version of elasticsearch's date parser */
|
/* This is a simplified version of elasticsearch's date parser */
|
||||||
kbn.parseDate = function(text) {
|
kbn.parseDate = function(text) {
|
||||||
if(_.isDate(text)) {
|
if(_.isDate(text)) {
|
||||||
@ -219,6 +205,20 @@ function($, _, moment) {
|
|||||||
return kbn.parseDateMath(mathString, time);
|
return kbn.parseDateMath(mathString, time);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
kbn.getRelativeTimeInfo = function(str) {
|
||||||
|
var info = {value: str};
|
||||||
|
if (str === 'today') {
|
||||||
|
info.text = 'Today';
|
||||||
|
info.from = 'today';
|
||||||
|
info.to = 'now';
|
||||||
|
} else {
|
||||||
|
info.text = 'Last ' + str;
|
||||||
|
info.from = 'now-'+str;
|
||||||
|
info.to = 'now';
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
};
|
||||||
|
|
||||||
kbn._timespanRegex = /^(\d+[h,m,M,w,s,H,d])|today$/;
|
kbn._timespanRegex = /^(\d+[h,m,M,w,s,H,d])|today$/;
|
||||||
kbn.isValidTimeSpan = function(str) {
|
kbn.isValidTimeSpan = function(str) {
|
||||||
return kbn._timespanRegex.test(str);
|
return kbn._timespanRegex.test(str);
|
||||||
|
@ -69,7 +69,7 @@ function (angular, _, kbn, $) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_.isString(scope.rangeUnparsed.from)) {
|
if (_.isString(scope.rangeUnparsed.from)) {
|
||||||
var timeInfo = kbn.getRelativeTimeInfo(scope.panel.timeFrom)
|
var timeInfo = kbn.getRelativeTimeInfo(scope.panel.timeFrom);
|
||||||
scope.panelMeta.timeInfo = timeInfo.text;
|
scope.panelMeta.timeInfo = timeInfo.text;
|
||||||
scope.rangeUnparsed.from = timeInfo.from;
|
scope.rangeUnparsed.from = timeInfo.from;
|
||||||
scope.rangeUnparsed.to = timeInfo.to;
|
scope.rangeUnparsed.to = timeInfo.to;
|
||||||
|
Loading…
Reference in New Issue
Block a user