Various fixes, restored search auto focus

pull/1916/merge
Torkel Ödegaard 10 years ago
parent 14e8c15a3a
commit 53cb0feda9
  1. 26
      public/app/directives/giveFocus.js
  2. 2
      public/app/features/dashboard/unsavedChangesSrv.js
  3. 3
      public/test/specs/unsavedChangesSrv-specs.js

@ -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
dash.time = 0;
dash.refresh = 0;
dash.version = 0;
dash.schemaVersion = 0;
// filter row and panels properties that should be ignored
dash.rows = _.filter(dash.rows, function(row) {

@ -54,8 +54,7 @@ define([
it('Should ignore a lot of changes', function() {
dash.time = {from: '1h'};
dash.refresh = true;
dash.version = 10;
dash.rows[0].collapse = true;
dash.schemaVersion = 10;
expect(tracker.hasChanges()).to.be(false);
});

Loading…
Cancel
Save