2014-08-26 14:17:46 +02:00
< div ng-controller = "TemplateEditorCtrl" ng-init = "init()" > < div class = "dashboard-editor-header" >
< div class = "dashboard-editor-title" >
< i class = "icon icon-code" > < / i >
Templating
< / div >
2014-08-25 15:55:42 +02:00
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 >
2014-08-26 14:17:46 +02:00
< / div >
2014-08-25 22:39:40 +02:00
2014-08-26 14:17:46 +02:00
< div class = "dashboard-editor-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-08-28 12:44:01 +02:00
[[{{variable.name}}]]
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%" >
2014-08-28 12:44:01 +02:00
< a ng-click = "edit(variable)" class = "btn btn-success btn-mini" >
2014-08-27 10:41:27 +02:00
< i class = "icon-edit" > < / i >
2014-08-26 14:17:46 +02:00
Edit
< / a >
< / td >
2014-08-28 16:44:16 +02:00
< td style = "width: 1%" > < i ng-click = "_.move(variables,$index,$index-1)" ng-hide = "$first" class = "pointer icon-arrow-up" > < / i > < / td >
< td style = "width: 1%" > < i ng-click = "_.move(variables,$index,$index+1)" ng-hide = "$last" class = "pointer icon-arrow-down" > < / i > < / td >
2014-08-27 10:41:27 +02:00
< td style = "width: 1%" >
2014-08-28 12:44:01 +02:00
< a ng-click = "removeVariable(variable)" class = "btn btn-danger btn-mini" >
2014-08-27 10:41:27 +02:00
< i class = "icon-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)" >
2014-08-29 12:34:04 +02:00
< div class = "row" >
2014-08-26 14:17:46 +02:00
< div class = "editor-option" >
2014-08-29 12:34:04 +02:00
< 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" > < / input >
< / div >
< div class = "editor-option" >
< label class = "small" > Type< / label >
2014-09-05 12:07:48 +02:00
< select class = "input-medium" ng-model = "current.type" ng-options = "f for f in ['query', 'interval', 'custom']" ng-change = "typeChanged()" > < / select >
2014-08-29 12:34:04 +02:00
< / 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 >
< div class = "editor-option text-center" ng-show = "current.type === 'query'" >
< label class = "small" > Refresh on load < tip > Check if you want values to be updated on dashboard load, will slow down dashboard load time.< / tip > < / label >
< input type = "checkbox" ng-model = "current.refresh" ng-checked = "current.refresh" >
< / div >
< / div >
2014-08-27 15:54:30 +02:00
2014-09-05 12:07:48 +02:00
< div ng-show = "current.type === 'interval'" >
< div class = "editor-row" >
< div class = "editor-option" >
< label class = "small" > Values< / label >
< input type = "text" class = "input-xxlarge" ng-model = 'current.query' ng-blur = "runQuery()" placeholder = "name" > < / input >
< / div >
< / div >
< div class = "editor-row" >
< div class = "editor-option text-center" >
< label class = "small" > Include auto interval< / label >
< input type = "checkbox" ng-model = "current.auto" ng-checked = "current.auto" ng-change = "runQuery()" >
< / div >
< div class = "editor-option" ng-show = "current.auto" >
2014-09-05 13:31:34 +02:00
< 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-09-05 12:07:48 +02:00
< / div >
2014-08-29 12:34:04 +02:00
< / div >
2014-08-27 21:47:41 +02:00
< / div >
2014-09-05 14:03:36 +02: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 >
< / div >
< / div >
< / div >
2014-08-29 12:34:04 +02: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 = "icon-play" > < / i > < / button >
< / div >
< / div >
< 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 = "icon-play" > < / i > < / button >
< / div >
< / div >
< div class = "editor-row" style = "margin: 15px 0" >
< div class = "editor-option text-center" >
< label class = "small" > All option< / label >
< input type = "checkbox" ng-model = "current.includeAll" ng-checked = "current.includeAll" ng-change = "runQuery()" >
< / div >
< div class = "editor-option" ng-show = "current.includeAll" >
< label class = "small" > All format< / label >
2014-09-05 15:46:29 +02:00
< 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 >
< div class = "editor-option" ng-show = "current.includeAll" >
< label class = "small" > All value< / label >
2014-09-05 15:46:29 +02:00
< input type = "text" class = "input-xlarge" ng-model = 'current.options[0].value' > < / input >
2014-08-29 12:34:04 +02:00
< / div >
< / div >
2014-08-27 21:47:41 +02:00
< / div >
2014-08-27 15:54:30 +02:00
< / div >
2014-08-29 12:34:04 +02:00
< div class = "editor-option" >
< div class = "editor-row" >
< div class = "editor-option" >
2014-09-01 11:13:18 +02:00
< label class = "small" > Variable values (showing 20/{{current.options.length}})< / label >
2014-08-29 12:34:04 +02:00
< ul class = "grafana-options-list" >
< li ng-repeat = "option in current.options | limitTo: 20" >
{{option.text}}
< / li >
< / ul >
2014-09-05 12:07:48 +02:00
< / div >
2014-08-27 21:47:41 +02:00
< / div >
2014-08-26 14:17:46 +02:00
< / div >
< / div >
< / div >
< / div >
< div class = "dashboard-editor-footer" >
2014-08-27 15:54:30 +02:00
< button type = "button" class = "btn btn-success pull-left" ng-show = "editor.index === 2" ng-click = "update();" > Update< / button >
< button type = "button" class = "btn btn-success pull-left" ng-show = "editor.index === 1" ng-click = "add();" > Add< / button >
2014-08-27 10:41:27 +02:00
< button type = "button" class = "btn btn-success pull-right" ng-click = "dismiss();" > Close< / 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
<!-- <div class="span4"> -->
<!-- <tip class="info-box"> -->
<!-- <i class="icon-question-sign"></i> -->
<!-- The templating feature in Grafana lets easily create and manage templated queries. Templated queries use [[replacement]] syntax -->
<!-- to replace a part of your metric key or query. By using this feature you can make your dashboards more generic. You can for example create -->
<!-- a query replacement for your cluster name or server name. Then use that replacement in your metric queries and change -->
<!-- it globably for all graphs on the dashboard. -->
<!-- <br/><br/> -->
<!-- </tip> -->
<!-- </div> -->