diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/editors/nf-editor/nf-editor.component.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/editors/nf-editor/nf-editor.component.ts index aff7a61265ca..a279e846fde1 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/editors/nf-editor/nf-editor.component.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/editors/nf-editor/nf-editor.component.ts @@ -163,7 +163,12 @@ export class NfEditor implements OnDestroy { mode: this.mode, lineNumbers: true, matchBrackets: true, - extraKeys: { 'Ctrl-Space': 'autocomplete' } + extraKeys: { + 'Ctrl-Space': 'autocomplete', + Enter: () => { + this.okClicked(); + } + } }; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/property-table.component.ts b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/property-table.component.ts index e5c0d02a8ebb..fc5b6a2de327 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/property-table.component.ts +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/ui/common/property-table/property-table.component.ts @@ -285,31 +285,61 @@ export class PropertyTable implements AfterViewInit, ControlValueAccessor { } newPropertyClicked(): void { - const existingProperties: string[] = this.dataSource.data.map((item) => item.descriptor.name); + // filter out deleted properties in case the user needs to re-add one + const existingProperties: string[] = this.dataSource.data + .filter((item) => !item.deleted) + .map((item) => item.descriptor.name); + + // create the new property this.createNewProperty(existingProperties, this.supportsSensitiveDynamicProperties) .pipe(take(1)) .subscribe((property) => { const currentPropertyItems: PropertyItem[] = this.dataSource.data; - const i: number = currentPropertyItems.length; - const item: PropertyItem = { - ...property, - id: i, - triggerEdit: true, - deleted: false, - added: true, - dirty: true, - type: property.descriptor.required - ? 'required' - : property.descriptor.dynamic - ? 'userDefined' - : 'optional' - }; - - this.itemLookup.set(property.property, item); - - const propertyItems: PropertyItem[] = [...currentPropertyItems, item]; - this.setPropertyItems(propertyItems); + const itemIndex: number = currentPropertyItems.findIndex( + (existingItem: PropertyItem) => existingItem.property == property.property + ); + if (itemIndex > -1) { + const currentItem: PropertyItem = currentPropertyItems[itemIndex]; + const updatedItem: PropertyItem = { + ...currentItem, + ...property, + triggerEdit: true, + deleted: false, + added: true, + dirty: true, + type: property.descriptor.required + ? 'required' + : property.descriptor.dynamic + ? 'userDefined' + : 'optional' + }; + + this.itemLookup.set(property.property, updatedItem); + + // if the user had previously deleted the property, replace the matching property item + currentPropertyItems[itemIndex] = updatedItem; + } else { + const i: number = currentPropertyItems.length; + const item: PropertyItem = { + ...property, + id: i, + triggerEdit: true, + deleted: false, + added: true, + dirty: true, + type: property.descriptor.required + ? 'required' + : property.descriptor.dynamic + ? 'userDefined' + : 'optional' + }; + + this.itemLookup.set(property.property, item); + + // if this is a new property, add it to the list + this.setPropertyItems([...currentPropertyItems, item]); + } this.handleChanged(); });