Freedom9339 commented on code in PR #8965:
URL: https://github.com/apache/nifi/pull/8965#discussion_r1653304179
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts:
##########
@@ -635,6 +636,82 @@ export class ControllerServicesEffects {
{ dispatch: false }
);
+ openMoveControllerServiceDialog$ = createEffect(
+ () =>
+ this.actions$.pipe(
+
ofType(ControllerServicesActions.openMoveControllerServiceDialog),
+ map((action) => action.request),
+ concatLatestFrom(() =>
this.store.select(selectCurrentProcessGroupId)),
+ tap(([request, currentProcessGroupId]) => {
+ const serviceId: string = request.id;
+ request.processGroupFlow =
this.flowService.getFlow(currentProcessGroupId);
+ const moveDialogReference =
this.dialog.open(MoveControllerService, {
+ ...XL_DIALOG,
Review Comment:
Changed this to a LARGE_DIALOG.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts:
##########
@@ -635,6 +636,82 @@ export class ControllerServicesEffects {
{ dispatch: false }
);
+ openMoveControllerServiceDialog$ = createEffect(
+ () =>
+ this.actions$.pipe(
+
ofType(ControllerServicesActions.openMoveControllerServiceDialog),
+ map((action) => action.request),
+ concatLatestFrom(() =>
this.store.select(selectCurrentProcessGroupId)),
+ tap(([request, currentProcessGroupId]) => {
+ const serviceId: string = request.id;
+ request.processGroupFlow =
this.flowService.getFlow(currentProcessGroupId);
+ const moveDialogReference =
this.dialog.open(MoveControllerService, {
+ ...XL_DIALOG,
+ data: request,
+ id: serviceId
+ });
+
+
moveDialogReference.componentInstance.goToReferencingComponent = (
+ component: ControllerServiceReferencingComponent
+ ) => {
+ const route: string[] =
this.getRouteForReference(component);
+ this.router.navigate(route);
+ };
+
+ moveDialogReference.afterClosed().subscribe((response) => {
+ if (response != 'ROUTED') {
+ this.store.dispatch(
+
ControllerServicesActions.loadControllerServices({
+ request: {
+ processGroupId: currentProcessGroupId
+ }
+ })
+ );
+ }
+ });
+ })
+ ),
+ { dispatch: false }
+ );
+
+ moveControllerService$ = createEffect(() =>
+ this.actions$.pipe(
+ ofType(ControllerServicesActions.moveControllerService),
+ map((action) => action.request),
+ switchMap((request) =>
+
from(this.controllerServiceService.moveControllerService(request)).pipe(
+ map((response) =>
+
ControllerServicesActions.moveControllerServiceSuccess({
+ response: {
+ controllerService: response
+ }
+ })
+ ),
+ catchError((errorResponse: HttpErrorResponse) =>
+ of(ErrorActions.snackBarError({ error:
this.errorHelper.getErrorString(errorResponse) }))
+ )
+ )
+ )
+ )
+ );
+
+ moveControllerServiceSuccess$ = createEffect( () =>
+ this.actions$.pipe(
+ ofType(ControllerServicesActions.moveControllerServiceSuccess),
+ map((action) => action.response),
+ tap((request) => {
+ this.dialog.closeAll();
+ this.router.navigate([
+ '/process-groups',
+ request.controllerService.parentGroupId,
+ 'controller-services',
+ request.controllerService.id
+ ]);
Review Comment:
Removed post navigation.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.reducer.ts:
##########
@@ -99,6 +100,15 @@ export const controllerServicesReducer = createReducer(
draftState.saving = false;
});
}),
+ on(moveControllerServiceSuccess, (state, { response }) => {
+ return produce(state, (draftState) => {
+ const componentIndex: number =
draftState.controllerServices.findIndex((f: any) =>
response.controllerService.id === f.id);
+ if (componentIndex > -1) {
+ draftState.controllerServices[componentIndex] =
response.controllerService;
+ }
+ draftState.saving = false;
+ });
+ }),
Review Comment:
Changed the reducer to remove the controller service.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/controller-service-table/controller-service-table.component.html:
##########
@@ -173,6 +173,12 @@
Manage Access Policies
</button>
}
+ @if (canConfigure(item)) {
+ <button mat-menu-item
(click)="moveClicked(item)">
+ <i class="fa fa-arrows primary-color
mr-2"></i>
+ Move
+ </button>
+ }
Review Comment:
Made the move option not show up in management controller services.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.html:
##########
@@ -0,0 +1,82 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<h2 mat-dialog-title>Move Controller Service</h2>
+@if ((controllerService$ | async)!; as controllerService) {
+<form class="controller-service-enable-form"
[formGroup]="moveControllerServiceForm">
+ <mat-dialog-content>
+ <div class="py-4 flex gap-x-4">
+ <div class="flex basis-2/3 flex-col gap-y-4 pr-4 overflow-hidden">
+ <div class="flex flex-col">
+ <div>Service</div>
+ <div
+ class="accent-color font-medium overflow-ellipsis
overflow-hidden whitespace-nowrap"
+ [title]="controllerService.component.name">
+ {{ controllerService.component.name }}
+ </div>
+ </div>
+ <div>
+ <mat-form-field>
+ <mat-label>Process Group:</mat-label>
+ <mat-select formControlName="processGroups" >
+ @for (option of
controllerServiceActionProcessGroups; track option) {
+ <mat-option
+ [value]="option.value">
+ {{ option.text }}
+ </mat-option>
+ }
+ </mat-select>
+ </mat-form-field>
+ </div>
+ </div>
+ <div class="flex basis-1/3 flex-col">
+ <div>
+ Referencing Components
+ <i
+ class="fa fa-info-circle"
+ nifiTooltip
+ [tooltipComponentType]="TextTip"
+ tooltipInputData="Other components referencing this
controller service."></i>
+ </div>
+ <div class="relative h-full border" style="min-height: 320px">
+ <div class="absolute inset-0 overflow-y-auto p-1">
+ <controller-service-references
+
[serviceReferences]="controllerService.component.referencingComponents"
+ [goToReferencingComponent]="
+ goToReferencingComponent
+ "></controller-service-references>
+ </div>
+ </div>
+ </div>
+ </div>
+ </mat-dialog-content>
+ <mat-dialog-actions align="end">
+ <button mat-button mat-dialog-close>Cancel</button>
+ <button type="button" color="primary" (click)="submitForm()"
mat-button>Move</button>
+ </mat-dialog-actions>
+</form>
+}
+<ng-template #stepInProgress>
+ <div class="fa fa-spin fa-circle-o-notch primary-color"></div>
+</ng-template>
+<ng-template #stepComplete>
+ <div class="complete fa fa-check success-color"></div>
+</ng-template>
+<ng-template #stepError>
+ <div class="fa fa-times warn-color"></div>
+</ng-template>
+<ng-template #stepNotStarted><div class="w-3.5"></div></ng-template>
Review Comment:
Removed these.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
+
+ moveControllerServiceForm: FormGroup;
+
+ @ViewChild('stepComplete') stepComplete!: TemplateRef<any>;
+ @ViewChild('stepError') stepError!: TemplateRef<any>;
+ @ViewChild('stepInProgress') stepInProgress!: TemplateRef<any>;
+ @ViewChild('stepNotStarted') stepNotStarted!: TemplateRef<any>;
Review Comment:
Removed these.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
Review Comment:
Moved the move component to flow-designer.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
Review Comment:
Changed the store to NiFiState.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
+
+ moveControllerServiceForm: FormGroup;
+
+ @ViewChild('stepComplete') stepComplete!: TemplateRef<any>;
+ @ViewChild('stepError') stepError!: TemplateRef<any>;
+ @ViewChild('stepInProgress') stepInProgress!: TemplateRef<any>;
+ @ViewChild('stepNotStarted') stepNotStarted!: TemplateRef<any>;
+
+ constructor(
+ @Inject(MAT_DIALOG_DATA) public request:
MoveControllerServiceDialogRequest,
+ private store: Store<ControllerServiceState>,
+ private formBuilder: FormBuilder
+ ) {
+ super();
+
+ request.processGroupFlow.subscribe((flow:any) => {
+ let processGroups: SelectOption[] = [];
+ let processGroupflow = flow.processGroupFlow;
+ if
(processGroupflow.breadcrumb.hasOwnProperty('parentBreadcrumb')) {
+ let parentBreadcrumb =
processGroupflow.breadcrumb.parentBreadcrumb;
+ if (parentBreadcrumb.permissions.canRead &&
parentBreadcrumb.permissions.canWrite) {
+ let option: SelectOption = {
+ text: parentBreadcrumb.breadcrumb.name + ' (Parent)',
+ value: parentBreadcrumb.breadcrumb.id
+ }
+ processGroups.push(option);
+ }
+ }
+
+ processGroupflow.flow.processGroups.forEach((child:any) => {
+ if (child.permissions.canRead && child.permissions.canWrite) {
+ let option: SelectOption = {
+ text: child.component.name,
+ value: child.component.id
+ }
+ processGroups.push(option);
+ }
+ });
+
+ this.controllerServiceActionProcessGroups = processGroups;
+ if (processGroups.length > 0) {
+
this.moveControllerServiceForm.controls['processGroups'].setValue(processGroups[0].value);
+ }
+ });
+
+ // build the form
+ this.moveControllerServiceForm = this.formBuilder.group({
+ processGroups: new FormControl("Process Group",
Validators.required)
+ });
+
+ this.store.dispatch(
+ setControllerService({
+ request: {
+ controllerService: request.controllerService
+ }
+ })
+ );
+
+ }
+
+ submitForm() {
+ this.store.dispatch(
+ moveControllerService({
+ request: {
+ controllerService: this.request.controllerService,
+ data: {
+ parentGroupId:
this.moveControllerServiceForm.get('processGroups')?.value,
+ revision: this.request.controllerService.revision
+ }
+ }
+ })
+ );
+
+ }
+
+ cancelClicked(): void {
+ this.store.dispatch(stopPollingControllerService());
+ }
Review Comment:
Removed this.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
+
+ moveControllerServiceForm: FormGroup;
+
+ @ViewChild('stepComplete') stepComplete!: TemplateRef<any>;
+ @ViewChild('stepError') stepError!: TemplateRef<any>;
+ @ViewChild('stepInProgress') stepInProgress!: TemplateRef<any>;
+ @ViewChild('stepNotStarted') stepNotStarted!: TemplateRef<any>;
+
+ constructor(
+ @Inject(MAT_DIALOG_DATA) public request:
MoveControllerServiceDialogRequest,
+ private store: Store<ControllerServiceState>,
+ private formBuilder: FormBuilder
+ ) {
+ super();
+
+ request.processGroupFlow.subscribe((flow:any) => {
+ let processGroups: SelectOption[] = [];
+ let processGroupflow = flow.processGroupFlow;
+ if
(processGroupflow.breadcrumb.hasOwnProperty('parentBreadcrumb')) {
+ let parentBreadcrumb =
processGroupflow.breadcrumb.parentBreadcrumb;
+ if (parentBreadcrumb.permissions.canRead &&
parentBreadcrumb.permissions.canWrite) {
+ let option: SelectOption = {
+ text: parentBreadcrumb.breadcrumb.name + ' (Parent)',
+ value: parentBreadcrumb.breadcrumb.id
+ }
+ processGroups.push(option);
+ }
+ }
+
+ processGroupflow.flow.processGroups.forEach((child:any) => {
+ if (child.permissions.canRead && child.permissions.canWrite) {
+ let option: SelectOption = {
+ text: child.component.name,
+ value: child.component.id
+ }
+ processGroups.push(option);
+ }
+ });
Review Comment:
I've implemented this change. The dropdown menu will still list all parent
and child process groups, but any process group with a conflict will not be
disabled with an ! icon and a hover tooltip explaining the conflict.
I will note this does require the use of 2 api calls. I also had to add an
optional parameter to an api definition.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
+
+ moveControllerServiceForm: FormGroup;
+
+ @ViewChild('stepComplete') stepComplete!: TemplateRef<any>;
+ @ViewChild('stepError') stepError!: TemplateRef<any>;
+ @ViewChild('stepInProgress') stepInProgress!: TemplateRef<any>;
+ @ViewChild('stepNotStarted') stepNotStarted!: TemplateRef<any>;
+
+ constructor(
+ @Inject(MAT_DIALOG_DATA) public request:
MoveControllerServiceDialogRequest,
+ private store: Store<ControllerServiceState>,
+ private formBuilder: FormBuilder
+ ) {
+ super();
+
+ request.processGroupFlow.subscribe((flow:any) => {
+ let processGroups: SelectOption[] = [];
+ let processGroupflow = flow.processGroupFlow;
+ if
(processGroupflow.breadcrumb.hasOwnProperty('parentBreadcrumb')) {
+ let parentBreadcrumb =
processGroupflow.breadcrumb.parentBreadcrumb;
+ if (parentBreadcrumb.permissions.canRead &&
parentBreadcrumb.permissions.canWrite) {
+ let option: SelectOption = {
+ text: parentBreadcrumb.breadcrumb.name + ' (Parent)',
+ value: parentBreadcrumb.breadcrumb.id
+ }
+ processGroups.push(option);
+ }
+ }
+
+ processGroupflow.flow.processGroups.forEach((child:any) => {
+ if (child.permissions.canRead && child.permissions.canWrite) {
+ let option: SelectOption = {
+ text: child.component.name,
+ value: child.component.id
+ }
+ processGroups.push(option);
+ }
+ });
Review Comment:
I've implemented this change. The dropdown menu will still list all parent
and child process groups, but any process group with a conflict will now be
disabled with a [ ! ] icon and a hover tool tip explaining the conflict.
I will note this does require the use of 2 api calls. I also had to add an
optional parameter to an api definition.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
+
+ moveControllerServiceForm: FormGroup;
+
+ @ViewChild('stepComplete') stepComplete!: TemplateRef<any>;
+ @ViewChild('stepError') stepError!: TemplateRef<any>;
+ @ViewChild('stepInProgress') stepInProgress!: TemplateRef<any>;
+ @ViewChild('stepNotStarted') stepNotStarted!: TemplateRef<any>;
+
+ constructor(
+ @Inject(MAT_DIALOG_DATA) public request:
MoveControllerServiceDialogRequest,
+ private store: Store<ControllerServiceState>,
+ private formBuilder: FormBuilder
+ ) {
+ super();
+
+ request.processGroupFlow.subscribe((flow:any) => {
+ let processGroups: SelectOption[] = [];
+ let processGroupflow = flow.processGroupFlow;
+ if
(processGroupflow.breadcrumb.hasOwnProperty('parentBreadcrumb')) {
+ let parentBreadcrumb =
processGroupflow.breadcrumb.parentBreadcrumb;
+ if (parentBreadcrumb.permissions.canRead &&
parentBreadcrumb.permissions.canWrite) {
+ let option: SelectOption = {
+ text: parentBreadcrumb.breadcrumb.name + ' (Parent)',
+ value: parentBreadcrumb.breadcrumb.id
+ }
+ processGroups.push(option);
+ }
+ }
+
+ processGroupflow.flow.processGroups.forEach((child:any) => {
+ if (child.permissions.canRead && child.permissions.canWrite) {
+ let option: SelectOption = {
+ text: child.component.name,
+ value: child.component.id
+ }
+ processGroups.push(option);
+ }
+ });
+
+ this.controllerServiceActionProcessGroups = processGroups;
+ if (processGroups.length > 0) {
+
this.moveControllerServiceForm.controls['processGroups'].setValue(processGroups[0].value);
+ }
+ });
+
+ // build the form
+ this.moveControllerServiceForm = this.formBuilder.group({
+ processGroups: new FormControl("Process Group",
Validators.required)
+ });
+
+ this.store.dispatch(
+ setControllerService({
+ request: {
+ controllerService: request.controllerService
+ }
+ })
+ );
Review Comment:
Removed this.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
Review Comment:
Removed this.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
+
+ moveControllerServiceForm: FormGroup;
+
+ @ViewChild('stepComplete') stepComplete!: TemplateRef<any>;
+ @ViewChild('stepError') stepError!: TemplateRef<any>;
+ @ViewChild('stepInProgress') stepInProgress!: TemplateRef<any>;
+ @ViewChild('stepNotStarted') stepNotStarted!: TemplateRef<any>;
+
+ constructor(
+ @Inject(MAT_DIALOG_DATA) public request:
MoveControllerServiceDialogRequest,
+ private store: Store<ControllerServiceState>,
Review Comment:
Made this change. Now using NiFiState store.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.ts:
##########
@@ -0,0 +1,158 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Component, Inject, Input, TemplateRef, ViewChild } from
'@angular/core';
+import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
+import { FormBuilder, FormControl, FormGroup, ReactiveFormsModule, Validators
} from '@angular/forms';
+import {
+ ControllerServiceReferencingComponent,
+ MoveControllerServiceDialogRequest,
+} from '../../../../state/shared';
+import { MatInputModule } from '@angular/material/input';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatButtonModule } from '@angular/material/button';
+import { AsyncPipe, NgTemplateOutlet } from '@angular/common';
+import { MatTabsModule } from '@angular/material/tabs';
+import { MatOptionModule } from '@angular/material/core';
+import { MatSelectModule } from '@angular/material/select';
+import { ControllerServiceApi } from
'../controller-service-api/controller-service-api.component';
+import { ControllerServiceReferences } from
'../controller-service-references/controller-service-references.component';
+import { NifiSpinnerDirective } from '../../spinner/nifi-spinner.directive';
+import { TextTip } from '../../tooltips/text-tip/text-tip.component';
+import { NifiTooltipDirective } from '../../tooltips/nifi-tooltip.directive';
+import { ControllerServiceState } from
'../../../../state/contoller-service-state';
+import { Store } from '@ngrx/store';
+import {
+ setControllerService,
+ stopPollingControllerService,
+} from
'../../../../state/contoller-service-state/controller-service-state.actions';
+import { selectControllerService } from
'../../../../state/contoller-service-state/controller-service-state.selectors';
+import { CloseOnEscapeDialog } from
'../../close-on-escape-dialog/close-on-escape-dialog.component';
+import { moveControllerService } from
'./../../../../pages/flow-designer/state/controller-services/controller-services.actions';
+import { SelectOption } from './../../../../state/shared/index';
+
+@Component({
+ selector: 'move-controller-service',
+ standalone: true,
+ templateUrl: './move-controller-service.component.html',
+ imports: [
+ ReactiveFormsModule,
+ MatDialogModule,
+ MatInputModule,
+ MatCheckboxModule,
+ MatButtonModule,
+ MatTabsModule,
+ MatOptionModule,
+ MatSelectModule,
+ ControllerServiceApi,
+ ControllerServiceReferences,
+ AsyncPipe,
+ NifiSpinnerDirective,
+ NifiTooltipDirective,
+ NgTemplateOutlet
+ ],
+ styleUrls: ['./move-controller-service.component.scss']
+})
+export class MoveControllerService extends CloseOnEscapeDialog {
+ @Input() goToReferencingComponent!: (component:
ControllerServiceReferencingComponent) => void;
+ protected readonly TextTip = TextTip;
+ protected controllerServiceActionProcessGroups: SelectOption[] = [];
+
+ controllerService$ = this.store.select(selectControllerService);
Review Comment:
removed this.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/shared/index.ts:
##########
@@ -132,6 +132,12 @@ export interface EditControllerServiceDialogRequest {
history?: ComponentHistory;
}
+export interface MoveControllerServiceDialogRequest {
+ id: string;
+ controllerService: ControllerServiceEntity;
+ processGroupFlow: any;
+}
Review Comment:
Moved this to flow-designer. Also, changed to use the ProcessGroupFlow model.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/flow-designer/state/controller-services/controller-services.effects.ts:
##########
@@ -635,6 +636,82 @@ export class ControllerServicesEffects {
{ dispatch: false }
);
+ openMoveControllerServiceDialog$ = createEffect(
+ () =>
+ this.actions$.pipe(
+
ofType(ControllerServicesActions.openMoveControllerServiceDialog),
+ map((action) => action.request),
+ concatLatestFrom(() =>
this.store.select(selectCurrentProcessGroupId)),
+ tap(([request, currentProcessGroupId]) => {
+ const serviceId: string = request.id;
+ request.processGroupFlow =
this.flowService.getFlow(currentProcessGroupId);
Review Comment:
The current state did not store the entire flow. I did change this and I was
able to use it here without an api call. However, with the implementation of
disabled drop down menu process groups, I did need to 2 other api calls here.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/ui/common/controller-service/move-controller-service/move-controller-service.component.spec.ts:
##########
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { MoveControllerService } from './move-controller-service.component';
+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 { ComponentType, MoveControllerServiceDialogRequest } from
'../../../../state/shared';
+
+describe('MoveControllerService', () => {
Review Comment:
Fixed the test. It now passes.
--
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]