Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
1fb38abf
Commit
1fb38abf
authored
Feb 29, 2016
by
Carl Bergquist
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4063 from mtanda/timeshift_template
timeFrom and timeShift templating
parents
4299feee
09dfaf98
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
public/app/core/directives/ng_model_on_blur.js
+3
-0
public/app/features/panel/metrics_panel_ctrl.ts
+7
-3
public/app/plugins/panel/singlestat/module.ts
+1
-1
No files found.
public/app/core/directives/ng_model_on_blur.js
View file @
1fb38abf
...
...
@@ -47,6 +47,9 @@ function (coreModule, kbn, rangeUtil) {
if
(
ctrl
.
$isEmpty
(
modelValue
))
{
return
true
;
}
if
(
viewValue
.
indexOf
(
'$'
)
===
0
)
{
return
true
;
// allow template variable
}
var
info
=
rangeUtil
.
describeTextRange
(
viewValue
);
return
info
.
invalid
!==
true
;
};
...
...
public/app/features/panel/metrics_panel_ctrl.ts
View file @
1fb38abf
...
...
@@ -17,6 +17,7 @@ class MetricsPanelCtrl extends PanelCtrl {
$timeout
:
any
;
datasourceSrv
:
any
;
timeSrv
:
any
;
templateSrv
:
any
;
timing
:
any
;
range
:
any
;
rangeRaw
:
any
;
...
...
@@ -34,6 +35,7 @@ class MetricsPanelCtrl extends PanelCtrl {
this
.
$q
=
$injector
.
get
(
'$q'
);
this
.
datasourceSrv
=
$injector
.
get
(
'datasourceSrv'
);
this
.
timeSrv
=
$injector
.
get
(
'timeSrv'
);
this
.
templateSrv
=
$injector
.
get
(
'templateSrv'
);
if
(
!
this
.
panel
.
targets
)
{
this
.
panel
.
targets
=
[{}];
...
...
@@ -119,7 +121,8 @@ class MetricsPanelCtrl extends PanelCtrl {
// check panel time overrrides
if
(
this
.
panel
.
timeFrom
)
{
var
timeFromInfo
=
rangeUtil
.
describeTextRange
(
this
.
panel
.
timeFrom
);
var
timeFromInterpolated
=
this
.
templateSrv
.
replace
(
this
.
panel
.
timeFrom
,
this
.
panel
.
scopedVars
);
var
timeFromInfo
=
rangeUtil
.
describeTextRange
(
timeFromInterpolated
);
if
(
timeFromInfo
.
invalid
)
{
this
.
timeInfo
=
'invalid time override'
;
return
;
...
...
@@ -136,13 +139,14 @@ class MetricsPanelCtrl extends PanelCtrl {
}
if
(
this
.
panel
.
timeShift
)
{
var
timeShiftInfo
=
rangeUtil
.
describeTextRange
(
this
.
panel
.
timeShift
);
var
timeShiftInterpolated
=
this
.
templateSrv
.
replace
(
this
.
panel
.
timeShift
,
this
.
panel
.
scopedVars
);
var
timeShiftInfo
=
rangeUtil
.
describeTextRange
(
timeShiftInterpolated
);
if
(
timeShiftInfo
.
invalid
)
{
this
.
timeInfo
=
'invalid timeshift'
;
return
;
}
var
timeShift
=
'-'
+
t
his
.
panel
.
timeShift
;
var
timeShift
=
'-'
+
t
imeShiftInterpolated
;
this
.
timeInfo
+=
' timeshift '
+
timeShift
;
this
.
range
.
from
=
dateMath
.
parseDateMath
(
timeShift
,
this
.
range
.
from
,
false
);
this
.
range
.
to
=
dateMath
.
parseDateMath
(
timeShift
,
this
.
range
.
to
,
true
);
...
...
public/app/plugins/panel/singlestat/module.ts
View file @
1fb38abf
...
...
@@ -50,7 +50,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
unitFormats
:
any
[];
/** @ngInject */
constructor
(
$scope
,
$injector
,
private
$location
,
private
linkSrv
,
private
templateSrv
)
{
constructor
(
$scope
,
$injector
,
private
$location
,
private
linkSrv
)
{
super
(
$scope
,
$injector
);
_
.
defaults
(
this
.
panel
,
panelDefaults
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment