rfellows commented on code in PR #11798:
URL: https://github.com/apache/nifi/pull/11798#discussion_r4251382984


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/flow-shared/index.ts:
##########
@@ -231,3 +238,306 @@ export interface SnippetDeleteRequest {
     id: string;
     options: SnippetDeleteOptions;
 }
+
+/*
+ * Requests shared by the flow designer and the reusable component dialogs.
+ */
+
+export interface SelectedComponent {
+    id: string;
+    componentType: ComponentType;
+    entity?: any;
+}
+
+export interface CreateComponentRequest {
+    type: ComponentType;
+    position: Position;
+    revision: any;
+}
+
+export interface CreateLabelRequest extends CreateComponentRequest {
+    zIndex: number;
+}
+
+export interface CreateConnectionRequest {
+    source: SelectedComponent;
+    destination: SelectedComponent;
+    bends?: Position[];
+}
+
+export interface CreateConnectionDialogRequest {
+    request: CreateConnectionRequest;
+    defaults: {
+        flowfileExpiration: string;
+        objectThreshold: number;
+        dataSizeThreshold: string;
+    };
+}
+
+export interface CreateConnection {
+    payload: any;
+}
+
+export interface CreateProcessGroupDialogRequest {
+    request: CreateComponentRequest;
+    currentParameterContextId?: string;
+    parameterContexts: ParameterContextEntity[];
+}
+
+export interface NoRegistryClientsDialogRequest {
+    controllerPermissions: Permissions;
+}
+
+export interface ImportFromRegistryDialogRequest {
+    request: CreateComponentRequest;
+    registryClients: RegistryClientEntity[];
+}
+
+export interface ImportFromRegistryRequest {
+    payload: any;
+    keepExistingParameterContext: boolean;
+}
+
+export interface SaveToVersionControlRequest {
+    processGroupId: string;
+    versionedFlow: SparseVersionedFlow;
+    processGroupRevision: Revision;
+}
+
+export interface StopVersionControlRequest {
+    revision: Revision;
+    processGroupId: string;
+}
+
+export interface VersionControlInformationEntity {
+    processGroupRevision: Revision;
+    versionControlInformation?: VersionControlInformation;
+    disconnectedNodeAcknowledged?: boolean;
+}
+
+export interface OpenGroupComponentsDialogRequest {
+    position: Position;
+    moveComponents: MoveComponentRequest[];
+}
+
+export interface GroupComponentsDialogRequest {
+    request: OpenGroupComponentsDialogRequest;
+    currentParameterContextId?: string;
+    parameterContexts: ParameterContextEntity[];
+}
+
+export interface GroupComponentsRequest extends CreateProcessGroupRequest {
+    components: MoveComponentRequest[];
+}
+
+export interface GroupComponentsSuccess extends CreateComponentResponse {
+    components: MoveComponentRequest[];
+}
+
+export interface CreateProcessorDialogRequest {
+    request: CreateComponentRequest;
+}
+
+export interface GoToRemoteProcessGroupRequest {
+    uri: string;
+}
+
+export interface CreateProcessorRequest extends CreateComponentRequest {
+    processorType: string;
+    processorBundle: Bundle;
+}
+
+export interface CreateProcessGroupRequest extends CreateComponentRequest {
+    name: string;
+    parameterContextId: string;

Review Comment:
   Both Create Process Group and Group Components intentionally emit `null` for 
the valid “no parameter context” state and when `supportsParameters` is false, 
but this contract excludes `null`. Please change this to `string | null` and 
type the corresponding form controls accordingly so the reusable output 
accurately represents every valid intent.



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/flow-shared/index.ts:
##########
@@ -231,3 +238,306 @@ export interface SnippetDeleteRequest {
     id: string;
     options: SnippetDeleteOptions;
 }
+
+/*
+ * Requests shared by the flow designer and the reusable component dialogs.
+ */
+
+export interface SelectedComponent {
+    id: string;
+    componentType: ComponentType;
+    entity?: any;
+}
+
+export interface CreateComponentRequest {
+    type: ComponentType;
+    position: Position;
+    revision: any;

Review Comment:
   Please replace the permissive types in the promoted dialog boundary with 
canonical request/entity types before merging. At minimum, `revision` should 
use `CreateRevisionRequest`, `SnippetComponentRequest.entity` should use 
`CanvasComponentEntity`, and the connection/import payloads should use 
DTO-derived create-request shapes. These are now reusable typed outputs; 
retaining `any` allows malformed requests to compile and does not meet 
NIFI-16449's canonical request-contract requirement.



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/component-dialogs/create-port/create-port.component.ts:
##########
@@ -83,38 +79,24 @@ export class CreatePort extends CloseOnEscapeDialog {
 
     constructor() {
         super();
-        // set the port type name
         if (ComponentType.InputPort == this.request.type) {
             this.portTypeLabel = 'Input Port';
         } else {
             this.portTypeLabel = 'Output Port';
         }
 
-        // build the form
         this.createPortForm = this.formBuilder.group({
             newPortName: new FormControl('', Validators.required),
             newPortAllowRemoteAccess: new 
FormControl(this.allowRemoteAccessOptions[0].value, Validators.required)
         });
-
-        // listen for changes to the parent process group id
-        this.store
-            .select(selectParentProcessGroupId)
-            .pipe(takeUntilDestroyed())
-            .subscribe((parentProcessGroupId) => {
-                this.isRootProcessGroup = parentProcessGroupId == null;
-            });
     }
 
-    createPort() {
-        this.store.dispatch(
-            createPort({
-                request: {
-                    ...this.request,
-                    name: this.createPortForm.get('newPortName')?.value,
-                    allowRemoteAccess: 
this.createPortForm.get('newPortAllowRemoteAccess')?.value
-                }
-            })
-        );
+    submitCreatePort() {
+        this.createPort.emit({
+            ...this.request,
+            name: this.createPortForm.get('newPortName')?.value,
+            allowRemoteAccess: 
this.createPortForm.get('newPortAllowRemoteAccess')?.value

Review Comment:
   `allowRemoteAccessOptions` stores `'true'` / `'false'` strings, so this 
emits a string even though `CreatePortRequest` and the API DTO require a 
boolean. The service forwards the value unchanged, and both strings are truthy 
in JavaScript. Please make the option/control values boolean (or explicitly 
convert here) and update the test to assert boolean `true` / `false`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to