NIFI-12950: Updating front end to use the uiOnly flag where possible (#8565)

* NIFI-12950:
- Updating front end to use the uiOnly flag where possible.

* NIFI-12950:
- Addressing review feedback.

This closes #8565
This commit is contained in:
Matt Gilman 2024-03-27 17:07:45 -04:00 committed by GitHub
parent a3dda5eb09
commit db09b44e40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 7 deletions

View File

@ -53,7 +53,10 @@ export class ControllerServiceService implements ControllerServiceCreator, Prope
} }
getControllerService(id: string): Observable<any> { getControllerService(id: string): Observable<any> {
return this.httpClient.get(`${ControllerServiceService.API}/controller-services/${id}`); const uiOnly: any = { uiOnly: true };
return this.httpClient.get(`${ControllerServiceService.API}/controller-services/${id}`, {
params: uiOnly
});
} }
createControllerService(createControllerService: CreateControllerServiceRequest): Observable<any> { createControllerService(createControllerService: CreateControllerServiceRequest): Observable<any> {

View File

@ -54,13 +54,15 @@ export class FlowService implements PropertyDescriptorRetriever {
) {} ) {}
getFlow(processGroupId = 'root'): Observable<any> { getFlow(processGroupId = 'root'): Observable<any> {
// TODO - support uiOnly... this would mean that we need to load the entire resource prior to editing const uiOnly: any = { uiOnly: true };
return this.httpClient.get(`${FlowService.API}/flow/process-groups/${processGroupId}`); return this.httpClient.get(`${FlowService.API}/flow/process-groups/${processGroupId}`, {
params: uiOnly
});
} }
getProcessGroupStatus(processGroupId = 'root', recursive = false): Observable<any> { getProcessGroupStatus(processGroupId = 'root', recursive = false): Observable<any> {
return this.httpClient.get(`${FlowService.API}/flow/process-groups/${processGroupId}/status`, { return this.httpClient.get(`${FlowService.API}/flow/process-groups/${processGroupId}/status`, {
params: { recursive: recursive } params: { recursive }
}); });
} }

View File

@ -40,7 +40,6 @@ import {
selectStatus selectStatus
} from './controller-services.selectors'; } from './controller-services.selectors';
import { ControllerServiceService } from '../../service/controller-service.service'; import { ControllerServiceService } from '../../service/controller-service.service';
import { FlowService } from '../../service/flow.service';
import { EnableControllerService } from '../../../../ui/common/controller-service/enable-controller-service/enable-controller-service.component'; import { EnableControllerService } from '../../../../ui/common/controller-service/enable-controller-service/enable-controller-service.component';
import { DisableControllerService } from '../../../../ui/common/controller-service/disable-controller-service/disable-controller-service.component'; import { DisableControllerService } from '../../../../ui/common/controller-service/disable-controller-service/disable-controller-service.component';
import { PropertyTableHelperService } from '../../../../service/property-table-helper.service'; import { PropertyTableHelperService } from '../../../../service/property-table-helper.service';
@ -56,7 +55,6 @@ export class ControllerServicesEffects {
private store: Store<NiFiState>, private store: Store<NiFiState>,
private client: Client, private client: Client,
private controllerServiceService: ControllerServiceService, private controllerServiceService: ControllerServiceService,
private flowService: FlowService,
private errorHelper: ErrorHelper, private errorHelper: ErrorHelper,
private dialog: MatDialog, private dialog: MatDialog,
private router: Router, private router: Router,

View File

@ -20,6 +20,7 @@ import { FlowService } from '../../service/flow.service';
import { Actions, concatLatestFrom, createEffect, ofType } from '@ngrx/effects'; import { Actions, concatLatestFrom, createEffect, ofType } from '@ngrx/effects';
import * as FlowActions from './flow.actions'; import * as FlowActions from './flow.actions';
import * as StatusHistoryActions from '../../../../state/status-history/status-history.actions'; import * as StatusHistoryActions from '../../../../state/status-history/status-history.actions';
import * as ErrorActions from '../../../../state/error/error.actions';
import { import {
asyncScheduler, asyncScheduler,
catchError, catchError,
@ -98,6 +99,7 @@ import { ImportFromRegistry } from '../../ui/canvas/items/flow/import-from-regis
import { selectCurrentUser } from '../../../../state/current-user/current-user.selectors'; import { selectCurrentUser } from '../../../../state/current-user/current-user.selectors';
import { NoRegistryClientsDialog } from '../../ui/common/no-registry-clients-dialog/no-registry-clients-dialog.component'; import { NoRegistryClientsDialog } from '../../ui/common/no-registry-clients-dialog/no-registry-clients-dialog.component';
import { EditRemoteProcessGroup } from '../../ui/canvas/items/remote-process-group/edit-remote-process-group/edit-remote-process-group.component'; import { EditRemoteProcessGroup } from '../../ui/canvas/items/remote-process-group/edit-remote-process-group/edit-remote-process-group.component';
import { HttpErrorResponse } from '@angular/common/http';
@Injectable() @Injectable()
export class FlowEffects { export class FlowEffects {
@ -1069,6 +1071,33 @@ export class FlowEffects {
this.actions$.pipe( this.actions$.pipe(
ofType(FlowActions.openEditProcessorDialog), ofType(FlowActions.openEditProcessorDialog),
map((action) => action.request), map((action) => action.request),
switchMap((request) =>
from(this.flowService.getProcessor(request.entity.id)).pipe(
map((entity) => {
return {
...request,
entity
};
}),
tap({
error: (errorResponse: HttpErrorResponse) => {
this.store.dispatch(
FlowActions.selectComponents({
request: {
components: [
{
id: request.entity.id,
componentType: request.type
}
]
}
})
);
this.store.dispatch(ErrorActions.snackBarError({ error: errorResponse.error }));
}
})
)
),
concatLatestFrom(() => [ concatLatestFrom(() => [
this.store.select(selectCurrentParameterContext), this.store.select(selectCurrentParameterContext),
this.store.select(selectCurrentProcessGroupId) this.store.select(selectCurrentProcessGroupId)

View File

@ -37,7 +37,10 @@ export class ControllerServiceStateService {
) {} ) {}
getControllerService(id: string): Observable<any> { getControllerService(id: string): Observable<any> {
return this.httpClient.get(`${ControllerServiceStateService.API}/controller-services/${id}`); const uiOnly: any = { uiOnly: true };
return this.httpClient.get(`${ControllerServiceStateService.API}/controller-services/${id}`, {
params: uiOnly
});
} }
setEnable(controllerService: ControllerServiceEntity, enabled: boolean): Observable<any> { setEnable(controllerService: ControllerServiceEntity, enabled: boolean): Observable<any> {