NIFI-2467: - Resetting cached search term when closing the dialog to ensure the same search time works upon re-opening.

NIFI-2467: - Fixing issue preventing the selection of an autocomplete result.

This closes #784.

Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
Matt Gilman 2016-08-04 09:04:33 -04:00 committed by Bryan Bende
parent 1db5e73102
commit 321a2398ba
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
2 changed files with 11 additions and 3 deletions

View File

@ -31,6 +31,7 @@ nf.PolicyManagement = (function () {
var initAddTenantToPolicyDialog = function () { var initAddTenantToPolicyDialog = function () {
$('#new-policy-user-button').on('click', function () { $('#new-policy-user-button').on('click', function () {
$('#search-users-dialog').modal('show'); $('#search-users-dialog').modal('show');
$('#search-users-field').focus();
}); });
$('#delete-policy-button').on('click', function () { $('#delete-policy-button').on('click', function () {
@ -128,7 +129,7 @@ nf.PolicyManagement = (function () {
handler: { handler: {
close: function () { close: function () {
// reset the search fields // reset the search fields
$('#search-users-field').val(''); $('#search-users-field').userSearchAutocomplete('reset').val('');
$('#selected-user-id').text(''); $('#selected-user-id').text('');
} }
} }
@ -136,6 +137,9 @@ nf.PolicyManagement = (function () {
// configure the user auto complete // configure the user auto complete
$.widget('nf.userSearchAutocomplete', $.ui.autocomplete, { $.widget('nf.userSearchAutocomplete', $.ui.autocomplete, {
reset: function () {
this.term = null;
},
_normalize: function (searchResults) { _normalize: function (searchResults) {
var items = []; var items = [];
items.push(searchResults); items.push(searchResults);

View File

@ -103,13 +103,16 @@ nf.ClusterSearch = (function () {
handler: { handler: {
close: function () { close: function () {
// reset the search field // reset the search field
$('#cluster-search-field').val(config.search).addClass('search-nodes'); $('#cluster-search-field').val(config.search).addClass('search-nodes').clusterSearchAutocomplete('reset');
} }
} }
}); });
// configure the cluster auto complete // configure the cluster auto complete
$.widget('nf.clusterSearchAutocomplete', $.ui.autocomplete, { $.widget('nf.clusterSearchAutocomplete', $.ui.autocomplete, {
reset: function () {
this.term = null;
},
_normalize: function (searchResults) { _normalize: function (searchResults) {
var items = []; var items = [];
items.push(searchResults); items.push(searchResults);
@ -134,7 +137,7 @@ nf.ClusterSearch = (function () {
}, },
_resizeMenu: function () { _resizeMenu: function () {
var ul = this.menu.element; var ul = this.menu.element;
ul.width(299); ul.width($('#cluster-search-field').width() + 6);
} }
}); });
@ -171,6 +174,7 @@ nf.ClusterSearch = (function () {
$('#view-single-node-link').click(function () { $('#view-single-node-link').click(function () {
// hold the search nodes dialog // hold the search nodes dialog
$('#view-single-node-dialog').modal('show'); $('#view-single-node-dialog').modal('show');
$('#cluster-search-field').focus();
}); });
// handle the view cluster click event // handle the view cluster click event