NIFI-250: - Including active threads in the reporting task dto. - Verifying actions taken against component referencing controller services. - Rendering the run state for reporting tasks (including active thread counts).
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/50f0c123 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/50f0c123 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/50f0c123 Branch: refs/heads/NIFI-250 Commit: 50f0c123bcb8474b110aac0abc528c0f9b6fe24a Parents: cd69a42 Author: Matt Gilman <[email protected]> Authored: Fri Mar 13 10:46:49 2015 -0400 Committer: Matt Gilman <[email protected]> Committed: Fri Mar 13 10:46:49 2015 -0400 ---------------------------------------------------------------------- .../org/apache/nifi/web/api/dto/DtoFactory.java | 5 ++-- .../dao/impl/StandardControllerServiceDAO.java | 8 +++--- .../src/main/webapp/js/nf/canvas/nf-settings.js | 28 +++++++++++++++++++- 3 files changed, 34 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/50f0c123/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java index 1dcf856..7286c83 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/dto/DtoFactory.java @@ -843,11 +843,12 @@ public final class DtoFactory { dto.setId(reportingTaskNode.getIdentifier()); dto.setName(reportingTaskNode.getName()); dto.setType(reportingTaskNode.getReportingTask().getClass().getName()); - dto.setState(reportingTaskNode.getScheduledState().name()); dto.setSchedulingStrategy(reportingTaskNode.getSchedulingStrategy().name()); dto.setSchedulingPeriod(reportingTaskNode.getSchedulingPeriod()); + dto.setState(reportingTaskNode.getScheduledState().name()); + dto.setActiveThreadCount(reportingTaskNode.getActiveThreadCount()); // dto.setComments(reportingTaskNode.getComments()); - + final Map<String, String> defaultSchedulingPeriod = new HashMap<>(); defaultSchedulingPeriod.put(SchedulingStrategy.TIMER_DRIVEN.name(), SchedulingStrategy.TIMER_DRIVEN.getDefaultSchedulingPeriod()); defaultSchedulingPeriod.put(SchedulingStrategy.CRON_DRIVEN.name(), SchedulingStrategy.CRON_DRIVEN.getDefaultSchedulingPeriod()); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/50f0c123/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardControllerServiceDAO.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardControllerServiceDAO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardControllerServiceDAO.java index 096058d..38abf64 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardControllerServiceDAO.java +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/impl/StandardControllerServiceDAO.java @@ -189,15 +189,15 @@ public class StandardControllerServiceDAO extends ComponentDAO implements Contro if (controllerServiceState != null) { if (ControllerServiceState.ENABLED.equals(controllerServiceState)) { -// serviceProvider.enableReferencingServices(controllerService); + serviceProvider.verifyCanEnableReferencingServices(controllerService); } else { -// serviceProvider.disableReferencingServices(controllerService); + serviceProvider.verifyCanDisableReferencingServices(controllerService); } } else if (scheduledState != null) { if (ScheduledState.RUNNING.equals(scheduledState)) { -// serviceProvider.scheduleReferencingComponents(controllerService); + serviceProvider.verifyCanScheduleReferencingComponents(controllerService); } else { -// serviceProvider.unscheduleReferencingComponents(controllerService); + serviceProvider.verifyCanStopReferencingComponents(controllerService); } } } http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/50f0c123/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js index 2659d90..cf29730 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js @@ -1300,6 +1300,32 @@ nf.Settings = (function () { return markup; }; + var reportingTaskRunStatusFormatter = function (row, cell, value, columnDef, dataContext) { + // determine the appropriate label + var label; + if (!nf.Common.isEmpty(dataContext.validationErrors)) { + label = 'Invalid'; + } else { + if (value === 'STOPPED') { + label = 'Stopped'; + } else if (value === 'RUNNING') { + label = 'Running'; + } else { + label = 'Disabled'; + } + } + + // include the active thread count if appropriate + var activeThreadCount = ''; + if (nf.Common.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) { + activeThreadCount = '(' + dataContext.activeThreadCount + ')'; + } + + // format the markup + var formattedValue = '<div class="' + nf.Common.escapeHtml(label.toLowerCase()) + '" style="margin-top: 3px;"></div>'; + return formattedValue + '<div class="status-text" style="margin-top: 2px; margin-left: 4px; float: left;">' + nf.Common.escapeHtml(label) + '</div><div style="float: left; margin-left: 4px;">' + nf.Common.escapeHtml(activeThreadCount) + '</div>'; + }; + var reportingTaskActionFormatter = function (row, cell, value, columnDef, dataContext) { var markup = ''; @@ -1325,7 +1351,7 @@ nf.Settings = (function () { {id: 'moreDetails', field: 'moreDetails', name: ' ', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 50, maxWidth: 50}, {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true}, {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true, formatter: typeFormatter}, - {id: 'state', field: 'state', name: 'State', sortable: true, resizeable: true}, + {id: 'state', field: 'state', name: 'State', sortable: true, resizeable: true, formatter: reportingTaskRunStatusFormatter}, {id: 'actions', name: ' ', resizable: false, formatter: reportingTaskActionFormatter, sortable: false, width: 90, maxWidth: 90} ];
