2015-01-31 18:00:26 +01:00
< div ng-controller = "TemplateEditorCtrl" ng-init = "init()" >
< div class = "gf-box-header" >
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-01-17 08:27:55 +01:00
< a ng-click = "edit(variable)" class = "btn btn-success 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-01-31 18:00:26 +01:00
< div class = "editor-option" >
< div class = "editor-row" >
< div class = "editor-option" >
< label class = "small" > Variable name< / label >
< input type = "text" class = "input-medium" ng-model = 'current.name' placeholder = "name" required > < / input >
< / div >
< div class = "editor-option" >
< label class = "small" > Type< / label >
< select class = "input-medium" ng-model = "current.type" ng-options = "f for f in ['query', 'interval', 'custom']" ng-change = "typeChanged()" > < / select >
< / div >
< div class = "editor-option" ng-show = "current.type === 'query'" >
< label class = "small" > Datasource< / label >
< select class = "input input-medium" ng-model = "current.datasource" ng-options = "f.value as f.name for f in datasources" > < / select >
< / div >
< editor-opt-bool text = "Refresh on load" show-if = "current.type === 'query'"
tip="Check if you want values to be updated on dashboard load, will slow down dashboard load time"
model="current.refresh">< / editor-opt-bool >
< / div >
< div ng-show = "current.type === 'interval'" >
2014-08-29 12:34:04 +02:00
< div class = "editor-row" >
< div class = "editor-option" >
2015-01-31 18:00:26 +01:00
< label class = "small" > Values< / label >
< input type = "text" class = "input-xxlarge" ng-model = 'current.query' ng-blur = "runQuery()" placeholder = "name" > < / input >
2014-08-29 12:34:04 +02:00
< / div >
2015-01-31 18:00:26 +01:00
< / div >
< div class = "editor-row" >
< editor-opt-bool text = "Include auto interval" model = "current.auto" change = "runQuery()" > < / editor-opt-bool >
< div class = "editor-option" ng-show = "current.auto" >
< label class = "small" > Auto interval steps < tip > How many steps, roughly, the interval is rounded and will not always match this count< tip > < / label >
< select class = "input-mini" ng-model = "current.auto_count" ng-options = "f for f in [3,5,10,30,50,100,200]" ng-change = "runQuery()" > < / select >
2014-08-29 12:34:04 +02:00
< / div >
< / div >
2015-01-31 18:00:26 +01:00
< / div >
2014-08-27 15:54:30 +02:00
2015-01-31 18:00:26 +01:00
< div ng-show = "current.type === 'custom'" >
< div class = "editor-row" >
< div class = "editor-option" >
< label class = "small" > Values seperated by comma< / label >
< input type = "text" class = "input-xxlarge" ng-model = 'current.query' ng-blur = "runQuery()" placeholder = "1, 10, 20, myvalue" > < / input >
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 >
2014-08-27 21:47:41 +02:00
2015-01-31 18:00:26 +01:00
< div ng-show = "current.type === 'query'" >
< div class = "editor-row" >
< div class = "editor-option form-inline" >
< label class = "small" > Variable values query< / label >
< input type = "text" class = "input-xxlarge" ng-model = 'current.query' placeholder = "apps.servers.*" > < / input >
< button class = "btn btn-small btn-success" ng-click = "runQuery()" bs-tooltip = "'Execute query'" data-placement = "right" > < i class = "fa fa-play" > < / i > < / button >
2014-09-05 14:03:36 +02:00
< / div >
< / div >
2015-01-31 18:00:26 +01:00
< div class = "editor-row" style = "margin: 15px 0" >
< div class = "editor-option form-inline" >
< label class = "small" > regex (optional, if you want to extract part of a series name or metric node segment)< / label >
< input type = "text" class = "input-xxlarge" ng-model = 'current.regex' placeholder = "/.*-(.*)-.*/" > < / input >
< button class = "btn btn-small btn-success" ng-click = "runQuery()" bs-tooltip = "'execute query'" data-placement = "right" > < i class = "fa fa-play" > < / i > < / button >
2014-08-29 12:34:04 +02:00
< / div >
2015-01-31 18:00:26 +01:00
< / div >
2014-08-29 12:34:04 +02:00
2015-01-31 18:00:26 +01:00
< div class = "editor-row" style = "margin: 15px 0" >
< editor-opt-bool text = "All option" model = "current.includeAll" change = "runQuery()" > < / editor-opt-bool >
< div class = "editor-option" ng-show = "current.includeAll" >
< label class = "small" > All format< / label >
< select class = "input-medium" ng-model = "current.allFormat" ng-change = "runQuery()" ng-options = "f for f in ['glob', 'wildcard', 'regex wildcard', 'regex values']" > < / select >
2014-08-29 12:34:04 +02:00
< / div >
2015-01-31 18:00:26 +01:00
< div class = "editor-option" ng-show = "current.includeAll" >
< label class = "small" > All value< / label >
< input type = "text" class = "input-xlarge" ng-model = 'current.options[0].value' > < / input >
2014-08-29 12:34:04 +02:00
< / div >
2014-08-27 21:47:41 +02:00
< / div >
2014-08-27 15:54:30 +02:00
< / div >
2015-01-31 18:00:26 +01:00
< / div >
< div class = "editor-option" >
< div class = "editor-row" >
< div class = "editor-option" >
< label class = "small" > Variable values (showing 20/{{current.options.length}})< / label >
< ul class = "grafana-options-list" >
< li ng-repeat = "option in current.options | limitTo: 20" >
{{option.text}}
< / li >
< / ul >
2014-08-27 21:47:41 +02:00
< / div >
2014-08-26 14:17:46 +02:00
< / div >
< / div >
< / div >
2015-01-31 18:00:26 +01:00
< 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 >
2014-08-26 14:17:46 +02:00
< / div >
2014-08-25 15:55:42 +02:00
< / div >
2014-08-26 14:17:46 +02:00