Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyb149 committed Dec 6, 2024
1 parent c4420b4 commit 4046456
Show file tree
Hide file tree
Showing 19 changed files with 444 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ControllerServiceDefinition } from '../ui/controller-service-definition
import { ReportingTaskDefinition } from '../ui/reporting-task-definition/reporting-task-definition.component';
import { ParameterProviderDefinition } from '../ui/parameter-provider-definition/parameter-provider-definition.component';
import { FlowAnalysisRuleDefinition } from '../ui/flow-analysis-rule-definition/flow-analysis-rule-definition.component';
import { FlowRegistryClientDefinition } from '../ui/flow-registry-client-definition/flow-registry-client-definition.component';
import { Overview } from '../ui/overview/overview.component';

const routes: Routes = [
Expand Down Expand Up @@ -52,6 +53,10 @@ const routes: Routes = [
path: `${ComponentType.FlowAnalysisRule}/:group/:artifact/:version/:type`,
component: FlowAnalysisRuleDefinition
},
{
path: `${ComponentType.FlowRegistryClient}/:group/:artifact/:version/:type`,
component: FlowRegistryClientDefinition
},
{
path: 'overview',
component: Overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@
}
"></ng-container>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>Flow Registry Clients</mat-panel-title>
</mat-expansion-panel-header>
<ng-container
*ngTemplateOutlet="
extensionLinks;
context: {
$implicit: filterExtensions((registryClientTypes$ | async)!),
componentType: ComponentType.FlowRegistryClient
}
"></ng-container>
</mat-expansion-panel>
</mat-accordion>
<ng-template #extensionLinks let-extensionTypes let-componentType="componentType">
@if (extensionTypes.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
selectFlowAnalysisRuleTypes,
selectParameterProviderTypes,
selectProcessorTypes,
selectRegistryClientTypes,
selectReportingTaskTypes
} from '../../../state/extension-types/extension-types.selectors';
import { ComponentType, isDefinedAndNotNull, NiFiCommon, selectCurrentRoute } from '@nifi/shared';
Expand Down Expand Up @@ -71,6 +72,10 @@ export class Documentation implements OnInit, AfterViewInit {
flowAnalysisRuleTypes$ = this.store
.select(selectFlowAnalysisRuleTypes)
.pipe(map((extensionTypes) => this.sortExtensions(extensionTypes)));
registryClientTypes$ = this.store
.select(selectRegistryClientTypes)
.pipe(map((extensionTypes) => this.sortExtensions(extensionTypes)));


accordion = viewChild.required(MatAccordion);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AdditionalDetailsEntity } from '../state/additional-details';
import { ReportingTaskDefinition } from '../state/reporting-task-definition';
import { ParameterProviderDefinition } from '../state/parameter-provider-definition';
import { FlowAnalysisRuleDefinition } from '../state/flow-analysis-rule-definition';
import { FlowRegistryClientDefinition } from "../state/flow-registry-client-definition";

@Injectable({ providedIn: 'root' })
export class DocumentationService {
Expand Down Expand Up @@ -62,6 +63,12 @@ export class DocumentationService {
);
}

getFlowRegistryClientDefinition(coordinates: DefinitionCoordinates): Observable<FlowRegistryClientDefinition> {
return this.httpClient.get<FlowRegistryClientDefinition>(
`${DocumentationService.API}/flow/flow-registry-client-definition/${coordinates.group}/${coordinates.artifact}/${coordinates.version}/${coordinates.type}`
);
}

getAdditionalDetails(coordinates: DefinitionCoordinates): Observable<AdditionalDetailsEntity> {
return this.httpClient.get<AdditionalDetailsEntity>(
`${DocumentationService.API}/flow/additional-details/${coordinates.group}/${coordinates.artifact}/${coordinates.version}/${coordinates.type}`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 { createAction, props } from '@ngrx/store';
import { FlowRegistryClientDefinition } from './index';
import { DefinitionCoordinates } from '../index';

const FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX = '[Flow Registry Client Definition]';

export const loadFlowRegistryClientDefinition = createAction(
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Load Flow Registry Client Definition`,
props<{ coordinates: DefinitionCoordinates }>()
);

export const loadFlowRegistryClientDefinitionSuccess = createAction(
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Load Flow Registry Client Definition Success`,
props<{ flowRegistryClientDefinition: FlowRegistryClientDefinition }>()
);

export const flowRegistryClientDefinitionApiError = createAction(
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Load Flow Registry Client Definition Error`,
props<{ error: string }>()
);

export const resetFlowRegistryClientDefinitionState = createAction(
`${FLOW_REGISTRY_CLIENT_DEFINITION_PREFIX} Reset Flow Registry Client Definition State`
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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 { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import * as FlowRegistryClientDefinitionActions from './flow-registry-client-definition.actions';
import { catchError, from, map, of, switchMap } from 'rxjs';
import { ErrorHelper } from '../../../../service/error-helper.service';
import { HttpErrorResponse } from '@angular/common/http';
import { DocumentationService } from '../../service/documentation.service';
import { FlowRegistryClientDefinition } from './index';

@Injectable()
export class FlowRegistryClientDefinitionEffects {
constructor(
private actions$: Actions,
private documentationService: DocumentationService,
private errorHelper: ErrorHelper
) {}

loadFlowRegistryClientDefinition$ = createEffect(() =>
this.actions$.pipe(
ofType(FlowRegistryClientDefinitionActions.loadFlowRegistryClientDefinition),
map((action) => action.coordinates),
switchMap((coordinates) =>
from(this.documentationService.getFlowRegistryClientDefinition(coordinates)).pipe(
map((flowRegistryClientDefinition: FlowRegistryClientDefinition) =>
FlowRegistryClientDefinitionActions.loadFlowRegistryClientDefinitionSuccess({
flowRegistryClientDefinition
})
),
catchError((errorResponse: HttpErrorResponse) =>
of(
FlowRegistryClientDefinitionActions.flowRegistryClientDefinitionApiError({
error: this.errorHelper.getErrorString(errorResponse)
})
)
)
)
)
)
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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 { FlowRegistryClientDefinitionState } from './index';
import { createReducer, on } from '@ngrx/store';
import {
loadFlowRegistryClientDefinition,
loadFlowRegistryClientDefinitionSuccess,
flowRegistryClientDefinitionApiError,
resetFlowRegistryClientDefinitionState
} from './flow-registry-client-definition.actions';

export const initialState: FlowRegistryClientDefinitionState = {
flowRegistryClientDefinition: null,
error: null,
status: 'pending'
};

export const flowRegistryClientDefinitionReducer = createReducer(
initialState,
on(loadFlowRegistryClientDefinition, (state) => ({
...state,
status: 'loading' as const
})),
on(loadFlowRegistryClientDefinitionSuccess, (state, { flowRegistryClientDefinition }) => ({
...state,
flowRegistryClientDefinition,
error: null,
status: 'success' as const
})),
on(flowRegistryClientDefinitionApiError, (state, { error }) => ({
...state,
flowRegistryClientDefinition: null,
error,
status: 'error' as const
})),
on(resetFlowRegistryClientDefinitionState, () => ({
...initialState
}))
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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 { createSelector } from '@ngrx/store';
import { DocumentationState, selectDocumentationState } from '../index';
import { flowRegistryClientDefinitionFeatureKey } from './index';

export const selectFlowRegistryClientDefinitionState = createSelector(
selectDocumentationState,
(state: DocumentationState) => state[flowRegistryClientDefinitionFeatureKey]
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 { ConfigurableExtensionDefinition } from '../index';

export const flowRegistryClientDefinitionFeatureKey = 'flowRegistryClientDefinition';

export interface FlowRegistryClientDefinition extends ConfigurableExtensionDefinition {}

export interface FlowRegistryClientDefinitionState {
flowRegistryClientDefinition: FlowRegistryClientDefinition | null;
error: string | null;
status: 'pending' | 'loading' | 'success' | 'error';
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
import { parameterProviderDefinitionReducer } from './parameter-provider-definition/parameter-provider-definition.reducer';
import { flowAnalysisRuleDefinitionFeatureKey, FlowAnalysisRuleDefinitionState } from './flow-analysis-rule-definition';
import { flowAnalysisRuleDefinitionReducer } from './flow-analysis-rule-definition/flow-analysis-rule-definition.reducer';
import { flowRegistryClientDefinitionFeatureKey, FlowRegistryClientDefinitionState } from './flow-registry-client-definition';
import { flowRegistryClientDefinitionReducer } from './flow-registry-client-definition/flow-registry-client-definition.reducer';
import { ComponentType } from '@nifi/shared';
import { DocumentedType } from '../../../state/shared';

Expand Down Expand Up @@ -190,6 +192,7 @@ export interface DocumentationState {
[reportingTaskDefinitionFeatureKey]: ReportingTaskDefinitionState;
[parameterProviderDefinitionFeatureKey]: ParameterProviderDefinitionState;
[flowAnalysisRuleDefinitionFeatureKey]: FlowAnalysisRuleDefinitionState;
[flowRegistryClientDefinitionFeatureKey]: FlowRegistryClientDefinitionState;
[additionalDetailsFeatureKey]: AdditionalDetailsState;
[externalDocumentationFeatureKey]: ExternalDocumentationState;
}
Expand All @@ -201,6 +204,7 @@ export function reducers(state: DocumentationState | undefined, action: Action)
[reportingTaskDefinitionFeatureKey]: reportingTaskDefinitionReducer,
[parameterProviderDefinitionFeatureKey]: parameterProviderDefinitionReducer,
[flowAnalysisRuleDefinitionFeatureKey]: flowAnalysisRuleDefinitionReducer,
[flowRegistryClientDefinitionFeatureKey]: flowRegistryClientDefinitionReducer,
[additionalDetailsFeatureKey]: additionalDetailsReducer,
[externalDocumentationFeatureKey]: externalDocumentationReducer
})(state, action);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
~ 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.
-->

@if (flowRegistryClientDefinitionState) {
@if (isInitialLoading(flowRegistryClientDefinitionState)) {
<ngx-skeleton-loader count="3"></ngx-skeleton-loader>
} @else {
@if (flowRegistryClientDefinitionState.flowRegistryClientDefinition; as flowRegistryClientDefinition) {
<div class="flex flex-col gap-y-4 p-4">
<configurable-extension-definition
[configurableExtensionDefinition]="flowRegistryClientDefinition"></configurable-extension-definition>
</div>
} @else if (flowRegistryClientDefinitionState.error) {
<div class="p-4">
{{ flowRegistryClientDefinitionState.error }}
</div>
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*!
* 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.
*/
Loading

0 comments on commit 4046456

Please sign in to comment.