2015-01-31 18:00:26 +01:00
< div ng-controller = "TemplateEditorCtrl" ng-init = "init()" >
2016-02-24 11:56:45 +01:00
< div class = "tabbed-view-header" >
< h2 class = "tabbed-view-title" >
2015-02-01 15:45:11 +01:00
Templating
2016-02-24 11:56:45 +01:00
< / h2 >
2015-02-01 15:45:11 +01:00
2016-02-24 11:56:45 +01:00
< ul class = "gf-tabs" >
< li class = "gf-tabs-item" >
< a class = "gf-tabs-link" ng-click = "mode = 'list';" ng-class = "{active: mode === 'list'}" >
Variables
< / a >
< / li >
< li class = "gf-tabs-item" ng-show = "mode === 'edit'" >
< a class = "gf-tabs-link" ng-class = "{active: mode === 'edit'}" >
2016-03-01 19:12:54 +01:00
Edit
2016-02-24 11:56:45 +01:00
< / a >
< / li >
2016-02-24 15:18:08 +01:00
< li class = "gf-tabs-item" ng-show = "mode === 'new'" >
< span class = "active gf-tabs-link" > New< / span >
2016-02-24 11:56:45 +01:00
< / li >
< / ul >
2015-09-08 15:54:08 +02:00
2016-02-24 11:56:45 +01:00
< button class = "tabbed-view-close-btn" ng-click = "dismiss();dashboard.refresh();" >
2015-01-31 18:00:26 +01:00
< i class = "fa fa-remove" > < / i >
< / button >
2014-08-26 14:17:46 +02:00
< / div >
2014-08-25 22:39:40 +02:00
2016-02-24 11:56:45 +01:00
< div class = "tabbed-view-body" >
2014-08-25 22:39:40 +02:00
2015-09-08 15:54:08 +02:00
< div ng-if = "mode === 'list'" >
2016-02-24 15:18:08 +01:00
< div ng-if = "variables.length === 0" >
< em > No template variables defined< / em >
2014-08-26 14:17:46 +02:00
< / div >
2016-02-24 15:18:08 +01:00
< table class = "grafana-options-table" >
< tr ng-repeat = "variable in variables" >
< td style = "width: 1%" >
< span class = "template-variable" >
${{variable.name}}
< / span >
< / td >
< td class = "max-width" style = "max-width: 200px;" >
{{variable.query}}
< / td >
2014-08-26 14:17:46 +02:00
2016-02-24 15:18:08 +01:00
< td style = "width: 1%" > < i ng-click = "_.move(variables,$index,$index-1)" ng-hide = "$first" class = "pointer fa fa-arrow-up" > < / i > < / td >
< td style = "width: 1%" > < i ng-click = "_.move(variables,$index,$index+1)" ng-hide = "$last" class = "pointer fa fa-arrow-down" > < / i > < / td >
< td style = "width: 1%" >
< a ng-click = "duplicate(variable)" class = "btn btn-inverse btn-mini" >
Duplicate
< / a >
< / td >
< td style = "width: 1%" >
< a ng-click = "edit(variable)" class = "btn btn-inverse btn-mini" >
< i class = "fa fa-edit" > < / i >
Edit
< / a >
< / td >
< td style = "width: 1%" >
< a ng-click = "removeVariable(variable)" class = "btn btn-danger btn-mini" >
< i class = "fa fa-remove" > < / i >
< / a >
< / td >
< / tr >
< / table >
2014-08-25 22:39:40 +02:00
< / div >
2016-02-24 15:18:08 +01:00
< div class = "gf-form" ng-show = "mode === 'list'" >
< div class = "gf-form-button-row" >
< a type = "button" class = "btn gf-form-button btn-success" ng-click = "mode = 'new';" > < i class = "fa fa-plus" > < / i > New< / a >
2015-05-05 10:56:39 +02:00
< / div >
2014-08-25 22:39:40 +02:00
< / div >
2015-05-05 10:56:39 +02:00
2015-09-08 15:54:08 +02:00
< div ng-if = "mode === 'edit' || mode === 'new'" >
2016-02-24 17:49:08 +01:00
< h5 class = "section-heading" > Variable< / h5 >
2016-02-23 18:31:08 +01:00
< div class = "gf-form-group" >
< div class = "gf-form-inline" >
2016-03-29 22:23:29 +02:00
< div class = "gf-form max-width-19" >
2016-02-24 17:49:08 +01:00
< span class = "gf-form-label width-7" > Name< / span >
2016-03-29 22:23:29 +02:00
< input type = "text" class = "gf-form-input max-width-12" placeholder = "name" ng-model = 'current.name' > < / input >
2014-08-29 12:34:04 +02:00
< / div >
2016-02-24 17:49:08 +01:00
< div class = "gf-form" >
2016-02-29 17:07:53 +01:00
< span class = "gf-form-label width-4" > Type< / span >
2016-03-29 22:23:29 +02:00
< div class = "gf-form-select-wrapper" >
< select class = "gf-form-input width-7" ng-model = "current.type" ng-options = "f for f in ['query', 'interval', 'custom']" ng-change = "typeChanged()" > < / select >
2015-03-19 23:09:50 -04:00
< / div >
< / div >
2016-03-29 22:23:29 +02:00
< div class = "gf-form max-width-19" >
2016-02-24 17:49:08 +01:00
< span class = "gf-form-label width-7" ng-show = "current.type === 'query'" > Data source< / span >
2016-03-29 22:23:29 +02:00
< div class = "gf-form-select-wrapper max-width-12" ng-show = "current.type === 'query'" >
< select class = "gf-form-input" ng-model = "current.datasource" ng-options = "f.value as f.name for f in datasources" > < / select >
2014-08-29 12:34:04 +02:00
< / div >
2014-08-27 21:47:41 +02:00
< / div >
2015-01-31 18:00:26 +01:00
< / div >
2016-02-29 10:29:40 +01:00
< div class = "gf-form-inline" >
2016-03-29 22:23:29 +02:00
< div class = "gf-form max-width-19" >
2016-02-29 10:29:40 +01:00
< span class = "gf-form-label width-7" > Label< / span >
2016-03-29 22:23:29 +02:00
< input type = "text" class = "gf-form-input max-width-12" ng-model = 'current.label' placeholder = "optional display name" > < / input >
2016-02-29 10:29:40 +01:00
< / div >
< div class = "gf-form" >
2016-02-29 17:07:53 +01:00
< span class = "gf-form-label width-4" > Hide< / span >
2016-03-29 22:23:29 +02:00
< div class = "gf-form-select-wrapper" >
< select class = "gf-form-input width-7" ng-model = "current.hide" ng-options = "f.value as f.text for f in hideOptions" > < / select >
< / div >
2016-02-29 10:29:40 +01:00
< / div >
2015-05-05 10:56:39 +02:00
< / div >
2016-02-29 10:29:40 +01:00
2015-05-05 10:56:39 +02:00
< / div >
2014-08-27 21:47:41 +02:00
2016-02-24 17:49:08 +01:00
< h5 class = "section-heading" > Value Options< / h5 >
2016-02-23 18:31:08 +01:00
< div ng-show = "current.type === 'interval'" class = "gf-form-group" >
< div class = "gf-form" >
2016-03-01 19:12:54 +01:00
< span class = "gf-form-label width-9" > Values< / span >
< input type = "text" class = "gf-form-input" placeholder = "name" ng-model = 'current.query' placeholder = "1m,10m,1h,6h,1d,7d" ng-model-onblur ng-change = "runQuery()" > < / input >
2016-02-23 18:31:08 +01:00
< / div >
< div class = "gf-form" >
2016-03-01 19:12:54 +01:00
< span class = "gf-form-label width-9" > Auto option< / span >
< editor-checkbox text = "Enable" model = "current.auto" change = "runQuery()" > < / editor-checkbox >
2015-05-05 10:56:39 +02:00
< / div >
2016-03-01 19:12:54 +01:00
< div class = "gf-form-inline" >
< div class = "gf-form" >
< span class = "gf-form-label width-9" ng-show = "current.auto" >
Auto steps < tip > How many times should the current time range be divided to calculate the value< / tip >
< / span >
< div class = "gf-form-select-wrapper max-width-10" ng-show = "current.auto" >
< select class = "gf-form-input" ng-model = "current.auto_count" ng-options = "f for f in [2,3,4,5,10,20,30,40,50,100,200,300,400,500]" ng-change = "runQuery()" > < / select >
< / div >
< / div >
< div class = "gf-form" >
< span class = "gf-form-label" ng-show = "current.auto" >
Min interval < tip > The calculated value will not go below this threshold< / tip >
< / span >
< input type = "text" class = "gf-form-input max-width-10" ng-show = "current.auto" ng-model = "current.auto_min" ng-change = "runQuery()" placeholder = "10s" > < / input >
< / div >
2016-02-28 10:43:11 +01:00
< / div >
2016-02-23 18:31:08 +01:00
< / div >
2014-09-05 14:03:36 +02:00
2016-02-23 18:31:08 +01:00
< div ng-show = "current.type === 'custom'" class = "gf-form-group" >
< div class = "gf-form" >
< span class = "gf-form-label width-13" > Values seperated by comma< / span >
2016-03-01 19:12:54 +01:00
< input type = "text" class = "gf-form-input" ng-model = 'current.query' ng-blur = "runQuery()" placeholder = "1, 10, 20, myvalue" > < / input >
2015-05-05 10:56:39 +02:00
< / div >
< / div >
2014-08-29 12:34:04 +02:00
2016-02-23 18:31:08 +01:00
< div ng-show = "current.type === 'query'" class = "gf-form-group" >
< div class = "gf-form" >
< span class = "gf-form-label width-7" > Query< / span >
< input type = "text" class = "gf-form-input" ng-model = 'current.query' placeholder = "metric name or tags query" ng-model-onblur ng-change = "runQuery()" > < / input >
2016-03-01 21:01:41 +01:00
<!-- <info-popover position="bottom center" wide="true"> -->
<!-- Example queries: -->
<!-- <ul> -->
<!-- <li> -->
<!-- <code>SHOW TAG VALUES WITH KEY = "hostname"</code> -->
<!-- </li> -->
<!-- <li> -->
<!-- <code>SHOW TAG VALUES WITH KEY = "hostname"</code> -->
<!-- </li> -->
<!-- <li> -->
<!-- <code>SHOW TAG VALUES WITH KEY = "hostname"</code> -->
<!-- </li> -->
<!-- <li> -->
<!-- <a href="http://docs.grafana.org" target="_blank">Templating docs</a> -->
<!-- </li> -->
<!-- </ul> -->
<!-- </info-popover> -->
2016-02-23 18:31:08 +01:00
< / div >
< div class = "gf-form" >
< span class = "gf-form-label width-7" >
Regex
< tip > Optional, if you want to extract part of a series name or metric node segment< / tip >
< / span >
< input type = "text" class = "gf-form-input" ng-model = 'current.regex' placeholder = "/.*-(.*)-.*/" ng-model-onblur ng-change = "runQuery()" > < / input >
< / div >
< div class = "gf-form" >
2015-12-10 23:14:37 -05:00
< span class = "gf-form-label width-7" > Refresh< / span >
2016-03-09 13:10:02 +01:00
< select class = "gf-form-input max-width-14" ng-model = "current.refresh" ng-options = "f.value as f.text for f in refreshOptions" > < / select >
< tip > When to update the values of this variable, will slow down dashboard load / time change< / tip >
2015-01-31 18:00:26 +01:00
< / div >
2015-05-28 11:16:16 +02:00
< / div >
2015-05-20 18:18:03 +02:00
2016-03-29 22:23:29 +02:00
< div class = "section gf-form-group" >
2016-03-01 19:12:54 +01:00
< h5 class = "section-heading" > Selection Options< / h5 >
2016-03-29 22:23:29 +02:00
< gf-form-switch class = "gf-form"
label="Multi-value"
label-class="width-10"
tooltip="Enables multiple values to be selected at the same time"
checked="current.multi"
on-change="runQuery()">
< / gf-form-switch >
< gf-form-switch class = "gf-form"
label="Include All option"
label-class="width-10"
checked="current.includeAll"
on-change="runQuery()">
< / gf-form-switch >
2016-03-01 19:12:54 +01:00
< div class = "gf-form" ng-if = "current.includeAll" >
< span class = "gf-form-label width-10" > Custom all value< / span >
2016-03-02 07:52:48 +01:00
< input type = "text" class = "gf-form-input max-width-15" ng-model = 'current.allValue' placeholder = "blank = auto" > < / input >
2014-08-26 14:17:46 +02:00
< / div >
< / div >
2014-08-29 12:34:04 +02:00
2016-02-23 18:31:08 +01:00
< div class = "gf-form-group" ng-if = "current.type === 'query'" >
< h5 > Value groups/tags (Experimental feature)< / h5 >
< div class = "gf-form" >
< editor-checkbox text = "Enable" model = "current.useTags" change = "runQuery()" > < / editor-checkbox >
< / div >
< div class = "gf-form last" ng-if = "current.useTags" >
< span class = "gf-form-label width-10" > Tags query< / span >
< input type = "text" class = "gf-form-input" ng-model = 'current.tagsQuery' placeholder = "metric name or tags query" ng-model-onblur > < / input >
< / div >
< div class = "gf-form" ng-if = "current.useTags" >
< li class = "gf-form-label width-10" > Tag values query< / li >
< input type = "text" class = "gf-form-input" ng-model = 'current.tagValuesQuery' placeholder = "apps.$tag.*" ng-model-onblur > < / input >
2015-05-28 11:16:16 +02:00
< / div >
< / div >
2015-05-20 18:18:03 +02:00
2016-02-23 18:31:08 +01:00
< div class = "gf-form-group" >
< h5 > Preview of values (shows max 20)< / h5 >
< div class = "gf-form" >
< span class = "gf-form-label" ng-repeat = "option in current.options | limitTo: 20" >
{{option.text}}
< / span >
2014-08-26 14:17:46 +02:00
< / div >
< / div >
2015-05-05 10:56:39 +02:00
< / div >
2014-08-26 14:17:46 +02:00
2016-02-24 17:49:08 +01:00
< div class = "gf-form-button-row p-y-0" >
2015-09-08 15:54:08 +02:00
< button type = "button" class = "btn btn-success" ng-show = "mode === 'edit'" ng-click = "update();" > Update< / button >
< button type = "button" class = "btn btn-success" ng-show = "mode === 'new'" ng-click = "add();" > Add< / button >
2015-03-19 23:09:50 -04:00
< / div >
2014-08-26 14:17:46 +02:00
< / div >
2015-05-05 10:56:39 +02:00
< / div >
2014-08-26 14:17:46 +02:00