mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(mixed datasource): fixing varios issues with the query editor changes, updated kariosdb data source editor to work with the new model, #436
This commit is contained in:
parent
b4115b0362
commit
95f1343a59
@ -16,8 +16,11 @@ function (angular) {
|
|||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
element.focus();
|
element.focus();
|
||||||
|
var domEl = element[0];
|
||||||
|
if (domEl.setSelectionRange) {
|
||||||
var pos = element.val().length * 2;
|
var pos = element.val().length * 2;
|
||||||
element[0].setSelectionRange(pos, pos);
|
domEl.setSelectionRange(pos, pos);
|
||||||
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
},true);
|
},true);
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@ function (angular, app, _, $) {
|
|||||||
' spellcheck="false" style="display:none"></input>';
|
' spellcheck="false" style="display:none"></input>';
|
||||||
|
|
||||||
var buttonTemplate = '<a class="tight-form-item" ng-class="segment.cssClass" ' +
|
var buttonTemplate = '<a class="tight-form-item" ng-class="segment.cssClass" ' +
|
||||||
'tabindex="1" focus-me="segment.focus" ng-bind-html="segment.html"></a>';
|
'tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<ul class="tight-form-list">
|
<ul class="tight-form-list">
|
||||||
<li class="tight-form-item" style="min-width: 15px; text-align: center">
|
<li class="tight-form-item" style="min-width: 15px; text-align: center">
|
||||||
{{targetLetters[$index]}}
|
{{target.refId}}
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="tight-form-item"
|
<a class="tight-form-item"
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="tight-form-list">
|
<ul class="tight-form-list">
|
||||||
|
<li class="tight-form-item" style="min-width: 15px; text-align: center">
|
||||||
|
{{target.refId}}
|
||||||
|
</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; get_data();" role="menuitem">
|
||||||
<i class="fa fa-eye"></i>
|
<i class="fa fa-eye"></i>
|
||||||
@ -81,10 +84,7 @@
|
|||||||
<div class="tight-form">
|
<div class="tight-form">
|
||||||
<!-- Raw Query mode -->
|
<!-- Raw Query mode -->
|
||||||
<ul class="tight-form-list" ng-show="target.rawQuery">
|
<ul class="tight-form-list" ng-show="target.rawQuery">
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item tight-form-align">
|
||||||
<i class="fa fa-eye invisible"></i>
|
|
||||||
</li>
|
|
||||||
<li class="tight-form-item">
|
|
||||||
alias
|
alias
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -108,10 +108,7 @@
|
|||||||
|
|
||||||
<!-- Query editor mode -->
|
<!-- Query editor mode -->
|
||||||
<ul class="tight-form-list" role="menu" ng-hide="target.rawQuery">
|
<ul class="tight-form-list" role="menu" ng-hide="target.rawQuery">
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item tight-form-align">
|
||||||
<i class="fa fa-eye invisible"></i>
|
|
||||||
</li>
|
|
||||||
<li class="tight-form-item">
|
|
||||||
select
|
select
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
|
@ -3,6 +3,7 @@ define([
|
|||||||
'lodash',
|
'lodash',
|
||||||
'kbn',
|
'kbn',
|
||||||
'./queryCtrl',
|
'./queryCtrl',
|
||||||
|
'./directives',
|
||||||
],
|
],
|
||||||
function (angular, _, kbn) {
|
function (angular, _, kbn) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
17
public/app/plugins/datasource/kairosdb/directives.js
Normal file
17
public/app/plugins/datasource/kairosdb/directives.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
define([
|
||||||
|
'angular',
|
||||||
|
],
|
||||||
|
function (angular) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var module = angular.module('grafana.directives');
|
||||||
|
|
||||||
|
module.directive('metricQueryEditorKairosdb', function() {
|
||||||
|
return {controller: 'KairosDBQueryCtrl', templateUrl: 'app/plugins/datasource/kairosdb/partials/query.editor.html'};
|
||||||
|
});
|
||||||
|
|
||||||
|
module.directive('metricQueryOptionsKairosdb', function() {
|
||||||
|
return {templateUrl: 'app/plugins/datasource/kairosdb/partials/query.options.html'};
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -1,17 +1,8 @@
|
|||||||
<div class="editor-row">
|
<div class="tight-form">
|
||||||
<div ng-repeat="target in panel.targets"
|
|
||||||
class="tight-form-container"
|
|
||||||
ng-class="{'tight-form-disabled': target.hide}"
|
|
||||||
ng-controller="KairosDBQueryCtrl"
|
|
||||||
ng-init="init()">
|
|
||||||
|
|
||||||
<div class="tight-form">
|
|
||||||
<ul class="tight-form-list pull-right">
|
<ul class="tight-form-list pull-right">
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<a class="pointer dropdown-toggle"
|
<a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
|
||||||
data-toggle="dropdown"
|
|
||||||
tabindex="1">
|
|
||||||
<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">
|
||||||
@ -29,6 +20,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="tight-form-list">
|
<ul class="tight-form-list">
|
||||||
|
<li class="tight-form-item" style="min-width: 15px; text-align: center">
|
||||||
|
{{target.refId}}
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="tight-form-item" ng-click="target.hide = !target.hide; targetBlur();" role="menuitem">
|
<a class="tight-form-item" ng-click="target.hide = !target.hide; targetBlur();" role="menuitem">
|
||||||
<i class="fa fa-eye"></i>
|
<i class="fa fa-eye"></i>
|
||||||
@ -38,15 +32,13 @@
|
|||||||
Metric
|
Metric
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input type="text"
|
<input type="text" class="input-large tight-form-input"
|
||||||
class="input-large tight-form-input"
|
|
||||||
ng-model="target.metric"
|
ng-model="target.metric"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
bs-typeahead="suggestMetrics"
|
bs-typeahead="suggestMetrics"
|
||||||
placeholder="metric name"
|
placeholder="metric name"
|
||||||
data-min-length=0 data-items=100
|
data-min-length=0 data-items=100
|
||||||
ng-blur="targetBlur()"
|
ng-blur="targetBlur()">
|
||||||
>
|
|
||||||
<a bs-tooltip="target.errors.metric"
|
<a bs-tooltip="target.errors.metric"
|
||||||
style="color: rgb(229, 189, 28)"
|
style="color: rgb(229, 189, 28)"
|
||||||
ng-show="target.errors.metric">
|
ng-show="target.errors.metric">
|
||||||
@ -67,15 +59,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- TAGS -->
|
<!-- TAGS -->
|
||||||
<div class="tight-form">
|
<div class="tight-form">
|
||||||
<ul class="tight-form-list" role="menu">
|
<ul class="tight-form-list" role="menu">
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item tight-form-align">
|
||||||
<i class="fa fa-eye invisible"></i>
|
|
||||||
</li>
|
|
||||||
<li class="tight-form-item">
|
|
||||||
Tags
|
Tags
|
||||||
</li>
|
</li>
|
||||||
<li ng-repeat="(key, value) in target.tags track by $index" class="tight-form-item">
|
<li ng-repeat="(key, value) in target.tags track by $index" class="tight-form-item">
|
||||||
@ -124,16 +113,12 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- GROUP BY -->
|
<!-- GROUP BY -->
|
||||||
<div class="tight-form">
|
<div class="tight-form">
|
||||||
<ul class="tight-form-list" role="menu">
|
<ul class="tight-form-list" role="menu">
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item tight-form-align">
|
||||||
<i class="fa fa-eye invisible"></i>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="tight-form-item">
|
|
||||||
Group By
|
Group By
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -234,17 +219,14 @@
|
|||||||
<i ng-show="isGroupByValid" class="fa fa-plus-circle"></i>
|
<i ng-show="isGroupByValid" class="fa fa-plus-circle"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- HORIZONTAL AGGREGATION -->
|
<!-- HORIZONTAL AGGREGATION -->
|
||||||
<div class="tight-form">
|
<div class="tight-form">
|
||||||
<ul class="tight-form-list" role="menu">
|
<ul class="tight-form-list" role="menu">
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item tight-form-align">
|
||||||
<i class="fa fa-eye invisible"></i>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="tight-form-item">
|
|
||||||
Aggregators
|
Aggregators
|
||||||
</li>
|
</li>
|
||||||
<li ng-repeat="aggregatorObject in target.horizontalAggregators track by $index" class="tight-form-item">
|
<li ng-repeat="aggregatorObject in target.horizontalAggregators track by $index" class="tight-form-item">
|
||||||
@ -341,44 +323,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="grafana-metric-options" ng-controller="KairosDBQueryCtrl">
|
|
||||||
<div class="tight-form">
|
|
||||||
<ul class="tight-form-list">
|
|
||||||
<li class="tight-form-item tight-form-item-icon">
|
|
||||||
<i class="fa fa-wrench"></i>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="tight-form-item">
|
|
||||||
Downsampling with
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<select class="input-medium tight-form-input" ng-change="panelBlur()" ng-model="panel.downsampling" ng-options="f for f in ['(NONE)','avg', 'sum', 'min', 'max', 'dev']" ></select>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<!-- SAMPLING RATE -->
|
|
||||||
<li ng-hide="panel.downsampling=='(NONE)'" class="tight-form-item">
|
|
||||||
every
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<input type="text"
|
|
||||||
ng-hide="panel.downsampling=='(NONE)'"
|
|
||||||
class="input-mini tight-form-input"
|
|
||||||
ng-model="panel.sampling"
|
|
||||||
placeholder="{{interval}}"
|
|
||||||
bs-tooltip="'Leave blank for auto handling based on time range and panel width'"
|
|
||||||
spellcheck='false'
|
|
||||||
ng-blur="panelBlur()" >
|
|
||||||
<a bs-tooltip="target.errors.sampling"
|
|
||||||
style="color: rgb(229, 189, 28)"
|
|
||||||
ng-show="target.errors.sampling">
|
|
||||||
<i class="fa fa-warning"></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="clearfix"></div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<section class="grafana-metric-options" ng-controller="KairosDBQueryCtrl">
|
||||||
|
<div class="tight-form">
|
||||||
|
<ul class="tight-form-list">
|
||||||
|
<li class="tight-form-item tight-form-item-icon">
|
||||||
|
<i class="fa fa-wrench"></i>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="tight-form-item">
|
||||||
|
Downsampling with
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<select class="input-medium tight-form-input" ng-change="panelBlur()" ng-model="panel.downsampling" ng-options="f for f in ['(NONE)','avg', 'sum', 'min', 'max', 'dev']" ></select>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- SAMPLING RATE -->
|
||||||
|
<li ng-hide="panel.downsampling=='(NONE)'" class="tight-form-item">
|
||||||
|
every
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<input type="text"
|
||||||
|
ng-hide="panel.downsampling=='(NONE)'"
|
||||||
|
class="input-mini tight-form-input"
|
||||||
|
ng-model="panel.sampling"
|
||||||
|
placeholder="{{interval}}"
|
||||||
|
bs-tooltip="'Leave blank for auto handling based on time range and panel width'"
|
||||||
|
spellcheck='false'
|
||||||
|
ng-blur="panelBlur()" >
|
||||||
|
<a bs-tooltip="target.errors.sampling"
|
||||||
|
style="color: rgb(229, 189, 28)"
|
||||||
|
ng-show="target.errors.sampling">
|
||||||
|
<i class="fa fa-warning"></i>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="clearfix"></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
@ -8,8 +8,7 @@
|
|||||||
"module": "plugins/datasource/kairosdb/datasource",
|
"module": "plugins/datasource/kairosdb/datasource",
|
||||||
|
|
||||||
"partials": {
|
"partials": {
|
||||||
"config": "app/plugins/datasource/kairosdb/partials/config.html",
|
"config": "app/plugins/datasource/kairosdb/partials/config.html"
|
||||||
"query": "app/plugins/datasource/kairosdb/partials/query.editor.html"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"metrics": true,
|
"metrics": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user