Commit f5d992f6 by Torkel Ödegaard

InfluxDB: Support for alias & alias patterns when using raw query mode, #584

parent 25407fb5
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
<ul class="dropdown-menu pull-right" role="menu"> <ul class="dropdown-menu pull-right" role="menu">
<li role="menuitem"> <li role="menuitem">
<a tabindex="1" ng-click="duplicate()">Duplicate</a> <a tabindex="1" ng-click="duplicate()">Duplicate</a>
<a tabindex="2" ng-click="showQuery()" ng-hide="target.rawQuery">Show Query</a> <a tabindex="2" ng-click="showQuery()" ng-hide="target.rawQuery">Raw query mode</a>
<a tabindex="2" ng-click="hideQuery()" ng-show="target.rawQuery">Hide Query</a> <a tabindex="2" ng-click="hideQuery()" ng-show="target.rawQuery">Query editor mode</a>
</li> </li>
</ul> </ul>
</li> </li>
...@@ -41,17 +41,35 @@ ...@@ -41,17 +41,35 @@
</li> </li>
</ul> </ul>
<input type="text" <!-- Raw Query mode -->
class="grafana-target-text-input span10" <ul class="grafana-segment-list" ng-show="target.rawQuery">
<li>
<input type="text"
class="grafana-target-segment-input span8"
ng-model="target.query" ng-model="target.query"
placeholder="select ..." placeholder="select ..."
focus-me="target.rawQuery" focus-me="target.rawQuery"
spellcheck='false' spellcheck='false'
data-min-length=0 data-items=100 data-min-length=0 data-items=100
ng-model-onblur ng-model-onblur
ng-blur="get_data()" ng-blur="get_data()">
ng-show="target.rawQuery"> </li>
<li class="grafana-target-segment">
as
</li>
<li>
<input type="text"
class="input-medium grafana-target-segment-input"
ng-model="target.alias"
spellcheck='false'
placeholder="alias"
ng-blur="get_data()">
</li>
</ul>
<!-- Query editor mode -->
<ul class="grafana-segment-list" role="menu" ng-hide="target.rawQuery"> <ul class="grafana-segment-list" role="menu" ng-hide="target.rawQuery">
<li> <li>
<input type="text" <input type="text"
......
...@@ -94,10 +94,6 @@ function (angular, _, kbn, InfluxSeries) { ...@@ -94,10 +94,6 @@ function (angular, _, kbn, InfluxSeries) {
query = _.template(template, templateData, this.templateSettings); query = _.template(template, templateData, this.templateSettings);
query = filterSrv.applyTemplateToTarget(query); query = filterSrv.applyTemplateToTarget(query);
if (target.alias) {
alias = filterSrv.applyTemplateToTarget(target.alias);
}
if (target.groupby_field_add) { if (target.groupby_field_add) {
groupByField = target.groupby_field; groupByField = target.groupby_field;
} }
...@@ -105,6 +101,10 @@ function (angular, _, kbn, InfluxSeries) { ...@@ -105,6 +101,10 @@ function (angular, _, kbn, InfluxSeries) {
target.query = query; target.query = query;
} }
if (target.alias) {
alias = filterSrv.applyTemplateToTarget(target.alias);
}
var handleResponse = _.partial(handleInfluxQueryResponse, alias, groupByField); var handleResponse = _.partial(handleInfluxQueryResponse, alias, groupByField);
return this.doInfluxRequest(query, alias).then(handleResponse); return this.doInfluxRequest(query, alias).then(handleResponse);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment