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;">
|
|
|
|
|
<div ng-repeat="tab in ['Overview', 'Add', 'Edit']" data-title="{{tab}}">
|
|
|
|
|
</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-26 14:17:46 +02:00
|
|
|
<em>No replacements defined</em>
|
|
|
|
|
</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-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-26 14:17:46 +02:00
|
|
|
<div class="editor-row">
|
|
|
|
|
<div class="editor-option">
|
2014-08-28 12:44:01 +02:00
|
|
|
<label class="small">Variable name</label>
|
2014-08-26 14:17:46 +02:00
|
|
|
<input type="text" class="input-medium" ng-model='current.name' placeholder="name"></input>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="editor-option">
|
|
|
|
|
<label class="small">Type</label>
|
2014-08-27 21:47:41 +02:00
|
|
|
<select class="input-medium" ng-model="current.type" ng-options="f for f in ['query', 'time period']" ng-change="typeChanged()"></select>
|
2014-08-26 14:17:46 +02:00
|
|
|
</div>
|
2014-08-27 21:47:41 +02:00
|
|
|
<div class="editor-option" ng-show="current.type === 'query'">
|
2014-08-26 14:17:46 +02:00
|
|
|
<label class="small">Datasource</label>
|
2014-08-27 10:41:27 +02:00
|
|
|
<select ng-model="current.datasource" ng-options="f.value as f.name for f in datasources"></select>
|
2014-08-26 14:17:46 +02:00
|
|
|
</div>
|
2014-08-27 21:47:41 +02:00
|
|
|
<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="refresh">
|
|
|
|
|
</div>
|
2014-08-26 14:17:46 +02:00
|
|
|
</div>
|
2014-08-25 22:39:40 +02:00
|
|
|
|
2014-08-27 21:47:41 +02:00
|
|
|
<div ng-show="current.type === 'time period'">
|
|
|
|
|
<div class="editor-option">
|
|
|
|
|
<label class="small">Values</label>
|
2014-08-28 12:44:01 +02:00
|
|
|
<input type="text" class="input-xxlarge" ng-model='current.query' placeholder="name"></input>
|
2014-08-27 21:47:41 +02:00
|
|
|
</div>
|
|
|
|
|
<div class="editor-option">
|
|
|
|
|
<label class="small">Auto period count <tip>The number you want to divide the time range in</tip></label>
|
|
|
|
|
<select class="input-small" ng-model="current.auto_count" ng-options="f for f in [5,6,7,8,9,10,15,20,30,40,50,70,90,100]"></select>
|
2014-08-27 15:54:30 +02:00
|
|
|
</div>
|
2014-08-27 21:47:41 +02:00
|
|
|
<p class="small">
|
|
|
|
|
<br>
|
|
|
|
|
<i class="icon-info-sign"></i>
|
|
|
|
|
This special type of template replacement is useful as the auto word will be calculated depending on the time range divided by
|
|
|
|
|
the number of periods you wish.
|
|
|
|
|
</p>
|
2014-08-27 15:54:30 +02:00
|
|
|
</div>
|
|
|
|
|
|
2014-08-27 21:47:41 +02:00
|
|
|
<div ng-show="current.type === 'query'">
|
|
|
|
|
<div class="editor-row">
|
|
|
|
|
<div class="editor-option form-inline">
|
2014-08-28 12:44:01 +02:00
|
|
|
<label class="small">Variable values query</label>
|
2014-08-27 21:47:41 +02:00
|
|
|
<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-top: 10px;">
|
|
|
|
|
<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>
|
2014-08-27 15:54:30 +02:00
|
|
|
</div>
|
|
|
|
|
|
2014-08-27 21:47:41 +02:00
|
|
|
<div class="editor-row" style="margin-top: 10px;">
|
|
|
|
|
<div class="editor-option form-inline">
|
2014-08-28 12:44:01 +02:00
|
|
|
<label class="small">Variable values</label>
|
2014-08-27 21:47:41 +02:00
|
|
|
<ul>
|
|
|
|
|
<li ng-repeat="option in current.options">
|
|
|
|
|
{{option.text}}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</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> -->
|