Skip to content

Commit 837ae1d

Browse files
committed
NIFI-14489 Allow for custom named Process Groups when importing flows from registry
Signed-off-by: Maciej Bukalo <[email protected]>
1 parent 411e179 commit 837ae1d

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ProcessGroupResource.java

+5
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,11 @@ public Response createProcessGroup(
10471047
// If there are any Parameter Providers referenced by Parameter Contexts, resolve these to point to the appropriate Parameter Provider, if we are able to.
10481048
unresolvedParameterProviders.addAll(serviceFacade.resolveParameterProviders(flowSnapshot, NiFiUserUtils.getNiFiUser()));
10491049

1050+
// If Process Group name was provided in the request, prioritize it over the name from version control
1051+
if (requestProcessGroupEntity.getComponent().getName() != null) {
1052+
flowSnapshot.getFlowContents().setName(requestProcessGroupEntity.getComponent().getName());
1053+
}
1054+
10501055
// Step 6: Update contents of the ProcessGroupDTO passed in to include the components that need to be added.
10511056
requestProcessGroupEntity.setVersionedFlowSnapshot(flowSnapshot);
10521057
}

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/flow/import-from-registry/import-from-registry.component.html

+7
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ <h2 mat-dialog-title>Import From Registry</h2>
102102
>No flows available</mat-error
103103
>
104104
</mat-form-field>
105+
<div class="mb-5">
106+
<mat-form-field>
107+
<mat-label>Custom Versioned Flow Name</mat-label>
108+
<input matInput formControlName="customFlowName" type="text" />
109+
<mat-hint>Name of the created Process Group. If none provided, then the name is taken from versioned flow.</mat-hint>
110+
</mat-form-field>
111+
</div>
105112
<div class="mb-5">
106113
<mat-checkbox formControlName="keepParameterContexts">
107114
Keep existing Parameter Contexts

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/canvas/items/flow/import-from-registry/import-from-registry.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { selectSaving } from '../../../../../state/flow/flow.selectors';
3333
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
3434
import { MatButtonModule } from '@angular/material/button';
3535
import { MatFormFieldModule } from '@angular/material/form-field';
36-
import { MatInputModule } from '@angular/material/input';
36+
import { MatHint, MatInputModule } from '@angular/material/input';
3737
import { MatOptionModule } from '@angular/material/core';
3838
import { MatSelectModule } from '@angular/material/select';
3939
import { NifiSpinnerDirective } from '../../../../../../../ui/common/spinner/nifi-spinner.directive';
@@ -67,6 +67,7 @@ import { ContextErrorBanner } from '../../../../../../../ui/common/context-error
6767
MatDialogModule,
6868
MatFormFieldModule,
6969
MatInputModule,
70+
MatHint,
7071
NgIf,
7172
NifiSpinnerDirective,
7273
ReactiveFormsModule,
@@ -159,6 +160,7 @@ export class ImportFromRegistry extends CloseOnEscapeDialog implements OnInit {
159160

160161
const initialRegistry = this.registryClientOptions.length > 0 ? this.registryClientOptions[0].value : null;
161162
this.importFromRegistryForm = this.formBuilder.group({
163+
customFlowName: new FormControl(null),
162164
registry: new FormControl(initialRegistry, Validators.required),
163165
branch: new FormControl(null),
164166
bucket: new FormControl(null, Validators.required),
@@ -397,6 +399,7 @@ export class ImportFromRegistry extends CloseOnEscapeDialog implements OnInit {
397399
}),
398400
disconnectedNodeAcknowledged: this.clusterConnectionService.isDisconnectionAcknowledged(),
399401
component: {
402+
name: this.importFromRegistryForm.get('customFlowName')?.value,
400403
position: {
401404
x: this.dialogRequest.request.position.x,
402405
y: this.dialogRequest.request.position.y

0 commit comments

Comments
 (0)