Various fixes, restored search auto focus
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
define([
|
||||||
|
'angular'
|
||||||
|
],
|
||||||
|
function (angular) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('grafana.directives').directive('giveFocus', function() {
|
||||||
|
return function(scope, element, attrs) {
|
||||||
|
element.click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
|
||||||
|
scope.$watch(attrs.giveFocus,function (newValue) {
|
||||||
|
if (!newValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(function() {
|
||||||
|
element.focus();
|
||||||
|
var pos = element.val().length * 2;
|
||||||
|
element[0].setSelectionRange(pos, pos);
|
||||||
|
}, 200);
|
||||||
|
},true);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ function(angular, _) {
|
|||||||
// ignore time and refresh
|
// ignore time and refresh
|
||||||
dash.time = 0;
|
dash.time = 0;
|
||||||
dash.refresh = 0;
|
dash.refresh = 0;
|
||||||
dash.version = 0;
|
dash.schemaVersion = 0;
|
||||||
|
|
||||||
// filter row and panels properties that should be ignored
|
// filter row and panels properties that should be ignored
|
||||||
dash.rows = _.filter(dash.rows, function(row) {
|
dash.rows = _.filter(dash.rows, function(row) {
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ define([
|
|||||||
it('Should ignore a lot of changes', function() {
|
it('Should ignore a lot of changes', function() {
|
||||||
dash.time = {from: '1h'};
|
dash.time = {from: '1h'};
|
||||||
dash.refresh = true;
|
dash.refresh = true;
|
||||||
dash.version = 10;
|
dash.schemaVersion = 10;
|
||||||
dash.rows[0].collapse = true;
|
|
||||||
expect(tracker.hasChanges()).to.be(false);
|
expect(tracker.hasChanges()).to.be(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user