[clickFocus] fixed leaky/buggy event handling

This commit is contained in:
Spencer Alger 2014-09-19 10:56:34 -07:00
parent 70578e4e24
commit 48b72cd4b7
2 changed files with 8 additions and 5 deletions

View file

@ -57,7 +57,7 @@ By default Kibana shows the last 15 minutes of data. You might want to expand th
Once you see some documents, you can begin to explore Discover. In the document list, Kibana will show you the localized version of the time field you specified in your index pattern, as well as the `_source` of the elasticsearch document.
**Tip:** By default the table contains 500 of the most recent documents. You can increase the number of documents in the table from the advanced settings screen. See the [Settings section](#advanced) of the documentation.
**Tip:** By default the table contains 500 of the most recent documents. You can increase the number of documents in the table from the advanced settings screen. See the [Setting section](#advanced) of the documentation.
Click on the expand button to the left of the time. Kibana will read the fields from the document and present them in a table. The + and - buttons allow you to quickly filter for documents that share common traits with the one you're looking at. Click the JSON tab at the top of the table to see the full, pretty printed, original document.
@ -314,4 +314,4 @@ Clicking on the *View* action loads that item in the associated applications. Re
Clicking *Edit* will allow you to change the title, description and other settings of the saved object. You can also edit the schema of the stored object.
*Note:* this operation is for advanced users only - making changes here can break large portions of the application.
<!-- /include -->
<!-- /include -->

View file

@ -1,5 +1,6 @@
define(function (require) {
var module = require('modules').get('kibana');
var _ = require('lodash');
var $ = require('jquery');
module.directive('clickFocus', function () {
@ -9,11 +10,13 @@ define(function (require) {
},
restrict: 'A',
link: function ($scope, $elem) {
$elem.bind('click', function () {
function handler() {
var focusElem = $.find('input[name=' + $scope.clickFocus + ']');
if (focusElem[0]) focusElem[0].focus();
});
$scope.$on('$destroy', $elem.unbind);
}
$elem.bind('click', handler);
$scope.$on('$destroy', _.bindKey($elem, 'unbind', 'click', handler));
}
};
});