Repository: nifi Updated Branches: refs/heads/master 78382c66b -> 768e89b57
NIFI-3246: - Preventing the editing of controller services that are defined in an ancestor process group. - Adding a go to link for users to easily navigate to where services are actually defined. This closes #1594 Signed-off-by: Scott Aslan <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/768e89b5 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/768e89b5 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/768e89b5 Branch: refs/heads/master Commit: 768e89b57938c41e64a275dc92053c88e7a421e2 Parents: 78382c6 Author: Matt Gilman <[email protected]> Authored: Tue Mar 14 11:08:24 2017 -0400 Committer: Scott Aslan <[email protected]> Committed: Tue Mar 14 14:15:14 2017 -0400 ---------------------------------------------------------------------- .../canvas/process-group-configuration.jsp | 1 + .../js/nf/canvas/nf-controller-services.js | 59 +++++++++++++++----- .../nf/canvas/nf-process-group-configuration.js | 34 +++++------ 3 files changed, 65 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/768e89b5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/process-group-configuration.jsp ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/process-group-configuration.jsp b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/process-group-configuration.jsp index 6be8803..6fd904d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/process-group-configuration.jsp +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/WEB-INF/partials/canvas/process-group-configuration.jsp @@ -28,6 +28,7 @@ <div id="general-process-group-configuration"> <div class="setting"> <div class="setting-name">Process group name</div> + <span id="process-group-id" class="hidden"></span> <div class="editable setting-field"> <input type="text" id="process-group-name" class="setting-input"/> </div> http://git-wip-us.apache.org/repos/asf/nifi/blob/768e89b5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js index 5274f79..9f1a26d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-services.js @@ -753,23 +753,38 @@ var markup = ''; if (dataContext.permissions.canRead && dataContext.permissions.canWrite) { - if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') { - markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>'; - } else if (dataContext.component.state === 'DISABLED') { - markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>'; - - // if there are no validation errors allow enabling - if (nfCommon.isEmpty(dataContext.component.validationErrors)) { - markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>'; + var definedByCurrentGroup = false; + if (nfCommon.isDefinedAndNotNull(dataContext.component.parentGroupId)) { + // when opened in the process group context, the current group is store in #process-group-id + if (dataContext.component.parentGroupId === $('#process-group-id').text()) { + definedByCurrentGroup = true; } + } else { + // when there is no parent group, the service is defined at the controller level and should be editable + definedByCurrentGroup = true; } - if (dataContext.component.persistsState === true) { - markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>'; - } + if (definedByCurrentGroup === true) { + if (dataContext.component.state === 'ENABLED' || dataContext.component.state === 'ENABLING') { + markup += '<div class="pointer disable-controller-service icon icon-enable-false" title="Disable" style="margin-top: 2px; margin-right: 3px;" ></div>'; + } else if (dataContext.component.state === 'DISABLED') { + markup += '<div class="pointer edit-controller-service fa fa-pencil" title="Edit" style="margin-top: 2px; margin-right: 3px;" ></div>'; + + // if there are no validation errors allow enabling + if (nfCommon.isEmpty(dataContext.component.validationErrors)) { + markup += '<div class="pointer enable-controller-service fa fa-flash" title="Enable" style="margin-top: 2px; margin-right: 3px;"></div>'; + } + } - if (canWriteControllerServiceParent(dataContext)) { - markup += '<div class="pointer delete-controller-service fa fa-trash" title="Remove" style="margin-top: 2px; margin-right: 3px;" ></div>'; + if (dataContext.component.persistsState === true) { + markup += '<div title="View State" class="pointer view-state-controller-service fa fa-tasks" style="margin-top: 2px; margin-right: 3px;" ></div>'; + } + + if (canWriteControllerServiceParent(dataContext)) { + markup += '<div class="pointer delete-controller-service fa fa-trash" title="Remove" style="margin-top: 2px; margin-right: 3px;" ></div>'; + } + } else { + markup += '<div class="pointer go-to-controller-service fa fa-long-arrow-right" title="Go To" style="margin-top: 2px; margin-right: 3px;" ></div>'; } } @@ -875,6 +890,24 @@ // close the settings dialog $('#shell-close-button').click(); + } else if (target.hasClass('go-to-controller-service')) { + // load the parent group of the selected service + nfProcessGroup.enterGroup(controllerServiceEntity.component.parentGroupId); + + // open/select the specific service + $.Deferred(function (deferred) { + if ($('#process-group-configuration').is(':visible')) { + nfProcessGroupConfiguration.loadConfiguration(controllerServiceEntity.component.parentGroupId).done(function () { + deferred.resolve(); + }); + } else { + nfProcessGroupConfiguration.showConfiguration(controllerServiceEntity.component.parentGroupId).done(function () { + deferred.resolve(); + }); + } + }).done(function () { + nfProcessGroupConfiguration.selectControllerService(controllerServiceEntity.id); + }); } } else if (controllerServicesGrid.getColumns()[args.cell].id === 'moreDetails') { if (target.hasClass('view-controller-service')) { http://git-wip-us.apache.org/repos/asf/nifi/blob/768e89b5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js index 2ca9226..00810c7 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-process-group-configuration.js @@ -151,6 +151,23 @@ } }; + // record the group id + $('#process-group-id').text(groupId); + + // update the click listener + $('#process-group-configuration-refresh-button').off('click').on('click', function () { + loadConfiguration(groupId); + }); + + // update the new controller service click listener + $('#add-process-group-configuration-controller-service').off('click').on('click', function () { + var selectedTab = $('#process-group-configuration-tabs li.selected-tab').text(); + if (selectedTab === 'Controller Services') { + var controllerServicesUri = config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/controller-services'; + nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable()); + } + }); + var processGroup = $.Deferred(function (deferred) { $.ajax({ type: 'GET', @@ -164,7 +181,6 @@ var processGroup = response.component; // populate the process group settings - $('#process-group-id').text(processGroup.id); $('#process-group-name').removeClass('unset').val(processGroup.name); $('#process-group-comments').removeClass('unset').val(processGroup.comments); @@ -253,6 +269,7 @@ $('#process-group-configuration-save').mouseout(); // reset the fields + $('#process-group-id').text(''); $('#process-group-name').val(''); $('#process-group-comments').val(''); @@ -330,21 +347,6 @@ * Shows the settings dialog. */ showConfiguration: function (groupId) { - // update the click listener - $('#process-group-configuration-refresh-button').off('click').on('click', function () { - loadConfiguration(groupId); - }); - - // update the new controller service click listener - $('#add-process-group-configuration-controller-service').off('click').on('click', function () { - var selectedTab = $('#process-group-configuration-tabs li.selected-tab').text(); - if (selectedTab === 'Controller Services') { - var controllerServicesUri = config.urls.api + '/process-groups/' + encodeURIComponent(groupId) + '/controller-services'; - nfControllerServices.promptNewControllerService(controllerServicesUri, getControllerServicesTable()); - } - }); - - // load the configuration return loadConfiguration(groupId).done(showConfiguration); },
