2015-01-31 18:00:26 +01:00
< div ng-controller = "TemplateEditorCtrl" ng-init = "init()" >
< div class = "gf-box-header" >
2015-02-01 15:45:11 +01:00
< div class = "gf-box-title" >
< i class = "fa fa-code" > < / i >
Templating
< / div >
2014-08-26 14:17:46 +02:00
< div ng-model = "editor.index" bs-tabs style = "text-transform:capitalize;" >
2014-08-28 16:03:13 +02:00
< div ng-repeat = "tab in ['Variables', 'Add', 'Edit']" data-title = "{{tab}}" >
2014-08-26 14:17:46 +02:00
< / div >
2014-08-25 15:55:42 +02:00
< / div >
2015-01-31 18:00:26 +01:00
< button class = "gf-box-header-close-btn" ng-click = "dismiss();dashboard.refresh();" >
< i class = "fa fa-remove" > < / i >
< / button >
2014-08-26 14:17:46 +02:00
< / div >
2014-08-25 22:39:40 +02:00
2015-01-31 18:00:26 +01:00
< div class = "gf-box-body" >
2014-08-25 22:39:40 +02:00
< div ng-if = "editor.index == 0" >
2014-08-26 14:17:46 +02:00
2014-08-27 10:41:27 +02:00
< div class = "editor-row row" >
< div class = "span8" >
2014-08-28 12:44:01 +02:00
< div ng-if = "variables.length === 0" >
2014-08-29 10:17:00 +02:00
< em > No template variables defined< / em >
2014-08-26 14:17:46 +02:00
< / div >
2014-08-27 10:41:27 +02:00
< table class = "grafana-options-table" >
2014-08-28 12:44:01 +02:00
< tr ng-repeat = "variable in variables" >
2014-08-27 15:54:30 +02:00
< td style = "width: 1%" >
2014-09-06 10:05:58 +02:00
< span class = "template-variable" >
${{variable.name}}
< / span >
2014-08-27 10:41:27 +02:00
< / td >
< td class = "max-width" style = "max-width: 200px;" >
2014-08-28 12:44:01 +02:00
{{variable.query}}
2014-08-27 10:41:27 +02:00
< / td >
< td style = "width: 1%" >
2015-03-19 23:09:50 -04:00
< a ng-click = "edit(variable)" class = "btn btn-inverse btn-small" >
2015-01-08 11:03:27 +01:00
< i class = "fa fa-edit" > < / i >
2014-08-26 14:17:46 +02:00
Edit
< / a >
< / td >
2015-01-08 11:03:27 +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 >
2014-08-27 10:41:27 +02:00
< td style = "width: 1%" >
2015-01-17 08:27:55 +01:00
< a ng-click = "removeVariable(variable)" class = "btn btn-danger btn-small" >
2015-01-08 11:03:27 +01:00
< i class = "fa fa-remove" > < / i >
2014-08-26 14:17:46 +02:00
< / a >
< / td >
< / tr >
< / table >
< / div >
< / div >
2014-08-25 22:39:40 +02:00
< / div >
2014-08-27 10:41:27 +02:00
< div ng-if = "editor.index == 1 || (editor.index == 2 && !currentIsNew)" >
2015-03-19 23:09:50 -04:00
< div class = "editor-row" >
2015-05-05 10:56:39 +02:00
< div class = "tight-form-section" >
< h5 > Variable< / h5 >
< div class = "tight-form last" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 100px" >
Name
< / li >
< li >
2015-05-19 08:46:45 +02:00
< input type = "text" class = "input-large tight-form-input" placeholder = "name" ng-model = 'current.name' > < / input >
2015-05-05 10:56:39 +02:00
< / li >
< li class = "tight-form-item" >
Type
< / li >
< li >
< select class = "input-small tight-form-input" ng-model = "current.type" ng-options = "f for f in ['query', 'interval', 'custom']" ng-change = "typeChanged()" > < / select >
< / li >
< li class = "tight-form-item" ng-show = "current.type === 'query'" >
Data source
< / li >
< li ng-show = "current.type === 'query'" >
< select class = "input input-medium tight-form-input last" ng-model = "current.datasource" ng-options = "f.value as f.name for f in datasources" > < / select >
< / li >
< / ul >
< div class = "clearfix" > < / div >
2015-01-31 18:00:26 +01:00
< / div >
2015-05-05 10:56:39 +02:00
< / div >
< / div >
< div class = "editor-row" >
< div class = "tight-form-section" >
< h5 > Value Options< / h5 >
2015-03-19 23:09:50 -04:00
< div ng-show = "current.type === 'interval'" >
2015-05-05 10:56:39 +02:00
< div class = "tight-form" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 160px" >
Values
< / li >
< li >
< input type = "text" style = "width: 345px" class = "input-xxlarge tight-form-input last" placeholder = "name" ng-model = 'current.query' placeholder = "1m,10m,1h,6h,1d,7d" ng-model-onblur ng-change = "runQuery()" > < / input >
< / li >
< / ul >
< div class = "clearfix" > < / div >
< / div >
< div class = "tight-form last" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 160px" >
2015-05-05 13:33:57 +02:00
< editor-checkbox text = "Include auto interval" model = "current.auto" change = "runQuery()" > < / editor-checkbox >
2015-05-05 10:56:39 +02:00
< / li >
< li class = "tight-form-item" ng-show = "current.auto" >
Auto interval steps < tip > How many steps, roughly, the interval is rounded and will not always match this count< tip >
< / li >
< li >
< select class = "input-mini tight-form-input last" ng-model = "current.auto_count" ng-options = "f for f in [3,5,10,30,50,100,200]" ng-change = "runQuery()" > < / select >
< / li >
< / ul >
< div class = "clearfix" > < / div >
2014-08-29 12:34:04 +02:00
< / div >
< / div >
2014-08-27 15:54:30 +02:00
2015-03-19 23:09:50 -04:00
< div ng-show = "current.type === 'custom'" >
2015-05-05 10:56:39 +02:00
< div class = "tight-form last" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 180px" >
Values seperated by comma
< / li >
< li >
< input type = "text" class = "input tight-form-input last" style = "width: 325px;" ng-model = 'current.query' ng-blur = "runQuery()" placeholder = "1, 10, 20, myvalue" > < / input >
< / li >
< / ul >
< div class = "clearfix" > < / div >
2015-03-19 23:09:50 -04:00
< / div >
< / div >
< div ng-show = "current.type === 'query'" >
2015-05-05 10:56:39 +02:00
< div class = "tight-form" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 100px" >
Query
< / li >
< li >
2015-05-19 08:46:45 +02:00
< input type = "text" style = "width: 588px" class = "input-xxlarge tight-form-input last" ng-model = 'current.query' placeholder = "metric name or tags query" ng-model-onblur ng-change = "runQuery()" > < / input >
2015-05-05 10:56:39 +02:00
< / li >
< / ul >
< div class = "clearfix" > < / div >
< / div >
< div class = "tight-form" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 100px;" >
Regex
< tip > Optional, if you want to extract part of a series name or metric node segment< / tip >
< / li >
< li >
2015-05-18 11:47:12 +02:00
< input type = "text" style = "width: 588px" class = "input tight-form-input last" ng-model = 'current.regex' placeholder = "/.*-(.*)-.*/" ng-model-onblur ng-change = "runQuery()" > < / input >
2015-05-05 10:56:39 +02:00
< / li >
< / ul >
< div class = "clearfix" > < / div >
2015-03-19 23:09:50 -04:00
< / div >
2015-05-05 10:56:39 +02:00
< div class = "tight-form" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 100px;" >
2015-05-05 13:33:57 +02:00
< editor-checkbox text = "All value" model = "current.includeAll" change = "runQuery()" > < / editor-checkbox >
2015-05-05 10:56:39 +02:00
< / li >
< li ng-show = "current.includeAll" >
2015-05-18 11:47:12 +02:00
< input type = "text" class = "input-xlarge tight-form-input" style = "width:364px" ng-model = 'current.options[0].value' > < / input >
2015-05-05 10:56:39 +02:00
< / li >
< li class = "tight-form-item" ng-show = "current.includeAll" >
All format
< / li >
< li ng-show = "current.includeAll" >
< select class = "input-medium tight-form-input last" ng-model = "current.allFormat" ng-change = "runQuery()" ng-options = "f for f in ['glob', 'wildcard', 'regex wildcard', 'regex values']" > < / select >
< / li >
< / ul >
< div class = "clearfix" > < / div >
2015-03-19 23:09:50 -04:00
< / div >
2015-05-05 10:56:39 +02:00
< div class = "tight-form last" >
< ul class = "tight-form-list" >
2015-05-05 13:33:57 +02:00
< li class = "tight-form-item last" >
< editor-checkbox text = "Refresh on load" model = "current.refresh" > < / editor-checkbox >
2015-05-05 10:56:39 +02:00
< tip > Check if you want values to be updated on dashboard load, will slow down dashboard load time< / tip >
< / li >
< / ul >
< div class = "clearfix" > < / div >
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 >
2015-05-05 10:56:39 +02:00
< / div >
2014-08-27 21:47:41 +02:00
2015-05-05 10:56:39 +02:00
< div class = "editor-row" >
< div class = "tight-form-section" ng-hide = "current.type === 'interval'" >
< h5 > Multi-value selection < tip > Enables multiple values to be selected at the same time< / tip > < / h5 >
< div class = "tight-form last" >
< ul class = "tight-form-list" >
< li class = "tight-form-item last" style = "width: 100px;" >
2015-05-05 13:33:57 +02:00
< editor-checkbox text = "Enable" model = "current.multi" change = "runQuery()" > < / editor-checkbox >
2015-05-05 10:56:39 +02:00
< / li >
< li class = "tight-form-item" ng-show = "current.multi" >
Multi format
< / li >
< li ng-show = "current.multi" >
< select class = "input-small tight-form-input last" ng-model = "current.multiFormat" ng-change = "runQuery()" ng-options = "f for f in ['glob', 'regex values']" > < / select >
< / li >
< / ul >
< div class = "clearfix" > < / div >
2014-09-05 14:03:36 +02:00
< / div >
2015-05-05 10:56:39 +02:00
< / div >
2014-09-05 14:03:36 +02:00
2015-05-05 10:56:39 +02:00
< div class = "tight-form-section" >
< h5 > Display options< / h5 >
< div class = "tight-form last" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" style = "width: 100px" >
Variable Label
< / li >
< li >
< input type = "text" class = "input-medium tight-form-input" ng-model = 'current.label' placeholder = "" > < / input >
< / li >
< li class = "tight-form-item last" >
2015-05-05 13:33:57 +02:00
< editor-checkbox text = "Hide label" model = "current.hideLabel" change = "runQuery()" > < / editor-checkbox >
2015-05-05 10:56:39 +02:00
< / li >
< / ul >
< div class = "clearfix" > < / div >
2015-01-31 18:00:26 +01:00
< / div >
2015-05-05 10:56:39 +02:00
< / div >
< / div >
2014-08-29 12:34:04 +02:00
2015-05-28 11:16:16 +02:00
< div class = "editor-row" ng-if = "current.type === 'query'" >
< div class = "tight-form-section" >
2015-06-03 12:03:12 +02:00
< h5 > Value groups/tags (Experimental feature)< / h5 >
2015-05-30 09:34:11 +02:00
< div class = "tight-form" ng-if = "current.useTags" >
2015-05-28 11:16:16 +02:00
< ul class = "tight-form-list" >
2015-05-30 09:34:11 +02:00
< li class = "tight-form-item" style = "width: 135px" >
Tags query
2015-05-28 11:16:16 +02:00
< / li >
< li >
2015-05-30 09:34:11 +02:00
< input type = "text" style = "width: 588px" class = "input-xxlarge tight-form-input last" ng-model = 'current.tagsQuery' placeholder = "metric name or tags query" ng-model-onblur > < / input >
2015-05-28 11:16:16 +02:00
< / li >
< / ul >
< div class = "clearfix" > < / div >
< / div >
2015-05-30 09:34:11 +02:00
< div class = "tight-form" ng-if = "current.useTags" >
2015-05-28 11:16:16 +02:00
< ul class = "tight-form-list" >
2015-05-30 09:34:11 +02:00
< li class = "tight-form-item" style = "width: 135px;" >
Tag values query
2015-05-28 11:16:16 +02:00
< / li >
< li >
2015-05-30 09:34:11 +02:00
< input type = "text" style = "width: 588px" class = "input tight-form-input last" ng-model = 'current.tagValuesQuery' placeholder = "apps.$__tag.*" ng-model-onblur > < / input >
2015-05-28 11:16:16 +02:00
< / li >
< / ul >
< div class = "clearfix" > < / div >
< / div >
< div class = "tight-form" >
< ul class = "tight-form-list" >
< li class = "tight-form-item last" >
2015-05-30 09:34:11 +02:00
< editor-checkbox text = "Enable" model = "current.useTags" change = "runQuery()" > < / editor-checkbox >
2015-05-28 11:16:16 +02:00
< / li >
< / ul >
< div class = "clearfix" > < / div >
< / div >
< / div >
< / div >
2015-05-20 18:18:03 +02:00
2015-05-05 10:56:39 +02:00
< div class = "editor-row" >
< div class = "tight-form-section" >
< h5 > Preview of values (shows max 20)< / h5 >
< div class = "tight-form last" >
< ul class = "tight-form-list" >
< li class = "tight-form-item" ng-repeat = "option in current.options | limitTo: 20" >
{{option.text}}
< / li >
< / ul >
< div class = "clearfix" > < / div >
2014-08-27 21:47:41 +02:00
< / div >
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
2015-05-05 10:56:39 +02:00
< div class = "editor-row" style = "margin-top: 20px" >
< button type = "button" class = "btn btn-success" ng-show = "editor.index === 2" ng-click = "update();" > Update< / button >
< button type = "button" class = "btn btn-success" ng-show = "editor.index === 1" ng-click = "add();" > Add< / button >
2015-03-19 23:09:50 -04:00
< / div >
2015-05-05 10:56:39 +02:00
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