Skip to content

Commit 5b42a24

Browse files
committed
Initial UI changes - WIP
1 parent cd1ff92 commit 5b42a24

19 files changed

+444
-8
lines changed

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/documentation/feature/documentation-routing.module.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { ControllerServiceDefinition } from '../ui/controller-service-definition
2424
import { ReportingTaskDefinition } from '../ui/reporting-task-definition/reporting-task-definition.component';
2525
import { ParameterProviderDefinition } from '../ui/parameter-provider-definition/parameter-provider-definition.component';
2626
import { FlowAnalysisRuleDefinition } from '../ui/flow-analysis-rule-definition/flow-analysis-rule-definition.component';
27+
import { FlowRegistryClientDefinition } from '../ui/flow-registry-client-definition/flow-registry-client-definition.component';
2728
import { Overview } from '../ui/overview/overview.component';
2829

2930
const routes: Routes = [
@@ -52,6 +53,10 @@ const routes: Routes = [
5253
path: `${ComponentType.FlowAnalysisRule}/:group/:artifact/:version/:type`,
5354
component: FlowAnalysisRuleDefinition
5455
},
56+
{
57+
path: `${ComponentType.FlowRegistryClient}/:group/:artifact/:version/:type`,
58+
component: FlowRegistryClientDefinition
59+
},
5560
{
5661
path: 'overview',
5762
component: Overview

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/documentation/feature/documentation.component.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@
112112
}
113113
"></ng-container>
114114
</mat-expansion-panel>
115+
<mat-expansion-panel>
116+
<mat-expansion-panel-header>
117+
<mat-panel-title>Flow Registry Clients</mat-panel-title>
118+
</mat-expansion-panel-header>
119+
<ng-container
120+
*ngTemplateOutlet="
121+
extensionLinks;
122+
context: {
123+
$implicit: filterExtensions((registryClientTypes$ | async)!),
124+
componentType: ComponentType.FlowRegistryClient
125+
}
126+
"></ng-container>
127+
</mat-expansion-panel>
115128
</mat-accordion>
116129
<ng-template #extensionLinks let-extensionTypes let-componentType="componentType">
117130
@if (extensionTypes.length === 0) {

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/documentation/feature/documentation.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
selectFlowAnalysisRuleTypes,
3434
selectParameterProviderTypes,
3535
selectProcessorTypes,
36+
selectRegistryClientTypes,
3637
selectReportingTaskTypes
3738
} from '../../../state/extension-types/extension-types.selectors';
3839
import { ComponentType, isDefinedAndNotNull, NiFiCommon, selectCurrentRoute } from '@nifi/shared';
@@ -73,6 +74,10 @@ export class Documentation implements OnInit, AfterViewInit {
7374
flowAnalysisRuleTypes$ = this.store
7475
.select(selectFlowAnalysisRuleTypes)
7576
.pipe(map((extensionTypes) => this.sortExtensions(extensionTypes)));
77+
registryClientTypes$ = this.store
78+
.select(selectRegistryClientTypes)
79+
.pipe(map((extensionTypes) => this.sortExtensions(extensionTypes)));
80+
7681

7782
accordion = viewChild.required(MatAccordion);
7883

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/documentation/service/documentation.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { AdditionalDetailsEntity } from '../state/additional-details';
2525
import { ReportingTaskDefinition } from '../state/reporting-task-definition';
2626
import { ParameterProviderDefinition } from '../state/parameter-provider-definition';
2727
import { FlowAnalysisRuleDefinition } from '../state/flow-analysis-rule-definition';
28+
import { FlowRegistryClientDefinition } from "../state/flow-registry-client-definition";
2829

2930
@Injectable({ providedIn: 'root' })
3031
export class DocumentationService {
@@ -62,6 +63,12 @@ export class DocumentationService {
6263
);
6364
}
6465

66+
getFlowRegistryClientDefinition(coordinates: DefinitionCoordinates): Observable<FlowRegistryClientDefinition> {
67+
return this.httpClient.get<FlowRegistryClientDefinition>(
68+
`${DocumentationService.API}/flow/flow-registry-client-definition/${coordinates.group}/${coordinates.artifact}/${coordinates.version}/${coordinates.type}`
69+
);
70+
}
71+
6572
getAdditionalDetails(coordinates: DefinitionCoordinates): Observable<AdditionalDetailsEntity> {
6673
return this.httpClient.get<AdditionalDetailsEntity>(
6774
`${DocumentationService.API}/flow/additional-details/${coordinates.group}/${coordinates.artifact}/${coordinates.version}/${coordinates.type}`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { createAction, props } from '@ngrx/store';
19+
import { FlowRegistryClientDefinition } from './index';
20+
import { DefinitionCoordinates } from '../index';
21+
22+
const FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX = '[Flow Registry Client Definition]';
23+
24+
export const loadFlowRegistryClientDefinition = createAction(
25+
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Load Flow Registry Client Definition`,
26+
props<{ coordinates: DefinitionCoordinates }>()
27+
);
28+
29+
export const loadFlowRegistryClientDefinitionSuccess = createAction(
30+
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Load Flow Registry Client Definition Success`,
31+
props<{ flowRegistryClientDefinition: FlowRegistryClientDefinition }>()
32+
);
33+
34+
export const flowRegistryClientDefinitionApiError = createAction(
35+
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Load Flow Registry Client Definition Error`,
36+
props<{ error: string }>()
37+
);
38+
39+
export const resetFlowRegistryClientDefinitionState = createAction(
40+
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Reset Flow Registry Client Definition State`
41+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { Injectable } from '@angular/core';
19+
import { Actions, createEffect, ofType } from '@ngrx/effects';
20+
import * as FlowRegistryClientDefinitionActions from './flow-registry-client-definition.actions';
21+
import { catchError, from, map, of, switchMap } from 'rxjs';
22+
import { ErrorHelper } from '../../../../service/error-helper.service';
23+
import { HttpErrorResponse } from '@angular/common/http';
24+
import { DocumentationService } from '../../service/documentation.service';
25+
import { FlowRegistryClientDefinition } from './index';
26+
27+
@Injectable()
28+
export class FlowRegistryClientDefinitionEffects {
29+
constructor(
30+
private actions$: Actions,
31+
private documentationService: DocumentationService,
32+
private errorHelper: ErrorHelper
33+
) {}
34+
35+
loadFlowRegistryClientDefinition$ = createEffect(() =>
36+
this.actions$.pipe(
37+
ofType(FlowRegistryClientDefinitionActions.loadFlowRegistryClientDefinition),
38+
map((action) => action.coordinates),
39+
switchMap((coordinates) =>
40+
from(this.documentationService.getFlowRegistryClientDefinition(coordinates)).pipe(
41+
map((flowRegistryClientDefinition: FlowRegistryClientDefinition) =>
42+
FlowRegistryClientDefinitionActions.loadFlowRegistryClientDefinitionSuccess({
43+
flowRegistryClientDefinition
44+
})
45+
),
46+
catchError((errorResponse: HttpErrorResponse) =>
47+
of(
48+
FlowRegistryClientDefinitionActions.flowRegistryClientDefinitionApiError({
49+
error: this.errorHelper.getErrorString(errorResponse)
50+
})
51+
)
52+
)
53+
)
54+
)
55+
)
56+
);
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { FlowRegistryClientDefinitionState } from './index';
19+
import { createReducer, on } from '@ngrx/store';
20+
import {
21+
loadFlowRegistryClientDefinition,
22+
loadFlowRegistryClientDefinitionSuccess,
23+
flowRegistryClientDefinitionApiError,
24+
resetFlowRegistryClientDefinitionState
25+
} from './flow-registry-client-definition.actions';
26+
27+
export const initialState: FlowRegistryClientDefinitionState = {
28+
flowRegistryClientDefinition: null,
29+
error: null,
30+
status: 'pending'
31+
};
32+
33+
export const flowRegistryClientDefinitionReducer = createReducer(
34+
initialState,
35+
on(loadFlowRegistryClientDefinition, (state) => ({
36+
...state,
37+
status: 'loading' as const
38+
})),
39+
on(loadFlowRegistryClientDefinitionSuccess, (state, { flowRegistryClientDefinition }) => ({
40+
...state,
41+
flowRegistryClientDefinition,
42+
error: null,
43+
status: 'success' as const
44+
})),
45+
on(flowRegistryClientDefinitionApiError, (state, { error }) => ({
46+
...state,
47+
flowRegistryClientDefinition: null,
48+
error,
49+
status: 'error' as const
50+
})),
51+
on(resetFlowRegistryClientDefinitionState, () => ({
52+
...initialState
53+
}))
54+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { createSelector } from '@ngrx/store';
19+
import { DocumentationState, selectDocumentationState } from '../index';
20+
import { flowRegistryClientDefinitionFeatureKey } from './index';
21+
22+
export const selectFlowRegistryClientDefinitionState = createSelector(
23+
selectDocumentationState,
24+
(state: DocumentationState) => state[flowRegistryClientDefinitionFeatureKey]
25+
);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import { ConfigurableExtensionDefinition } from '../index';
19+
20+
export const flowRegistryClientDefinitionFeatureKey = 'flowRegistryClientDefinition';
21+
22+
export interface FlowRegistryClientDefinition extends ConfigurableExtensionDefinition {}
23+
24+
export interface FlowRegistryClientDefinitionState {
25+
flowRegistryClientDefinition: FlowRegistryClientDefinition | null;
26+
error: string | null;
27+
status: 'pending' | 'loading' | 'success' | 'error';
28+
}

nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/documentation/state/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import {
3636
import { parameterProviderDefinitionReducer } from './parameter-provider-definition/parameter-provider-definition.reducer';
3737
import { flowAnalysisRuleDefinitionFeatureKey, FlowAnalysisRuleDefinitionState } from './flow-analysis-rule-definition';
3838
import { flowAnalysisRuleDefinitionReducer } from './flow-analysis-rule-definition/flow-analysis-rule-definition.reducer';
39+
import { flowRegistryClientDefinitionFeatureKey, FlowRegistryClientDefinitionState } from './flow-registry-client-definition';
40+
import { flowRegistryClientDefinitionReducer } from './flow-registry-client-definition/flow-registry-client-definition.reducer';
3941
import { ComponentType } from '@nifi/shared';
4042
import { DocumentedType } from '../../../state/shared';
4143

@@ -190,6 +192,7 @@ export interface DocumentationState {
190192
[reportingTaskDefinitionFeatureKey]: ReportingTaskDefinitionState;
191193
[parameterProviderDefinitionFeatureKey]: ParameterProviderDefinitionState;
192194
[flowAnalysisRuleDefinitionFeatureKey]: FlowAnalysisRuleDefinitionState;
195+
[flowRegistryClientDefinitionFeatureKey]: FlowRegistryClientDefinitionState;
193196
[additionalDetailsFeatureKey]: AdditionalDetailsState;
194197
[externalDocumentationFeatureKey]: ExternalDocumentationState;
195198
}
@@ -201,6 +204,7 @@ export function reducers(state: DocumentationState | undefined, action: Action)
201204
[reportingTaskDefinitionFeatureKey]: reportingTaskDefinitionReducer,
202205
[parameterProviderDefinitionFeatureKey]: parameterProviderDefinitionReducer,
203206
[flowAnalysisRuleDefinitionFeatureKey]: flowAnalysisRuleDefinitionReducer,
207+
[flowRegistryClientDefinitionFeatureKey]: flowRegistryClientDefinitionReducer,
204208
[additionalDetailsFeatureKey]: additionalDetailsReducer,
205209
[externalDocumentationFeatureKey]: externalDocumentationReducer
206210
})(state, action);

0 commit comments

Comments
 (0)