Repository: incubator-nifi Updated Branches: refs/heads/NIFI-250 1c96bd08f -> 3e7ca3838
NIFI-250: - Only prompting users for the property name and immediately adding to the table. In the background, the property descriptor is loaded from the processor and then used when editing the property. Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/d3bb3ab8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/d3bb3ab8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/d3bb3ab8 Branch: refs/heads/NIFI-250 Commit: d3bb3ab829bbeaa93453509e33a7b3f165365987 Parents: 1c96bd0 Author: Matt Gilman <[email protected]> Authored: Mon Mar 23 11:34:18 2015 -0400 Committer: Matt Gilman <[email protected]> Committed: Mon Mar 23 11:34:18 2015 -0400 ---------------------------------------------------------------------- .../propertytable/jquery.propertytable.css | 7 +- .../propertytable/jquery.propertytable.js | 78 ++++++++------------ .../js/nf/canvas/nf-controller-service.js | 23 +++++- .../js/nf/canvas/nf-processor-configuration.js | 13 +++- .../webapp/js/nf/canvas/nf-reporting-task.js | 23 +++++- 5 files changed, 86 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/d3bb3ab8/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.css ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.css b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.css index 19a1a55..74b6f4c 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.css +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.css @@ -77,10 +77,8 @@ div.new-property-dialog { border: 3px solid #365C6A; box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.9); cursor: move; -} - -div.new-property-dialog .nfel-editor { - margin-bottom: 35px; + width: 300px; + height: 72px; } div.new-property-name-container { @@ -90,7 +88,6 @@ div.new-property-name-container { right: 10px; padding-right: 10px; overflow: hidden; - margin-bottom: 10px; } input.new-property-name { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/d3bb3ab8/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js ---------------------------------------------------------------------- diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js index 89bbffd..1c25460 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js @@ -1076,34 +1076,42 @@ // optionally add a add new property button if (options.readOnly !== true && nf.Common.isDefinedAndNotNull(options.newPropertyDialogContainer)) { // build the new property dialog - var newPropertyDialogMarkup = '<div class="new-property-dialog dialog">' + - '<div>' + - '<div class="setting-name">Property name</div>' + - '<div class="setting-field new-property-name-container">' + - '<input class="new-property-name" type="text"/>' + - '</div>' + - '<div class="setting-name" style="margin-top: 36px;">Property value</div>' + - '<div class="setting-field">' + - '<div class="new-property-value"></div>' + - '</div>' + - '</div>' + - '<div class="new-property-button-container">' + - '<div class="new-property-ok button button-normal">Ok</div>' + - '<div class="new-property-cancel button button-normal">Cancel</div>' + - '<div class="clear"></div>' + - '</div>' + + var newPropertyDialogMarkup = + '<div class="new-property-dialog dialog">' + + '<div>' + + '<div class="setting-name">Property name</div>' + + '<div class="setting-field new-property-name-container">' + + '<input class="new-property-name" type="text"/>' + + '</div>' + + '</div>' + + '<div class="new-property-button-container">' + + '<div class="new-property-ok button button-normal">Ok</div>' + + '<div class="new-property-cancel button button-normal">Cancel</div>' + + '<div class="clear"></div>' + + '</div>' + '</div>'; var newPropertyDialog = $(newPropertyDialogMarkup).appendTo(options.newPropertyDialogContainer); var newPropertyNameField = newPropertyDialog.find('input.new-property-name'); - var newPropertyValueField = newPropertyDialog.find('div.new-property-value'); var add = function () { var propertyName = $.trim(newPropertyNameField.val()); - var propertyValue = newPropertyValueField.nfeditor('getValue'); // ensure the property name and value is specified if (propertyName !== '') { + // load the property descriptor if possible + if (typeof options.descriptorDeferred === 'function') { + options.descriptorDeferred(propertyName).done(function(response) { + var descriptor = response.propertyDescriptor; + + // store the descriptor for use later + var descriptors = table.data('descriptors'); + if (!nf.Common.isUndefined(descriptors)) { + descriptors[descriptor.name] = descriptor; + } + }); + } + // add a row for the new property var propertyGrid = table.data('gridInstance'); var propertyData = propertyGrid.getData(); @@ -1113,7 +1121,7 @@ property: propertyName, displayName: propertyName, previousValue: null, - value: propertyValue, + value: null, type: 'userDefined' }); } else { @@ -1131,35 +1139,12 @@ newPropertyDialog.hide(); }; - // create the editor - newPropertyValueField.addClass(editorClass).nfeditor({ - languageId: languageId, - width: 318, - minWidth: 318, - height: 106, - minHeight: 106, - resizable: true, - escape: cancel, - enter: add - }); - // make the new property dialog draggable newPropertyDialog.draggable({ cancel: 'input, textarea, pre, .button, .' + editorClass, containment: 'body' }).on('click', 'div.new-property-ok', add).on('click', 'div.new-property-cancel', cancel); - // enable tabs in the property value - newPropertyNameField.on('keydown', function (e) { - if (e.which === $.ui.keyCode.ENTER && !e.shiftKey) { - add(); - } else if (e.which === $.ui.keyCode.ESCAPE) { - e.stopPropagation(); - e.preventDefault(); - cancel(); - } - }); - // build the control to open the new property dialog var addProperty = $('<div class="add-property"></div>').appendTo(header); $('<div class="add-property-icon add-icon-bg"></div>').on('click', function () { @@ -1168,16 +1153,11 @@ // clear the dialog newPropertyNameField.val(''); - newPropertyValueField.nfeditor('setValue', ''); - - // reset the add property dialog position/size - newPropertyValueField.nfeditor('setSize', 318, 106); // open the new property dialog newPropertyDialog.center().show(); - // give the property name focus - newPropertyValueField.nfeditor('refresh'); + // set the initial focus newPropertyNameField.focus(); }).on('mouseenter', function () { $(this).removeClass('add-icon-bg').addClass('add-icon-bg-hover'); @@ -1312,8 +1292,10 @@ var propertyData = propertyGrid.getData(); $.each(propertyData.getItems(), function () { if (this.hidden === true) { + // hidden properties were removed by the user, clear the value properties[this.property] = null; } else if (this.value !== this.previousValue) { + // the value has changed properties[this.property] = this.value; } }); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/d3bb3ab8/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-controller-service.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.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.js index 701eb17..e949987 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.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.js @@ -1006,6 +1006,23 @@ nf.ControllerService = (function () { }); }; + /** + * Gets a property descriptor for the controller service currently being configured. + * + * @param {type} propertyName + */ + var getControllerServicePropertyDescriptor = function (propertyName) { + var details = $('#controller-service-configuration').data('controllerServiceDetails'); + return $.ajax({ + type: 'GET', + url: details.uri + '/descriptors', + data: { + propertyName: propertyName + }, + dataType: 'json' + }).fail(nf.Common.handleAjaxError); + }; + return { /** * Initializes the controller service configuration dialog. @@ -1074,7 +1091,8 @@ nf.ControllerService = (function () { // initialize the property table $('#controller-service-properties').propertytable({ readOnly: false, - newPropertyDialogContainer: '#new-controller-service-property-container' + newPropertyDialogContainer: '#new-controller-service-property-container', + descriptorDeferred: getControllerServicePropertyDescriptor }); // initialize the disable service dialog @@ -1217,7 +1235,8 @@ nf.ControllerService = (function () { // initialize the property table $('#controller-service-properties').propertytable('destroy').propertytable({ readOnly: false, - newPropertyDialogContainer: '#new-controller-service-property-container' + newPropertyDialogContainer: '#new-controller-service-property-container', + descriptorDeferred: getControllerServicePropertyDescriptor }); // update the mode http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/d3bb3ab8/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 62b3918..9045829 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 @@ -467,7 +467,18 @@ nf.ProcessorConfiguration = (function () { // initialize the property table $('#processor-properties').propertytable({ readOnly: false, - newPropertyDialogContainer: '#new-processor-property-container' + newPropertyDialogContainer: '#new-processor-property-container', + descriptorDeferred: function(propertyName) { + var processor = $('#processor-configuration').data('processorDetails'); + return $.ajax({ + type: 'GET', + url: processor.uri + '/descriptors', + data: { + propertyName: propertyName + }, + dataType: 'json' + }).fail(nf.Common.handleAjaxError); + } }); }, http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/d3bb3ab8/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.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-reporting-task.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js index f07e730..9719578 100644 --- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js +++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-reporting-task.js @@ -216,6 +216,23 @@ nf.ReportingTask = (function () { }).fail(nf.Common.handleAjaxError); }; + /** + * Gets a property descriptor for the controller service currently being configured. + * + * @param {type} propertyName + */ + var getReportingTaskPropertyDescriptor = function (propertyName) { + var details = $('#reporting-task-configuration').data('reportingTaskDetails'); + return $.ajax({ + type: 'GET', + url: details.uri + '/descriptors', + data: { + propertyName: propertyName + }, + dataType: 'json' + }).fail(nf.Common.handleAjaxError); + }; + return { /** * Initializes the reporting task configuration dialog. @@ -272,7 +289,8 @@ nf.ReportingTask = (function () { // initialize the property table $('#reporting-task-properties').propertytable({ readOnly: false, - newPropertyDialogContainer: '#new-reporting-task-property-container' + newPropertyDialogContainer: '#new-reporting-task-property-container', + deferredDescriptor: getReportingTaskPropertyDescriptor }); }, @@ -291,7 +309,8 @@ nf.ReportingTask = (function () { // initialize the property table $('#reporting-task-properties').propertytable('destroy').propertytable({ readOnly: false, - newPropertyDialogContainer: '#new-reporting-task-property-container' + newPropertyDialogContainer: '#new-reporting-task-property-container', + deferredDescriptor: getReportingTaskPropertyDescriptor }); // update the mode
