NIFI-27: - Updating cluster search to work with upgraded jquery ui. - Better support for case when no results are found.
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/68e08983 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/68e08983 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/68e08983 Branch: refs/heads/NIFI-169 Commit: 68e0898399f7a8165fc35fb31157db9763519382 Parents: 71e53ae Author: Matt Gilman <matt.c.gil...@gmail.com> Authored: Fri Dec 12 10:34:56 2014 -0500 Committer: Matt Gilman <matt.c.gil...@gmail.com> Committed: Fri Dec 12 10:34:56 2014 -0500 ---------------------------------------------------------------------- .../summary/view-single-node-dialog.jsp | 1 + .../nifi-web-ui/src/main/webapp/css/summary.css | 11 +++++++- .../webapp/js/nf/summary/nf-cluster-search.js | 29 +++++++++++++++----- 3 files changed, 33 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/68e08983/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/view-single-node-dialog.jsp ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/view-single-node-dialog.jsp b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/view-single-node-dialog.jsp index 9570de5..4a3338c 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/view-single-node-dialog.jsp +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/WEB-INF/partials/summary/view-single-node-dialog.jsp @@ -21,3 +21,4 @@ <div id="cluster-search-example">(e.g. my.host:80)</div> </div> </div> +<div id="search-cluster-results"></div> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/68e08983/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/css/summary.css ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/css/summary.css b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/css/summary.css index cab21c0..c109927 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/css/summary.css +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/css/summary.css @@ -139,9 +139,18 @@ div.search-match { font-size: 10px; } -.ui-autocomplete { +#search-cluster-results .ui-autocomplete { max-height: 300px; overflow: auto; + border: 1px solid #aaaaaa; + z-index: 1351; + border-radius: 0; +} + +#search-cluster-results .ui-menu .ui-menu-item a.ui-state-focus { + background: #D4E0E5 !important; + border: 1px solid #999999; + border-radius: 0; } input.search-nodes { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/68e08983/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js index 035e6f0..2254943 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-cluster-search.js @@ -102,13 +102,27 @@ nf.ClusterSearch = (function () { // configure the cluster auto complete $.widget('nf.clusterSearchAutocomplete', $.ui.autocomplete, { - _normalize: function (content) { - return $.map(content, function (item, i) { - return $.extend({ - label: item.address, - value: item.address - }, item); + _normalize: function(searchResults) { + var items = []; + items.push(searchResults); + return items; + }, + _renderMenu: function(ul, items) { + // results are normalized into a single element array + var searchResults = items[0]; + + var self = this; + $.each(searchResults.nodeResults, function(_, node) { + self._renderItemData(ul, { + label: node.address, + value: node.address + }); }); + + // ensure there were some results + if (ul.children().length === 0) { + ul.append('<li class="unset search-no-matches">No nodes matched the search terms</li>'); + } }, _resizeMenu: function () { var ul = this.menu.element; @@ -119,6 +133,7 @@ nf.ClusterSearch = (function () { // configure the autocomplete field $('#cluster-search-field').clusterSearchAutocomplete({ minLength: 0, + appendTo: '#search-cluster-results', position: { my: 'left top', at: 'left bottom', @@ -134,7 +149,7 @@ nf.ClusterSearch = (function () { dataType: 'json', url: config.urls.clusterSearch }).done(function (searchResponse) { - response(searchResponse.nodeResults); + response(searchResponse); }); } }).focus(function () {