You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/01/29 16:51:30 UTC
incubator-nifi git commit: NIFI-250: - Addressing some issues with
reloading controller services on restart. - Starting to add the controller
service references to the dialog. - Reloading processors and controller
services before configuration to ensure
Repository: incubator-nifi
Updated Branches:
refs/heads/NIFI-250 d60710b6f -> 4737a41a9
NIFI-250:
- Addressing some issues with reloading controller services on restart.
- Starting to add the controller service references to the dialog.
- Reloading processors and controller services before configuration to ensure their property descriptors are current.
Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/4737a41a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/4737a41a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/4737a41a
Branch: refs/heads/NIFI-250
Commit: 4737a41a9ce7de540c7dce1d19e54802ce9127a9
Parents: d60710b
Author: Matt Gilman <ma...@gmail.com>
Authored: Thu Jan 29 10:51:18 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Thu Jan 29 10:51:18 2015 -0500
----------------------------------------------------------------------
.../nifi/web/api/dto/ControllerServiceDTO.java | 17 +-
.../controller/StandardFlowSynchronizer.java | 2 +-
.../org/apache/nifi/web/api/dto/DtoFactory.java | 9 +
.../nf-controller-service-configuration.js | 325 +++++++-------
.../js/nf/canvas/nf-processor-configuration.js | 418 ++++++++++---------
5 files changed, 418 insertions(+), 353 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4737a41a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
index 5c4d20e..992d8e5 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/dto/ControllerServiceDTO.java
@@ -169,6 +169,8 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
private String type;
private String state;
private Boolean enabled;
+
+ private String referenceType;
/**
* Group id for this component referencing a controller service. If this
@@ -250,8 +252,17 @@ public class ControllerServiceDTO extends NiFiComponentDTO {
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
-
-
+
+ /**
+ * The type of reference this is (Processor, ControllerService, or ReportingTask).
+ * @return
+ */
+ public String getReferenceType() {
+ return referenceType;
+ }
+
+ public void setReferenceType(String referenceType) {
+ this.referenceType = referenceType;
+ }
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4737a41a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowSynchronizer.java
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowSynchronizer.java b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowSynchronizer.java
index 08176f7..b8ad3ad 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowSynchronizer.java
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowSynchronizer.java
@@ -345,7 +345,7 @@ public class StandardFlowSynchronizer implements FlowSynchronizer {
private void addControllerService(final FlowController controller, final Element controllerServiceElement, final StringEncryptor encryptor) {
final ControllerServiceDTO dto = FlowFromDOMFactory.getControllerService(controllerServiceElement, encryptor);
- final ControllerServiceNode node = controller.createControllerService(dto.getType(), false);
+ final ControllerServiceNode node = controller.createControllerService(dto.getType(), dto.getId(), false);
node.setName(dto.getName());
node.setAvailability(Availability.valueOf(dto.getAvailability()));
node.setComments(dto.getComments());
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4737a41a/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 d261fd3..198ffab 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
@@ -124,7 +124,9 @@ import org.apache.nifi.web.api.dto.status.RemoteProcessGroupStatusDTO;
import org.apache.nifi.web.api.dto.status.StatusDTO;
import org.apache.commons.lang3.StringUtils;
import org.apache.nifi.controller.ConfiguredComponent;
+import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.service.ControllerServiceNode;
+import org.apache.nifi.reporting.ReportingTask;
import org.apache.nifi.web.api.dto.ControllerServiceDTO.ControllerServiceReferenceDTO;
/**
@@ -902,10 +904,17 @@ public final class DtoFactory {
reference.setGroupId(node.getProcessGroup().getIdentifier());
reference.setState(node.getScheduledState().name());
reference.setType(node.getProcessor().getClass().getName());
+ reference.setReferenceType(Processor.class.getSimpleName());
} else if (component instanceof ControllerServiceNode) {
final ControllerServiceNode node = ((ControllerServiceNode) component);
reference.setEnabled(!node.isDisabled());
reference.setType(node.getControllerServiceImplementation().getClass().getName());
+ reference.setReferenceType(ControllerService.class.getSimpleName());
+ } else if (component instanceof ReportingTask) {
+ final ReportingTaskNode node = ((ReportingTaskNode) component);
+ reference.setState(node.getScheduledState().name());
+ reference.setType(node.getReportingTask().getClass().getName());
+ reference.setReferenceType(ReportingTask.class.getSimpleName());
}
dto.getReferences().add(reference);
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4737a41a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service-configuration.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-controller-service-configuration.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service-configuration.js
index ca8c583..951103b 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service-configuration.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service-configuration.js
@@ -166,10 +166,37 @@ nf.ControllerServiceConfiguration = (function () {
/**
* Adds the specified reference for this controller service.
*
- * @param {object} reference
+ * @param {array} references
*/
- var createReference = function (reference) {
+ var createReferences = function (references) {
+ var processors = $('<ul class="processor-references"></ul>');
+ var services = $('<ul class="controller-service-references"></ul>');
+ var tasks = $('<ul class="reporting-task-references"></ul>');
+ $.each(references, function (_, reference) {
+ if (reference.referenceType === 'Processor') {
+ var processorItem = $('<li></li>').text(reference.name);
+ processors.append(processorItem);
+ } else if (reference.referenceType === 'ControllerService') {
+ var serviceItem = $('<li></li>').text(reference.name);
+ services.append(serviceItem);
+ } else if (reference.referenceType === 'ReportingTask') {
+ var taskItem = $('<li></li>').text(reference.name);
+ tasks.append(taskItem);
+ }
+ });
+
+// .append('<span class="expansion-button expanded"></span>')
+ var controllerServiceReferences = $('#controller-service-references');
+ $('<div>Processors</div>').on('click', function () {
+
+ }).append(processors).appendTo(controllerServiceReferences);
+ $('<div>Controller Services</div>').on('click', function () {
+
+ }).append(services).appendTo(controllerServiceReferences);
+ $('<div>Reporting Tasks</div>').on('click', function () {
+
+ }).append(tasks).appendTo(controllerServiceReferences);
};
/**
@@ -251,7 +278,6 @@ nf.ControllerServiceConfiguration = (function () {
// removed the cached controller service details
$('#controller-service-configuration').removeData('controllerServiceDetails');
- $('#controller-service-configuration').removeData('controllerServiceHistory');
}
}
});
@@ -269,161 +295,170 @@ nf.ControllerServiceConfiguration = (function () {
* @argument {controllerService} controllerService The controller service
*/
showConfiguration: function (controllerService) {
- // record the controller service details
- $('#controller-service-configuration').data('controllerServiceDetails', controllerService);
-
- // determine if the enabled checkbox is checked or not
- var controllerServiceEnableStyle = 'checkbox-checked';
- if (controllerService['enabled'] === false) {
- controllerServiceEnableStyle = 'checkbox-unchecked';
- }
-
- // populate the controller service settings
- $('#controller-service-id').text(controllerService['id']);
- $('#controller-service-type').text(nf.Common.substringAfterLast(controllerService['type'], '.'));
- $('#controller-service-name').val(controllerService['name']);
- $('#controller-service-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(controllerServiceEnableStyle);
- $('#controller-service-comments').val(controllerService['comments']);
+ // reload the service in case the property descriptors have changed
+ var reloadService = $.ajax({
+ type: 'GET',
+ url: '../nifi-api/controller/controller-services/' + encodeURIComponent(controllerService.id),
+ dataType: 'json'
+ });
+
+ // get the controller service history
+ var loadHistory = $.ajax({
+ type: 'GET',
+ url: '../nifi-api/controller/history/controller-services/' + encodeURIComponent(controllerService.id),
+ dataType: 'json'
+ });
+
+ // once everything is loaded, show the dialog
+ $.when(reloadService, loadHistory).done(function (serviceResponse, historyResponse) {
+ // get the updated controller service
+ controllerService = serviceResponse[0].controllerService;
+
+ // get the controller service history
+ var controllerServiceHistory = historyResponse[0].componentHistory;
+
+ // record the controller service details
+ $('#controller-service-configuration').data('controllerServiceDetails', controllerService);
+
+ // determine if the enabled checkbox is checked or not
+ var controllerServiceEnableStyle = 'checkbox-checked';
+ if (controllerService['enabled'] === false) {
+ controllerServiceEnableStyle = 'checkbox-unchecked';
+ }
- // select the availability when appropriate
- if (nf.Canvas.isClustered()) {
- $('#availability-combo').combo('setSelectedOption', {
- value: controllerService['availability']
- });
- }
+ // populate the controller service settings
+ $('#controller-service-id').text(controllerService['id']);
+ $('#controller-service-type').text(nf.Common.substringAfterLast(controllerService['type'], '.'));
+ $('#controller-service-name').val(controllerService['name']);
+ $('#controller-service-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(controllerServiceEnableStyle);
+ $('#controller-service-comments').val(controllerService['comments']);
+
+ // select the availability when appropriate
+ if (nf.Canvas.isClustered()) {
+ $('#availability-combo').combo('setSelectedOption', {
+ value: controllerService['availability']
+ });
+ }
- // load the controller references list
- if (!nf.Common.isEmpty(controllerService.references)) {
- $.each(controllerService.references, function (_, reference) {
- createReference(reference);
- });
- } else {
- $('#controller-service-references').append('<div class="unset">This service has no components referencing it.</div>');
- }
+ // load the controller references list
+ if (!nf.Common.isEmpty(controllerService.references)) {
+ createReferences(controllerService.references);
+ } else {
+ $('#controller-service-references').append('<div class="unset">This service has no components referencing it.</div>');
+ }
- var buttons = [{
- buttonText: 'Apply',
- handler: {
- click: function () {
- // close all fields currently being edited
- $('#controller-service-properties').propertytable('saveRow');
-
- // marshal the settings and properties and update the controller service
- var updatedControllerService = marshalDetails();
-
- // ensure details are valid as far as we can tell
- if (validateDetails(updatedControllerService)) {
- // update the selected component
- $.ajax({
- type: 'PUT',
- data: JSON.stringify(updatedControllerService),
- url: controllerService.uri,
- dataType: 'json',
- processData: false,
- contentType: 'application/json'
- }).done(function (response) {
- if (nf.Common.isDefinedAndNotNull(response.controllerService)) {
- // update the revision
- nf.Client.setRevision(response.revision);
-
- // reload the controller service
- renderControllerService(response.controllerService);
-
- // close the details panel
- $('#controller-service-configuration').modal('hide');
- }
- }).fail(handleControllerServiceConfigurationError);
+ var buttons = [{
+ buttonText: 'Apply',
+ handler: {
+ click: function () {
+ // close all fields currently being edited
+ $('#controller-service-properties').propertytable('saveRow');
+
+ // marshal the settings and properties and update the controller service
+ var updatedControllerService = marshalDetails();
+
+ // ensure details are valid as far as we can tell
+ if (validateDetails(updatedControllerService)) {
+ // update the selected component
+ $.ajax({
+ type: 'PUT',
+ data: JSON.stringify(updatedControllerService),
+ url: controllerService.uri,
+ dataType: 'json',
+ processData: false,
+ contentType: 'application/json'
+ }).done(function (response) {
+ if (nf.Common.isDefinedAndNotNull(response.controllerService)) {
+ // update the revision
+ nf.Client.setRevision(response.revision);
+
+ // reload the controller service
+ renderControllerService(response.controllerService);
+
+ // close the details panel
+ $('#controller-service-configuration').modal('hide');
+ }
+ }).fail(handleControllerServiceConfigurationError);
+ }
}
}
- }
- }, {
- buttonText: 'Cancel',
- handler: {
- click: function () {
- $('#controller-service-configuration').modal('hide');
- }
- }
- }];
-
- // determine if we should show the advanced button
- if (nf.Common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
- buttons.push({
- buttonText: 'Advanced',
- handler: {
- click: function () {
- var openCustomUi = function () {
- // reset state and close the dialog manually to avoid hiding the faded background
+ }, {
+ buttonText: 'Cancel',
+ handler: {
+ click: function () {
$('#controller-service-configuration').modal('hide');
-
- // show the custom ui
- nf.CustomProcessorUi.showCustomUi($('#controller-service-id').text(), controllerService.customUiUrl, true).done(function () {
- // once the custom ui is closed, reload the controller service
- reloadControllerService(controllerService);
- });
- };
-
- // close all fields currently being edited
- $('#controller-service-properties').propertytable('saveRow');
-
- // determine if changes have been made
- if (isSaveRequired()) {
- // see if those changes should be saved
- nf.Dialog.showYesNoDialog({
- dialogContent: 'Save changes before opening the advanced configuration?',
- overlayBackground: false,
- noHandler: openCustomUi,
- yesHandler: function () {
- // marshal the settings and properties and update the controller service
- var updatedControllerService = marshalDetails();
-
- // ensure details are valid as far as we can tell
- if (validateDetails(updatedControllerService)) {
- // update the selected component
- $.ajax({
- type: 'PUT',
- data: JSON.stringify(updatedControllerService),
- url: controllerService.uri,
- dataType: 'json',
- processData: false,
- contentType: 'application/json'
- }).done(function (response) {
- if (nf.Common.isDefinedAndNotNull(response.controllerService)) {
- // update the revision
- nf.Client.setRevision(response.revision);
-
- // open the custom ui
- openCustomUi();
- }
- }).fail(handleControllerServiceConfigurationError);
+ }
+ }
+ }];
+
+ // determine if we should show the advanced button
+ if (nf.Common.isDefinedAndNotNull(controllerService.customUiUrl) && controllerService.customUiUrl !== '') {
+ buttons.push({
+ buttonText: 'Advanced',
+ handler: {
+ click: function () {
+ var openCustomUi = function () {
+ // reset state and close the dialog manually to avoid hiding the faded background
+ $('#controller-service-configuration').modal('hide');
+
+ // show the custom ui
+ nf.CustomProcessorUi.showCustomUi($('#controller-service-id').text(), controllerService.customUiUrl, true).done(function () {
+ // once the custom ui is closed, reload the controller service
+ reloadControllerService(controllerService);
+ });
+ };
+
+ // close all fields currently being edited
+ $('#controller-service-properties').propertytable('saveRow');
+
+ // determine if changes have been made
+ if (isSaveRequired()) {
+ // see if those changes should be saved
+ nf.Dialog.showYesNoDialog({
+ dialogContent: 'Save changes before opening the advanced configuration?',
+ overlayBackground: false,
+ noHandler: openCustomUi,
+ yesHandler: function () {
+ // marshal the settings and properties and update the controller service
+ var updatedControllerService = marshalDetails();
+
+ // ensure details are valid as far as we can tell
+ if (validateDetails(updatedControllerService)) {
+ // update the selected component
+ $.ajax({
+ type: 'PUT',
+ data: JSON.stringify(updatedControllerService),
+ url: controllerService.uri,
+ dataType: 'json',
+ processData: false,
+ contentType: 'application/json'
+ }).done(function (response) {
+ if (nf.Common.isDefinedAndNotNull(response.controllerService)) {
+ // update the revision
+ nf.Client.setRevision(response.revision);
+
+ // open the custom ui
+ openCustomUi();
+ }
+ }).fail(handleControllerServiceConfigurationError);
+ }
}
- }
- });
- } else {
- // if there were no changes, simply open the custom ui
- openCustomUi();
+ });
+ } else {
+ // if there were no changes, simply open the custom ui
+ openCustomUi();
+ }
}
}
- }
- });
- }
-
- // set the button model
- $('#controller-service-configuration').modal('setButtonModel', buttons);
-
- // get the controller service history
- $.ajax({
- type: 'GET',
- url: '../nifi-api/controller/history/controller-services/' + encodeURIComponent(controllerService.id),
- dataType: 'json'
- }).done(function (response) {
- var controllerServiceHistory = response.componentHistory;
+ });
+ }
+ // set the button model
+ $('#controller-service-configuration').modal('setButtonModel', buttons);
+
// load the property table
$('#controller-service-properties').propertytable('loadProperties', controllerService.properties, controllerService.descriptors, controllerServiceHistory.propertyHistory);
- // record the controller service history
- $('#controller-service-configuration').data('controllerServiceHistory', controllerServiceHistory);
-
// show the details
$('#controller-service-configuration').modal('show');
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/4737a41a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.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-processor-configuration.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
index ed11838..c7acd01 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
@@ -480,232 +480,242 @@ nf.ProcessorConfiguration = (function () {
// get the processor details
var processor = selectionData.component;
- // record the processor details
- $('#processor-configuration').data('processorDetails', processor);
+ // reload the processor in case an property descriptors have updated
+ var reloadProcessor = nf.Processor.reload(processor);
+
+ // get the processor history
+ var loadHistory = $.ajax({
+ type: 'GET',
+ url: '../nifi-api/controller/history/processors/' + encodeURIComponent(processor.id),
+ dataType: 'json'
+ });
+
+ // once everything is loaded, show the dialog
+ $.when(reloadProcessor, loadHistory).done(function (processorResponse, historyResponse) {
+ // get the updated processor
+ processor = processorResponse[0].processor;
+
+ // get the processor history
+ var processorHistory = historyResponse[0].componentHistory;
+
+ // record the processor details
+ $('#processor-configuration').data('processorDetails', processor);
+
+ // determine if the enabled checkbox is checked or not
+ var processorEnableStyle = 'checkbox-checked';
+ if (processor['state'] === 'DISABLED') {
+ processorEnableStyle = 'checkbox-unchecked';
+ }
- // determine if the enabled checkbox is checked or not
- var processorEnableStyle = 'checkbox-checked';
- if (processor['state'] === 'DISABLED') {
- processorEnableStyle = 'checkbox-unchecked';
- }
+ // populate the processor settings
+ $('#processor-id').text(processor['id']);
+ $('#processor-type').text(nf.Common.substringAfterLast(processor['type'], '.'));
+ $('#processor-name').val(processor['name']);
+ $('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle);
+ $('#penalty-duration').val(processor.config['penaltyDuration']);
+ $('#yield-duration').val(processor.config['yieldDuration']);
+ $('#processor-comments').val(processor.config['comments']);
+
+ // set the run duration
+ var runDuration = RUN_DURATION_VALUES.indexOf(processor.config['runDurationMillis']);
+ $('#run-duration-slider').slider('value', runDuration);
+
+ // select the appropriate bulletin level
+ $('#bulletin-level-combo').combo('setSelectedOption', {
+ value: processor.config['bulletinLevel']
+ });
- // populate the processor settings
- $('#processor-id').text(processor['id']);
- $('#processor-type').text(nf.Common.substringAfterLast(processor['type'], '.'));
- $('#processor-name').val(processor['name']);
- $('#processor-enabled').removeClass('checkbox-unchecked checkbox-checked').addClass(processorEnableStyle);
- $('#penalty-duration').val(processor.config['penaltyDuration']);
- $('#yield-duration').val(processor.config['yieldDuration']);
- $('#processor-comments').val(processor.config['comments']);
-
- // set the run duration
- var runDuration = RUN_DURATION_VALUES.indexOf(processor.config['runDurationMillis']);
- $('#run-duration-slider').slider('value', runDuration);
-
- // select the appropriate bulletin level
- $('#bulletin-level-combo').combo('setSelectedOption', {
- value: processor.config['bulletinLevel']
- });
+ // initialize the scheduling strategy
+ $('#scheduling-strategy-combo').combo({
+ options: getSchedulingStrategies(processor),
+ selectedOption: {
+ value: processor.config['schedulingStrategy']
+ },
+ select: function (selectedOption) {
+ // show the appropriate panel
+ if (selectedOption.value === 'EVENT_DRIVEN') {
+ $('#event-driven-warning').show();
- // initialize the scheduling strategy
- $('#scheduling-strategy-combo').combo({
- options: getSchedulingStrategies(processor),
- selectedOption: {
- value: processor.config['schedulingStrategy']
- },
- select: function (selectedOption) {
- // show the appropriate panel
- if (selectedOption.value === 'EVENT_DRIVEN') {
- $('#event-driven-warning').show();
-
- $('#timer-driven-options').hide();
- $('#event-driven-options').show();
- $('#cron-driven-options').hide();
- } else {
- $('#event-driven-warning').hide();
-
- if (selectedOption.value === 'CRON_DRIVEN') {
$('#timer-driven-options').hide();
- $('#event-driven-options').hide();
- $('#cron-driven-options').show();
- } else {
- $('#timer-driven-options').show();
- $('#event-driven-options').hide();
+ $('#event-driven-options').show();
$('#cron-driven-options').hide();
+ } else {
+ $('#event-driven-warning').hide();
+
+ if (selectedOption.value === 'CRON_DRIVEN') {
+ $('#timer-driven-options').hide();
+ $('#event-driven-options').hide();
+ $('#cron-driven-options').show();
+ } else {
+ $('#timer-driven-options').show();
+ $('#event-driven-options').hide();
+ $('#cron-driven-options').hide();
+ }
}
}
- }
- });
-
- // initialize the concurrentTasks
- var defaultConcurrentTasks = processor.config['defaultConcurrentTasks'];
- $('#timer-driven-concurrently-schedulable-tasks').val(defaultConcurrentTasks['TIMER_DRIVEN']);
- $('#event-driven-concurrently-schedulable-tasks').val(defaultConcurrentTasks['EVENT_DRIVEN']);
- $('#cron-driven-concurrently-schedulable-tasks').val(defaultConcurrentTasks['CRON_DRIVEN']);
-
- // get the appropriate concurrent tasks field
- var concurrentTasks;
- if (processor.config['schedulingStrategy'] === 'EVENT_DRIVEN') {
- concurrentTasks = $('#event-driven-concurrently-schedulable-tasks').val(processor.config['concurrentlySchedulableTaskCount']);
- } else if (processor.config['schedulingStrategy'] === 'CRON_DRIVEN') {
- concurrentTasks = $('#cron-driven-concurrently-schedulable-tasks').val(processor.config['concurrentlySchedulableTaskCount']);
- } else {
- concurrentTasks = $('#timer-driven-concurrently-schedulable-tasks').val(processor.config['concurrentlySchedulableTaskCount']);
- }
+ });
- // conditionally allow the user to specify the concurrent tasks
- if (nf.Common.isDefinedAndNotNull(concurrentTasks)) {
- if (processor.supportsParallelProcessing === true) {
- concurrentTasks.prop('disabled', false);
+ // initialize the concurrentTasks
+ var defaultConcurrentTasks = processor.config['defaultConcurrentTasks'];
+ $('#timer-driven-concurrently-schedulable-tasks').val(defaultConcurrentTasks['TIMER_DRIVEN']);
+ $('#event-driven-concurrently-schedulable-tasks').val(defaultConcurrentTasks['EVENT_DRIVEN']);
+ $('#cron-driven-concurrently-schedulable-tasks').val(defaultConcurrentTasks['CRON_DRIVEN']);
+
+ // get the appropriate concurrent tasks field
+ var concurrentTasks;
+ if (processor.config['schedulingStrategy'] === 'EVENT_DRIVEN') {
+ concurrentTasks = $('#event-driven-concurrently-schedulable-tasks').val(processor.config['concurrentlySchedulableTaskCount']);
+ } else if (processor.config['schedulingStrategy'] === 'CRON_DRIVEN') {
+ concurrentTasks = $('#cron-driven-concurrently-schedulable-tasks').val(processor.config['concurrentlySchedulableTaskCount']);
} else {
- concurrentTasks.prop('disabled', true);
+ concurrentTasks = $('#timer-driven-concurrently-schedulable-tasks').val(processor.config['concurrentlySchedulableTaskCount']);
}
- }
- // initialize the schedulingStrategy
- var defaultSchedulingPeriod = processor.config['defaultSchedulingPeriod'];
- $('#cron-driven-scheduling-period').val(defaultSchedulingPeriod['CRON_DRIVEN']);
- $('#timer-driven-scheduling-period').val(defaultSchedulingPeriod['TIMER_DRIVEN']);
+ // conditionally allow the user to specify the concurrent tasks
+ if (nf.Common.isDefinedAndNotNull(concurrentTasks)) {
+ if (processor.supportsParallelProcessing === true) {
+ concurrentTasks.prop('disabled', false);
+ } else {
+ concurrentTasks.prop('disabled', true);
+ }
+ }
- // set the scheduling period as appropriate
- if (processor.config['schedulingStrategy'] === 'CRON_DRIVEN') {
- $('#cron-driven-scheduling-period').val(processor.config['schedulingPeriod']);
- } else if (processor.config['schedulingStrategy'] !== 'EVENT_DRIVEN') {
- $('#timer-driven-scheduling-period').val(processor.config['schedulingPeriod']);
- }
+ // initialize the schedulingStrategy
+ var defaultSchedulingPeriod = processor.config['defaultSchedulingPeriod'];
+ $('#cron-driven-scheduling-period').val(defaultSchedulingPeriod['CRON_DRIVEN']);
+ $('#timer-driven-scheduling-period').val(defaultSchedulingPeriod['TIMER_DRIVEN']);
- // load the relationship list
- if (!nf.Common.isEmpty(processor.relationships)) {
- $.each(processor.relationships, function (i, relationship) {
- createRelationshipOption(relationship);
- });
- } else {
- $('#auto-terminate-relationship-names').append('<div class="unset">This processor has no relationships.</div>');
- }
+ // set the scheduling period as appropriate
+ if (processor.config['schedulingStrategy'] === 'CRON_DRIVEN') {
+ $('#cron-driven-scheduling-period').val(processor.config['schedulingPeriod']);
+ } else if (processor.config['schedulingStrategy'] !== 'EVENT_DRIVEN') {
+ $('#timer-driven-scheduling-period').val(processor.config['schedulingPeriod']);
+ }
- var buttons = [{
- buttonText: 'Apply',
- handler: {
- click: function () {
- // close all fields currently being edited
- $('#processor-properties').propertytable('saveRow');
-
- // marshal the settings and properties and update the processor
- var updatedProcessor = marshalDetails();
-
- // ensure details are valid as far as we can tell
- if (validateDetails(updatedProcessor)) {
- // update the selected component
- $.ajax({
- type: 'PUT',
- data: JSON.stringify(updatedProcessor),
- url: processor.uri,
- dataType: 'json',
- processData: false,
- contentType: 'application/json'
- }).done(function (response) {
- if (nf.Common.isDefinedAndNotNull(response.processor)) {
- // update the revision
- nf.Client.setRevision(response.revision);
-
- // set the new processor state based on the response
- nf.Processor.set(response.processor);
-
- // reload the processor's outgoing connections
- reloadProcessorConnections(processor);
+ // load the relationship list
+ if (!nf.Common.isEmpty(processor.relationships)) {
+ $.each(processor.relationships, function (i, relationship) {
+ createRelationshipOption(relationship);
+ });
+ } else {
+ $('#auto-terminate-relationship-names').append('<div class="unset">This processor has no relationships.</div>');
+ }
- // close the details panel
- $('#processor-configuration').modal('hide');
- }
- }).fail(handleProcessorConfigurationError);
+ var buttons = [{
+ buttonText: 'Apply',
+ handler: {
+ click: function () {
+ // close all fields currently being edited
+ $('#processor-properties').propertytable('saveRow');
+
+ // marshal the settings and properties and update the processor
+ var updatedProcessor = marshalDetails();
+
+ // ensure details are valid as far as we can tell
+ if (validateDetails(updatedProcessor)) {
+ // update the selected component
+ $.ajax({
+ type: 'PUT',
+ data: JSON.stringify(updatedProcessor),
+ url: processor.uri,
+ dataType: 'json',
+ processData: false,
+ contentType: 'application/json'
+ }).done(function (response) {
+ if (nf.Common.isDefinedAndNotNull(response.processor)) {
+ // update the revision
+ nf.Client.setRevision(response.revision);
+
+ // set the new processor state based on the response
+ nf.Processor.set(response.processor);
+
+ // reload the processor's outgoing connections
+ reloadProcessorConnections(processor);
+
+ // close the details panel
+ $('#processor-configuration').modal('hide');
+ }
+ }).fail(handleProcessorConfigurationError);
+ }
}
}
- }
- }, {
- buttonText: 'Cancel',
- handler: {
- click: function () {
- $('#processor-configuration').modal('hide');
- }
- }
- }];
-
- // determine if we should show the advanced button
- if (nf.Common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') {
- buttons.push({
- buttonText: 'Advanced',
- handler: {
- click: function () {
- var openCustomUi = function () {
- // reset state and close the dialog manually to avoid hiding the faded background
+ }, {
+ buttonText: 'Cancel',
+ handler: {
+ click: function () {
$('#processor-configuration').modal('hide');
-
- // show the custom ui
- nf.CustomProcessorUi.showCustomUi($('#processor-id').text(), processor.config.customUiUrl, true).done(function () {
- // once the custom ui is closed, reload the processor
- nf.Processor.reload(processor);
-
- // and reload the processor's outgoing connections
- reloadProcessorConnections(processor);
- });
- };
-
- // close all fields currently being edited
- $('#processor-properties').propertytable('saveRow');
-
- // determine if changes have been made
- if (isSaveRequired()) {
- // see if those changes should be saved
- nf.Dialog.showYesNoDialog({
- dialogContent: 'Save changes before opening the advanced configuration?',
- overlayBackground: false,
- noHandler: openCustomUi,
- yesHandler: function () {
- // marshal the settings and properties and update the processor
- var updatedProcessor = marshalDetails();
-
- // ensure details are valid as far as we can tell
- if (validateDetails(updatedProcessor)) {
- // update the selected component
- $.ajax({
- type: 'PUT',
- data: JSON.stringify(updatedProcessor),
- url: processor.uri,
- dataType: 'json',
- processData: false,
- contentType: 'application/json'
- }).done(function (response) {
- if (nf.Common.isDefinedAndNotNull(response.processor)) {
- // update the revision
- nf.Client.setRevision(response.revision);
-
- // open the custom ui
- openCustomUi();
- }
- }).fail(handleProcessorConfigurationError);
+ }
+ }
+ }];
+
+ // determine if we should show the advanced button
+ if (nf.Common.isDefinedAndNotNull(processor.config.customUiUrl) && processor.config.customUiUrl !== '') {
+ buttons.push({
+ buttonText: 'Advanced',
+ handler: {
+ click: function () {
+ var openCustomUi = function () {
+ // reset state and close the dialog manually to avoid hiding the faded background
+ $('#processor-configuration').modal('hide');
+
+ // show the custom ui
+ nf.CustomProcessorUi.showCustomUi($('#processor-id').text(), processor.config.customUiUrl, true).done(function () {
+ // once the custom ui is closed, reload the processor
+ nf.Processor.reload(processor);
+
+ // and reload the processor's outgoing connections
+ reloadProcessorConnections(processor);
+ });
+ };
+
+ // close all fields currently being edited
+ $('#processor-properties').propertytable('saveRow');
+
+ // determine if changes have been made
+ if (isSaveRequired()) {
+ // see if those changes should be saved
+ nf.Dialog.showYesNoDialog({
+ dialogContent: 'Save changes before opening the advanced configuration?',
+ overlayBackground: false,
+ noHandler: openCustomUi,
+ yesHandler: function () {
+ // marshal the settings and properties and update the processor
+ var updatedProcessor = marshalDetails();
+
+ // ensure details are valid as far as we can tell
+ if (validateDetails(updatedProcessor)) {
+ // update the selected component
+ $.ajax({
+ type: 'PUT',
+ data: JSON.stringify(updatedProcessor),
+ url: processor.uri,
+ dataType: 'json',
+ processData: false,
+ contentType: 'application/json'
+ }).done(function (response) {
+ if (nf.Common.isDefinedAndNotNull(response.processor)) {
+ // update the revision
+ nf.Client.setRevision(response.revision);
+
+ // open the custom ui
+ openCustomUi();
+ }
+ }).fail(handleProcessorConfigurationError);
+ }
}
- }
- });
- } else {
- // if there were no changes, simply open the custom ui
- openCustomUi();
+ });
+ } else {
+ // if there were no changes, simply open the custom ui
+ openCustomUi();
+ }
}
}
- }
- });
- }
-
- // set the button model
- $('#processor-configuration').modal('setButtonModel', buttons);
-
- // get the processor history
- $.ajax({
- type: 'GET',
- url: '../nifi-api/controller/history/processors/' + encodeURIComponent(processor.id),
- dataType: 'json'
- }).done(function (response) {
- var processorHistory = response.componentHistory;
+ });
+ }
+ // set the button model
+ $('#processor-configuration').modal('setButtonModel', buttons);
+
// load the property table
$('#processor-properties').propertytable('loadProperties', processor.config.properties, processor.config.descriptors, processorHistory.propertyHistory);