From 321a2398ba7a729b45c3faa66926f2c890f7c97d Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Thu, 4 Aug 2016 09:04:33 -0400 Subject: [PATCH] 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 --- .../src/main/webapp/js/nf/canvas/nf-policy-management.js | 6 +++++- .../src/main/webapp/js/nf/summary/nf-cluster-search.js | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js index 6f0756c3e5..adbc42dde9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js @@ -31,6 +31,7 @@ nf.PolicyManagement = (function () { var initAddTenantToPolicyDialog = function () { $('#new-policy-user-button').on('click', function () { $('#search-users-dialog').modal('show'); + $('#search-users-field').focus(); }); $('#delete-policy-button').on('click', function () { @@ -128,7 +129,7 @@ nf.PolicyManagement = (function () { handler: { close: function () { // reset the search fields - $('#search-users-field').val(''); + $('#search-users-field').userSearchAutocomplete('reset').val(''); $('#selected-user-id').text(''); } } @@ -136,6 +137,9 @@ nf.PolicyManagement = (function () { // configure the user auto complete $.widget('nf.userSearchAutocomplete', $.ui.autocomplete, { + reset: function () { + this.term = null; + }, _normalize: function (searchResults) { var items = []; items.push(searchResults); diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js index 799c2cc19f..b5c9e681ac 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js @@ -103,13 +103,16 @@ nf.ClusterSearch = (function () { handler: { close: function () { // 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 $.widget('nf.clusterSearchAutocomplete', $.ui.autocomplete, { + reset: function () { + this.term = null; + }, _normalize: function (searchResults) { var items = []; items.push(searchResults); @@ -134,7 +137,7 @@ nf.ClusterSearch = (function () { }, _resizeMenu: function () { 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 () { // hold the search nodes dialog $('#view-single-node-dialog').modal('show'); + $('#cluster-search-field').focus(); }); // handle the view cluster click event