mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'panel_repeat' of github.com:grafana/grafana into panel_repeat
Conflicts: public/app/partials/submenu.html public/css/less/submenu.less src/app/partials/roweditor.html
This commit is contained in:
commit
f8f302faad
@ -4,87 +4,9 @@ define([
|
|||||||
'lodash',
|
'lodash',
|
||||||
'jquery',
|
'jquery',
|
||||||
],
|
],
|
||||||
function (angular, app, _, $) {
|
function (angular, app, _) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular
|
|
||||||
.module('grafana.directives')
|
|
||||||
.directive('templateParamSelector', function($compile) {
|
|
||||||
var inputTemplate = '<input type="text" data-provide="typeahead" ' +
|
|
||||||
' class="tight-form-clear-input input-medium"' +
|
|
||||||
' spellcheck="false" style="display:none"></input>';
|
|
||||||
|
|
||||||
var buttonTemplate = '<a class="tight-form-item tabindex="1">{{variable.current.text}} <i class="fa fa-caret-down"></i></a>';
|
|
||||||
|
|
||||||
return {
|
|
||||||
link: function($scope, elem) {
|
|
||||||
var $input = $(inputTemplate);
|
|
||||||
var $button = $(buttonTemplate);
|
|
||||||
var variable = $scope.variable;
|
|
||||||
|
|
||||||
$input.appendTo(elem);
|
|
||||||
$button.appendTo(elem);
|
|
||||||
|
|
||||||
function updateVariableValue(value) {
|
|
||||||
$scope.$apply(function() {
|
|
||||||
var selected = _.findWhere(variable.options, { text: value });
|
|
||||||
if (!selected) {
|
|
||||||
selected = { text: value, value: value };
|
|
||||||
}
|
|
||||||
$scope.setVariableValue($scope.variable, selected);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$input.attr('data-provide', 'typeahead');
|
|
||||||
$input.typeahead({
|
|
||||||
minLength: 0,
|
|
||||||
items: 1000,
|
|
||||||
updater: function(value) {
|
|
||||||
$input.val(value);
|
|
||||||
$input.trigger('blur');
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var typeahead = $input.data('typeahead');
|
|
||||||
typeahead.lookup = function () {
|
|
||||||
var options = _.map(variable.options, function(option) { return option.text; });
|
|
||||||
this.query = this.$element.val() || '';
|
|
||||||
return this.process(options);
|
|
||||||
};
|
|
||||||
|
|
||||||
$button.click(function() {
|
|
||||||
$input.css('width', ($button.width() + 16) + 'px');
|
|
||||||
|
|
||||||
$button.hide();
|
|
||||||
$input.show();
|
|
||||||
$input.focus();
|
|
||||||
|
|
||||||
var typeahead = $input.data('typeahead');
|
|
||||||
if (typeahead) {
|
|
||||||
$input.val('');
|
|
||||||
typeahead.lookup();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$input.blur(function() {
|
|
||||||
if ($input.val() !== '') { updateVariableValue($input.val()); }
|
|
||||||
$input.hide();
|
|
||||||
$button.show();
|
|
||||||
$button.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
|
||||||
$button.unbind();
|
|
||||||
typeahead.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
$compile(elem.contents())($scope);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
angular
|
angular
|
||||||
.module('grafana.directives')
|
.module('grafana.directives')
|
||||||
.directive('variableValueSelect', function($compile, $window, $timeout) {
|
.directive('variableValueSelect', function($compile, $window, $timeout) {
|
||||||
@ -162,9 +84,9 @@ function (angular, app, _, $) {
|
|||||||
|
|
||||||
scope.hide = function() {
|
scope.hide = function() {
|
||||||
scope.selectorOpen = false;
|
scope.selectorOpen = false;
|
||||||
if (scope.oldCurrentText !== variable.current.text) {
|
// if (scope.oldCurrentText !== variable.current.text) {
|
||||||
scope.onUpdated();
|
// scope.onUpdated();
|
||||||
}
|
// }
|
||||||
|
|
||||||
bodyEl.off('click', scope.bodyOnClick);
|
bodyEl.off('click', scope.bodyOnClick);
|
||||||
};
|
};
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
</li>
|
</li>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<li class="tight-form-item" style="width: 15px">
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="tight-form-list" ng-if="dashboard.annotations.list.length > 0">
|
<ul class="tight-form-list" ng-if="dashboard.annotations.list.length > 0">
|
||||||
|
Loading…
Reference in New Issue
Block a user