diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts index f0f2ea7696061..99e31051629c1 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts @@ -67,7 +67,7 @@ import { import { VerifyPropertiesRequestContext } from '../../../../state/property-verification'; import { BackNavigation } from '../../../../state/navigation'; import { NiFiCommon, Storage, SelectOption, ComponentType, LARGE_DIALOG, SMALL_DIALOG, XL_DIALOG } from '@nifi/shared'; -import { ComponentEntity } from './../flow/index'; +import { ComponentEntity } from '../flow'; @Injectable() export class ControllerServicesEffects { @@ -693,16 +693,17 @@ export class ControllerServicesEffects { ) ), tap((request) => { - const clone = Object.assign({}, request.request); - clone.processGroupEntity = request.processGroupEntity; - clone.childProcessGroupOptions = request.childProcessGroupOptions; - clone.parentControllerServices = request.controllerServices; - clone.breadcrumb = request.breadcrumb; - const serviceId: string = request.request.id; const moveDialogReference = this.dialog.open(MoveControllerService, { ...LARGE_DIALOG, - data: clone, - id: serviceId + data: { + id: request.request.id, + controllerService: request.request.controllerService, + childProcessGroupOptions: request.childProcessGroupOptions, + processGroupEntity: request.processGroupEntity, + parentControllerServices: request.controllerServices, + breadcrumb: request.breadcrumb + }, + id: request.request.id }); moveDialogReference.componentInstance.goToReferencingComponent = ( diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/index.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/index.ts index 5a1448a15b1bb..71bce1da67431 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/index.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/index.ts @@ -18,7 +18,7 @@ import { SelectOption } from '@nifi/shared'; import { ControllerServiceEntity, ParameterContextReferenceEntity } from '../../../../state/shared'; import { BreadcrumbEntity } from '../shared'; -import { Revision } from './../../../../state/shared/index'; +import { Revision } from '../../../../state/shared'; export const controllerServicesFeatureKey = 'controllerServiceListing'; @@ -57,10 +57,15 @@ export interface ConfigureControllerServiceSuccess { export interface MoveControllerServiceDialogRequest { id: string; controllerService: ControllerServiceEntity; +} + +export interface MoveControllerServiceDialogRequestSuccess { + id: string; + controllerService: ControllerServiceEntity; childProcessGroupOptions: SelectOption[]; - processGroupEntity?: any; + processGroupEntity: any; parentControllerServices: ControllerServiceEntity[]; - breadcrumb?: BreadcrumbEntity; + breadcrumb: BreadcrumbEntity; } export interface MoveControllerServiceRequest { diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/controller-service/controller-services.component.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/controller-service/controller-services.component.ts index 1a0f64a4c3970..0d10e1d0fa33a 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/controller-service/controller-services.component.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/controller-service/controller-services.component.ts @@ -245,9 +245,7 @@ export class ControllerServices implements OnDestroy { openMoveControllerServiceDialog({ request: { id: entity.id, - controllerService: entity, - parentControllerServices: [], - childProcessGroupOptions: [] + controllerService: entity } }) ); diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.spec.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.spec.ts index 1b8876c587db1..037e6fc1cc612 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.spec.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.spec.ts @@ -22,7 +22,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { provideMockStore } from '@ngrx/store/testing'; import { initialState } from '../../../../state/contoller-service-state/controller-service-state.reducer'; import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'; -import { MoveControllerServiceDialogRequest } from '../../state/controller-services'; +import { MoveControllerServiceDialogRequestSuccess } from '../../state/controller-services'; import { BreadcrumbEntity } from '../../state/shared'; import { ComponentType, SelectOption } from '@nifi/shared'; @@ -3430,7 +3430,7 @@ describe('MoveControllerService', () => { } }; - const data: MoveControllerServiceDialogRequest = { + const data: MoveControllerServiceDialogRequestSuccess = { id: '92db6ee4-018c-1000-1061-e3476c3f4e9f', breadcrumb: breadrumb, childProcessGroupOptions: chldren, diff --git a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.ts b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.ts index 70df3bc00972a..881b0b62cf2ed 100644 --- a/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.ts +++ b/nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/ui/move-controller-service/move-controller-service.component.ts @@ -38,7 +38,7 @@ import { Store } from '@ngrx/store'; import { CloseOnEscapeDialog } from '@nifi/shared'; import { moveControllerService } from '../../state/controller-services/controller-services.actions'; import { NiFiState } from 'apps/nifi/src/app/state'; -import { MoveControllerServiceDialogRequest } from '../../state/controller-services'; +import { MoveControllerServiceDialogRequestSuccess } from '../../state/controller-services'; import { NgIf } from '@angular/common'; import { BreadcrumbEntity } from '../../state/shared'; @@ -75,7 +75,7 @@ export class MoveControllerService extends CloseOnEscapeDialog { moveControllerServiceForm: FormGroup; constructor( - @Inject(MAT_DIALOG_DATA) public request: MoveControllerServiceDialogRequest, + @Inject(MAT_DIALOG_DATA) public request: MoveControllerServiceDialogRequestSuccess, private store: Store, private formBuilder: FormBuilder ) { @@ -93,9 +93,8 @@ export class MoveControllerService extends CloseOnEscapeDialog { ); const processGroups: SelectOption[] = []; - if (request.breadcrumb != undefined) { - this.loadParentOption(request.breadcrumb, parentControllerServices, processGroups); - } + this.loadParentOption(request.breadcrumb, parentControllerServices, processGroups); + this.loadChildOptions(request.childProcessGroupOptions, request.processGroupEntity, processGroups); this.controllerServiceActionProcessGroups = processGroups; @@ -186,7 +185,9 @@ export class MoveControllerService extends CloseOnEscapeDialog { return true; } else { for (const pg of processGroup.contents.processGroups) { - return this.processGroupContainsComponent(pg, groupId); + if (this.processGroupContainsComponent(pg, groupId)) { + return true; + } } return false; } @@ -195,13 +196,17 @@ export class MoveControllerService extends CloseOnEscapeDialog { } getProcessGroupById(root: any, processGroupId: string): any { + console.log('a'); if (root != undefined) { if (root.id == processGroupId) { return root; } else { if (root.contents != undefined) { for (const pg of root.contents.processGroups) { - return this.getProcessGroupById(pg, processGroupId); + const result = this.getProcessGroupById(pg, processGroupId); + if (result != null) { + return result; + } } } return null;