From 2de45b62a75deab3b2801b30d5f0a45301afbf90 Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Wed, 7 Jan 2015 10:22:27 -0500 Subject: [PATCH] NIFI-231: - Cleaning up all tooltips that are based on dynamic content. --- .../nf/canvas/nf-processor-property-table.js | 8 ++++- .../canvas/nf-remote-process-group-ports.js | 5 +++ .../src/main/webapp/js/nf/nf-common.js | 16 ++++++++++ .../main/webapp/js/nf/nf-processor-details.js | 10 ++++-- .../webapp/js/nf/summary/nf-summary-table.js | 31 ++++++++++++++++--- 5 files changed, 62 insertions(+), 8 deletions(-) diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-property-table.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-property-table.js index 12a652c950..4c047024f2 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-property-table.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-property-table.js @@ -553,7 +553,13 @@ nf.ProcessorPropertyTable = (function () { * Clears the property table. */ clear: function () { - var propertyGrid = $('#processor-properties').data('gridInstance'); + var propertyGridElement = $('#processor-properties'); + + // clean up any tooltips that may have been generated + nf.Common.cleanUpTooltips(propertyGridElement, 'img.icon-info'); + + // clear the data in the grid + var propertyGrid = propertyGridElement.data('gridInstance'); var propertyData = propertyGrid.getData(); propertyData.setItems([]); } diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js index caadfea188..d80e4ea391 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-remote-process-group-ports.js @@ -161,6 +161,11 @@ nf.RemoteProcessGroupPorts = (function () { $('#remote-process-group-ports-id').text(''); $('#remote-process-group-ports-name').text(''); $('#remote-process-group-ports-url').text(''); + + // clear any tooltips + var dialog = $('#remote-process-group-ports'); + nf.Common.cleanUpTooltips(dialog, 'div.remote-port-removed'); + nf.Common.cleanUpTooltips(dialog, 'img.concurrent-tasks-info'); // clear the input and output ports $('#remote-process-group-input-ports-container').empty(); diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js index 24dcf24596..171b96f3da 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-common.js @@ -295,6 +295,22 @@ nf.Common = { return $('#' + target).removeClass('unset blank').text(''); }, + /** + * Cleans up any tooltips that have been created for the specified container. + * + * @param {jQuery} container + * @param {string} tooltipTarget + */ + cleanUpTooltips: function(container, tooltipTarget) { + container.find(tooltipTarget).each(function () { + var tip = $(this); + if (tip.data('qtip')) { + var api = tip.qtip('api'); + api.destroy(true); + } + }); + }, + /** * Formats the tooltip for the specified property. * diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js index 220338f77b..a3a2589e3d 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/nf-processor-details.js @@ -230,8 +230,14 @@ nf.ProcessorDetails = (function () { // empty the relationship list $('#read-only-auto-terminate-relationship-names').css('border-width', '0').empty(); - // clear the grid - var propertyGrid = $('#read-only-processor-properties').data('gridInstance'); + // get the property grid element + var propertyGridElement = $('#read-only-processor-properties'); + + // clean up any tooltips that may have been generated + nf.Common.cleanUpTooltips(propertyGridElement, 'img.icon-info'); + + // clear the data in the grid + var propertyGrid = propertyGridElement.data('gridInstance'); var propertyData = propertyGrid.getData(); propertyData.setItems([]); diff --git a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js index 85826ffe28..969d7bf745 100644 --- a/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js +++ b/nar-bundles/framework-bundle/framework/web/nifi-web-ui/src/main/webapp/js/nf/summary/nf-summary-table.js @@ -1959,7 +1959,7 @@ nf.SummaryTable = (function () { } }).fail(nf.Common.handleAjaxError); }; - + return { /** * URL for loading system diagnostics. @@ -2040,19 +2040,40 @@ nf.SummaryTable = (function () { var processGroupStatus = response.processGroupStatus; if (nf.Common.isDefinedAndNotNull(processGroupStatus)) { - var processorsGrid = $('#processor-summary-table').data('gridInstance'); + // remove any tooltips from the processor table + var processorsGridElement = $('#processor-summary-table'); + nf.Common.cleanUpTooltips(processorsGridElement, 'img.has-bulletins'); + + // get the processor grid/data + var processorsGrid = processorsGridElement.data('gridInstance'); var processorsData = processorsGrid.getData(); + // get the connections grid/data (do not render bulletins) var connectionsGrid = $('#connection-summary-table').data('gridInstance'); var connectionsData = connectionsGrid.getData(); - var inputPortsGrid = $('#input-port-summary-table').data('gridInstance'); + // remove any tooltips from the input port table + var inputPortsGridElement = $('#input-port-summary-table'); + nf.Common.cleanUpTooltips(inputPortsGridElement, 'img.has-bulletins'); + + // get the input ports grid/data + var inputPortsGrid = inputPortsGridElement.data('gridInstance'); var inputPortsData = inputPortsGrid.getData(); - var outputPortsGrid = $('#output-port-summary-table').data('gridInstance'); + // remove any tooltips from the output port table + var outputPortsGridElement = $('#output-port-summary-table'); + nf.Common.cleanUpTooltips(outputPortsGridElement, 'img.has-bulletins'); + + // get the output ports grid/data + var outputPortsGrid = outputPortsGridElement.data('gridInstance'); var outputPortsData = outputPortsGrid.getData(); - var remoteProcessGroupsGrid = $('#remote-process-group-summary-table').data('gridInstance'); + // remove any tooltips from the remote process group table + var remoteProcessGroupsGridElement = $('#remote-process-group-summary-table'); + nf.Common.cleanUpTooltips(remoteProcessGroupsGridElement, 'img.has-bulletins'); + + // get the remote process groups grid + var remoteProcessGroupsGrid = remoteProcessGroupsGridElement.data('gridInstance'); var remoteProcessGroupsData = remoteProcessGroupsGrid.getData(); var processorItems = [];