From 08d0f3e59622d26ebc90d9fd61561e6be3e151fa Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Mon, 7 Dec 2015 19:43:56 -0500 Subject: [PATCH] NIFI-956: - Initialize the filter controls prior to the new processor table. Because of this, items were being incorrectly filtered on load. - Clean up in web.xml. Signed-off-by: Aldrin Piri --- .../src/main/webapp/WEB-INF/web.xml | 1 - .../webapp/js/nf/canvas/nf-canvas-toolbox.js | 26 +++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml index 232dbcea8b..e577209c13 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/web.xml @@ -23,7 +23,6 @@ NiFiCanvas - /canvas diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbox.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbox.js index 101406fcca..8c666ab739 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbox.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-toolbox.js @@ -337,7 +337,7 @@ nf.CanvasToolbox = (function () { // show the dialog $('#new-processor-dialog').modal('show'); - + // setup the filter $('#processor-type-filter').focus().off('keyup').on('keyup', function (e) { var code = e.keyCode ? e.keyCode : e.which; @@ -349,8 +349,8 @@ nf.CanvasToolbox = (function () { }); // adjust the grid canvas now that its been rendered - grid.setSelectedRows([0]); grid.resizeCanvas(); + grid.setSelectedRows([0]); }; /** @@ -884,6 +884,17 @@ nf.CanvasToolbox = (function () { addToolboxIcon(config.type.template, toolbox, 'template-icon', 'template-icon-hover', 'template-icon-drag', promptForTemplate); addToolboxIcon(config.type.label, toolbox, 'label-icon', 'label-icon-hover', 'label-icon-drag', createLabel); + // define the function for filtering the list + $('#processor-type-filter').focus(function () { + if ($(this).hasClass(config.styles.filterList)) { + $(this).removeClass(config.styles.filterList).val(''); + } + }).blur(function () { + if ($(this).val() === '') { + $(this).addClass(config.styles.filterList).val(config.filterText); + } + }).addClass(config.styles.filterList).val(config.filterText); + // initialize the processor type table var processorTypesColumns = [ {id: 'type', name: 'Type', field: 'label', sortable: true, resizable: true}, @@ -1008,17 +1019,6 @@ nf.CanvasToolbox = (function () { }); }).fail(nf.Common.handleAjaxError); - // define the function for filtering the list - $('#processor-type-filter').focus(function () { - if ($(this).hasClass(config.styles.filterList)) { - $(this).removeClass(config.styles.filterList).val(''); - } - }).blur(function () { - if ($(this).val() === '') { - $(this).addClass(config.styles.filterList).val(config.filterText); - } - }).addClass(config.styles.filterList).val(config.filterText); - // configure the new processor dialog $('#new-processor-dialog').modal({ headerText: 'Add Processor',