Commit b1bfd359 by Torkel Ödegaard

feat(datasources): last fixes for data sources

parent a053552f
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</a> </a>
<ul class="dropdown-menu pull-right" role="menu"> <ul class="dropdown-menu pull-right" role="menu">
<li role="menuitem"><a tabindex="1" ng-click="duplicateDataQuery(target)">Duplicate</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.duplicateDataQuery(target)">Duplicate</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index-1)">Move up</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.moveDataQuery($index, $index-1)">Move up</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index+1)">Move down</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.moveDataQuery($index, $index+1)">Move down</a></li>
</ul> </ul>
</div> </div>
</li> </li>
<li class="tight-form-item last"> <li class="tight-form-item last">
<a class="pointer" tabindex="1" ng-click="removeDataQuery(target)"> <a class="pointer" tabindex="1" ng-click="panelCtrl.removeDataQuery(target)">
<i class="fa fa-remove"></i> <i class="fa fa-remove"></i>
</a> </a>
</li> </li>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
{{target.refId}} {{target.refId}}
</li> </li>
<li> <li>
<a class="tight-form-item" ng-click="target.hide = !target.hide; get_data();" role="menuitem"> <a class="tight-form-item" ng-click="target.hide = !target.hide; panelCtrl.refresh();" role="menuitem">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
</a> </a>
</li> </li>
...@@ -44,13 +44,13 @@ ...@@ -44,13 +44,13 @@
Query Query
</li> </li>
<li> <li>
<input type="text" class="tight-form-input" style="width: 345px;" ng-model="target.query" spellcheck='false' placeholder="Lucene query" ng-blur="get_data()"> <input type="text" class="tight-form-input" style="width: 345px;" ng-model="target.query" spellcheck='false' placeholder="Lucene query" ng-blur="panelCtrl.refresh()">
</li> </li>
<li class="tight-form-item query-keyword"> <li class="tight-form-item query-keyword">
Alias Alias
</li> </li>
<li> <li>
<input type="text" class="tight-form-input" style="width: 200px;" ng-model="target.alias" spellcheck='false' placeholder="alias patterns (empty = auto)" ng-blur="get_data()"> <input type="text" class="tight-form-input" style="width: 200px;" ng-model="target.alias" spellcheck='false' placeholder="alias patterns (empty = auto)" ng-blur="panelCtrl.refresh()">
</li> </li>
</ul> </ul>
<div class="clearfix"></div> <div class="clearfix"></div>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Group by time interval Group by time interval
</li> </li>
<li> <li>
<input type="text" class="input-medium tight-form-input" ng-model="panel.interval" ng-blur="get_data();" <input type="text" class="input-medium tight-form-input" ng-model="ctrl.panel.interval" ng-blur="ctrl.refresh();"
spellcheck='false' placeholder="example: >10s"> spellcheck='false' placeholder="example: >10s">
</li> </li>
<li class="tight-form-item"> <li class="tight-form-item">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<i class="fa fa-info-circle"></i> <i class="fa fa-info-circle"></i>
</li> </li>
<li class="tight-form-item"> <li class="tight-form-item">
<a ng-click="toggleEditorHelp(1);" bs-tooltip="'click to show helpful info'" data-placement="bottom"> <a ng-click="ctrl.toggleEditorHelp(1);" bs-tooltip="'click to show helpful info'" data-placement="bottom">
alias patterns alias patterns
</a> </a>
</li> </li>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<div class="editor-row"> <div class="editor-row">
<div class="pull-left" style="margin-top: 30px;"> <div class="pull-left" style="margin-top: 30px;">
<div class="grafana-info-box span6" ng-if="editorHelpIndex === 1"> <div class="grafana-info-box span6" ng-if="ctrl.editorHelpIndex === 1">
<h5>Alias patterns</h5> <h5>Alias patterns</h5>
<ul ng-non-bindable> <ul ng-non-bindable>
<li>{{term fieldname}} = replaced with value of term group by</li> <li>{{term fieldname}} = replaced with value of term group by</li>
......
...@@ -6,8 +6,9 @@ function (angular) { ...@@ -6,8 +6,9 @@ function (angular) {
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
module.controller('ElasticQueryCtrl', function($scope, $timeout, uiSegmentSrv) { module.controller('ElasticQueryCtrl', function($scope, $rootScope, $timeout, uiSegmentSrv) {
$scope.esVersion = $scope.datasource.esVersion; $scope.esVersion = $scope.datasource.esVersion;
$scope.panelCtrl = $scope.ctrl;
$scope.init = function() { $scope.init = function() {
var target = $scope.target; var target = $scope.target;
...@@ -27,10 +28,10 @@ function (angular) { ...@@ -27,10 +28,10 @@ function (angular) {
var newJson = angular.toJson($scope.datasource.queryBuilder.build($scope.target), true); var newJson = angular.toJson($scope.datasource.queryBuilder.build($scope.target), true);
if (newJson !== $scope.oldQueryRaw) { if (newJson !== $scope.oldQueryRaw) {
$scope.rawQueryOld = newJson; $scope.rawQueryOld = newJson;
$scope.get_data(); $scope.panelCtrl.refresh();
} }
$scope.appEvent('elastic-query-updated'); $rootScope.appEvent('elastic-query-updated');
}; };
$scope.handleQueryError = function(err) { $scope.handleQueryError = function(err) {
......
...@@ -9,15 +9,14 @@ ...@@ -9,15 +9,14 @@
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</a> </a>
<ul class="dropdown-menu pull-right" role="menu"> <ul class="dropdown-menu pull-right" role="menu">
<li role="menuitem"><a tabindex="1" ng-click="toggleQueryMode()">Switch editor mode</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.duplicateDataQuery(target)">Duplicate</a></li>
<li role="menuitem"><a tabindex="1" ng-click="duplicateDataQuery(target)">Duplicate</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.moveDataQuery($index, $index-1)">Move up</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index-1)">Move up</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.moveDataQuery($index, $index+1)">Move down</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index+1)">Move down</a></li>
</ul> </ul>
</div> </div>
</li> </li>
<li class="tight-form-item last"> <li class="tight-form-item last">
<a class="pointer" tabindex="1" ng-click="removeDataQuery(target)"> <a class="pointer" tabindex="1" ng-click="panelCtrl.removeDataQuery(target)">
<i class="fa fa-remove"></i> <i class="fa fa-remove"></i>
</a> </a>
</li> </li>
...@@ -29,7 +28,7 @@ ...@@ -29,7 +28,7 @@
</li> </li>
<li> <li>
<a class="tight-form-item" <a class="tight-form-item"
ng-click="target.hide = !target.hide; get_data();" ng-click="target.hide = !target.hide; panelCtrl.refresh();"
role="menuitem"> role="menuitem">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
</a> </a>
......
...@@ -9,6 +9,7 @@ function (angular, _, kbn) { ...@@ -9,6 +9,7 @@ function (angular, _, kbn) {
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
module.controller('OpenTSDBQueryCtrl', function($scope) { module.controller('OpenTSDBQueryCtrl', function($scope) {
$scope.panelCtrl = $scope.ctrl;
$scope.init = function() { $scope.init = function() {
$scope.target.errors = validateTarget($scope.target); $scope.target.errors = validateTarget($scope.target);
......
...@@ -9,15 +9,14 @@ ...@@ -9,15 +9,14 @@
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</a> </a>
<ul class="dropdown-menu pull-right" role="menu"> <ul class="dropdown-menu pull-right" role="menu">
<li role="menuitem"><a tabindex="1" ng-click="toggleQueryMode()">Switch editor mode</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.duplicateDataQuery(target)">Duplicate</a></li>
<li role="menuitem"><a tabindex="1" ng-click="duplicateDataQuery(target)">Duplicate</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.moveDataQuery($index, $index-1)">Move up</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index-1)">Move up</a></li> <li role="menuitem"><a tabindex="1" ng-click="panelCtrl.moveDataQuery($index, $index+1)">Move down</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveDataQuery($index, $index+1)">Move down</a></li>
</ul> </ul>
</div> </div>
</li> </li>
<li class="tight-form-item last"> <li class="tight-form-item last">
<a class="pointer" tabindex="1" ng-click="removeDataQuery(target)"> <a class="pointer" tabindex="1" ng-click="panelCtr.removeDataQuery(target)">
<i class="fa fa-remove"></i> <i class="fa fa-remove"></i>
</a> </a>
</li> </li>
...@@ -29,7 +28,7 @@ ...@@ -29,7 +28,7 @@
</li> </li>
<li> <li>
<a class="tight-form-item" <a class="tight-form-item"
ng-click="target.hide = !target.hide; get_data();" ng-click="target.hide = !target.hide; panelCtrl.refresh();"
role="menuitem"> role="menuitem">
<i class="fa fa-eye"></i> <i class="fa fa-eye"></i>
</a> </a>
......
...@@ -8,6 +8,8 @@ function (angular, _) { ...@@ -8,6 +8,8 @@ function (angular, _) {
var module = angular.module('grafana.controllers'); var module = angular.module('grafana.controllers');
module.controller('PrometheusQueryCtrl', function($scope, templateSrv) { module.controller('PrometheusQueryCtrl', function($scope, templateSrv) {
$scope.panelCtrl = $scope.ctrl;
$scope.panel = $scope.panelCtrl.panel;
$scope.init = function() { $scope.init = function() {
var target = $scope.target; var target = $scope.target;
...@@ -29,7 +31,7 @@ function (angular, _) { ...@@ -29,7 +31,7 @@ function (angular, _) {
$scope.refreshMetricData = function() { $scope.refreshMetricData = function() {
if (!_.isEqual($scope.oldTarget, $scope.target)) { if (!_.isEqual($scope.oldTarget, $scope.target)) {
$scope.oldTarget = angular.copy($scope.target); $scope.oldTarget = angular.copy($scope.target);
$scope.get_data(); $scope.paneCtrl.refresh();
} }
}; };
......
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