mcgilman commented on code in PR #8298:
URL: https://github.com/apache/nifi/pull/8298#discussion_r1467676005
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers.component.ts:
##########
@@ -15,11 +15,109 @@
* limitations under the License.
*/
-import { Component } from '@angular/core';
+import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Store } from '@ngrx/store';
+import { NiFiState } from '../../../../state';
+import { ParameterProviderEntity, ParameterProvidersState } from
'../../state/parameter-providers';
+import { selectCurrentUser } from
'../../../../state/current-user/current-user.selectors';
+import {
+ selectParameterProvider,
+ selectParameterProviderIdFromRoute,
+ selectParameterProvidersState,
+ selectSingleEditedParameterProvider
+} from '../../state/parameter-providers/parameter-providers.selectors';
+import { selectFlowConfiguration } from
'../../../../state/flow-configuration/flow-configuration.selectors';
+import { loadFlowConfiguration } from
'../../../../state/flow-configuration/flow-configuration.actions';
+import * as ParameterProviderActions from
'../../state/parameter-providers/parameter-providers.actions';
+import { initialParameterProvidersState } from
'../../state/parameter-providers/parameter-providers.reducer';
+import { filter, switchMap, take } from 'rxjs';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'parameter-providers',
templateUrl: './parameter-providers.component.html',
styleUrls: ['./parameter-providers.component.scss']
})
-export class ParameterProviders {}
+export class ParameterProviders implements OnInit, OnDestroy {
+ currentUser$ = this.store.select(selectCurrentUser);
+ parameterProvidersState$ =
this.store.select(selectParameterProvidersState);
+ selectedParameterProviderId$ =
this.store.select(selectParameterProviderIdFromRoute);
+ flowConfiguration$ = this.store.select(selectFlowConfiguration);
+
+ constructor(private store: Store<NiFiState>) {
+ this.store
+ .select(selectSingleEditedParameterProvider)
+ .pipe(
+ filter((id: string) => !!id),
Review Comment:
Should be able to use `isDefinedAndNotNull` here.
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers.component.ts:
##########
@@ -15,11 +15,109 @@
* limitations under the License.
*/
-import { Component } from '@angular/core';
+import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Store } from '@ngrx/store';
+import { NiFiState } from '../../../../state';
+import { ParameterProviderEntity, ParameterProvidersState } from
'../../state/parameter-providers';
+import { selectCurrentUser } from
'../../../../state/current-user/current-user.selectors';
+import {
+ selectParameterProvider,
+ selectParameterProviderIdFromRoute,
+ selectParameterProvidersState,
+ selectSingleEditedParameterProvider
+} from '../../state/parameter-providers/parameter-providers.selectors';
+import { selectFlowConfiguration } from
'../../../../state/flow-configuration/flow-configuration.selectors';
+import { loadFlowConfiguration } from
'../../../../state/flow-configuration/flow-configuration.actions';
+import * as ParameterProviderActions from
'../../state/parameter-providers/parameter-providers.actions';
+import { initialParameterProvidersState } from
'../../state/parameter-providers/parameter-providers.reducer';
+import { filter, switchMap, take } from 'rxjs';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'parameter-providers',
templateUrl: './parameter-providers.component.html',
styleUrls: ['./parameter-providers.component.scss']
})
-export class ParameterProviders {}
+export class ParameterProviders implements OnInit, OnDestroy {
+ currentUser$ = this.store.select(selectCurrentUser);
+ parameterProvidersState$ =
this.store.select(selectParameterProvidersState);
+ selectedParameterProviderId$ =
this.store.select(selectParameterProviderIdFromRoute);
+ flowConfiguration$ = this.store.select(selectFlowConfiguration);
+
+ constructor(private store: Store<NiFiState>) {
+ this.store
+ .select(selectSingleEditedParameterProvider)
+ .pipe(
+ filter((id: string) => !!id),
+ switchMap((id: string) =>
+ this.store.select(selectParameterProvider(id)).pipe(
+ filter((entity) => !!entity),
Review Comment:
Should be able to use `isDefinedAndNotNull` here.
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/service/property-table-helper.service.ts:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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 { MatDialog } from '@angular/material/dialog';
+import { catchError, map, NEVER, Observable, switchMap, take } from 'rxjs';
+import {
+ ControllerServiceCreator,
+ ControllerServiceEntity,
+ CreateControllerServiceRequest,
+ InlineServiceCreationRequest,
+ InlineServiceCreationResponse,
+ NewPropertyDialogRequest,
+ NewPropertyDialogResponse,
+ Property,
+ PropertyDescriptor,
+ PropertyDescriptorRetriever
+} from '../state/shared';
+import { NewPropertyDialog } from
'../ui/common/new-property-dialog/new-property-dialog.component';
+import { CreateControllerService } from
'../ui/common/controller-service/create-controller-service/create-controller-service.component';
+import { ManagementControllerServiceService } from
'../pages/settings/service/management-controller-service.service';
+import { ExtensionTypesService } from './extension-types.service';
+import { Client } from './client.service';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PropertyTableHelperService {
Review Comment:
🎉
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-designer/service/controller-service.service.ts:
##########
@@ -16,19 +16,20 @@
*/
import { Injectable } from '@angular/core';
-import { Observable, throwError } from 'rxjs';
+import { EMPTY, NEVER, Observable } from 'rxjs';
Review Comment:
NEVER is an unused import.
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers-table/parameter-providers-table.component.ts:
##########
@@ -0,0 +1,176 @@
+/*
+ * 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, EventEmitter, Input, Output } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { MatSortModule, Sort, SortDirection } from '@angular/material/sort';
+import { MatTableDataSource, MatTableModule } from '@angular/material/table';
+import { ParameterProviderEntity } from '../../../state/parameter-providers';
+import { NiFiCommon } from '../../../../../service/nifi-common.service';
+import { CurrentUser } from '../../../../../state/current-user';
+import { FlowConfiguration } from '../../../../../state/flow-configuration';
+import { MatPaginatorModule } from '@angular/material/paginator';
+import { SummaryTableFilterModule } from
'../../../../summary/ui/common/summary-table-filter/summary-table-filter.module';
+import { PortStatusSnapshotEntity } from
'../../../../summary/state/summary-listing';
+import { ValidationErrorsTip } from
'../../../../../ui/common/tooltips/validation-errors-tip/validation-errors-tip.component';
+import { NifiTooltipDirective } from
'../../../../../ui/common/tooltips/nifi-tooltip.directive';
+import { ControllerServiceEntity, ValidationErrorsTipInput } from
'../../../../../state/shared';
+import { RouterLink } from '@angular/router';
+
+export type SupportedColumns = 'name' | 'type' | 'bundle';
+
+@Component({
+ selector: 'parameter-providers-table',
+ standalone: true,
+ imports: [
+ CommonModule,
+ MatPaginatorModule,
+ MatSortModule,
+ MatTableModule,
+ SummaryTableFilterModule,
+ NifiTooltipDirective,
+ RouterLink
+ ],
+ templateUrl: './parameter-providers-table.component.html',
+ styleUrls: ['./parameter-providers-table.component.scss',
'../../../../../../assets/styles/listing-table.scss']
+})
+export class ParameterProvidersTable {
+ @Input() initialSortColumn: SupportedColumns = 'name';
+ @Input() initialSortDirection: SortDirection = 'asc';
+
+ displayedColumns: string[] = ['moreDetails', 'name', 'type', 'bundle',
'actions'];
+ dataSource: MatTableDataSource<ParameterProviderEntity> = new
MatTableDataSource<ParameterProviderEntity>();
+ activeSort: Sort = {
+ active: this.initialSortColumn,
+ direction: this.initialSortDirection
+ };
+
+ constructor(private nifiCommon: NiFiCommon) {}
+
+ @Input() selectedParameterProviderId!: string;
+ @Input() currentUser!: CurrentUser;
+ @Input() flowConfiguration!: FlowConfiguration;
+
+ @Input() set parameterProviders(parameterProviders:
ParameterProviderEntity[]) {
+ if (parameterProviders) {
+ this.dataSource.data = this.sortEntities(parameterProviders,
this.activeSort);
+ }
+ }
+
+ @Output() selectParameterProvider: EventEmitter<ParameterProviderEntity> =
+ new EventEmitter<ParameterProviderEntity>();
+ @Output() configureParameterProvider:
EventEmitter<ParameterProviderEntity> =
+ new EventEmitter<ParameterProviderEntity>();
+ @Output() deleteParameterProvider: EventEmitter<ParameterProviderEntity> =
+ new EventEmitter<ParameterProviderEntity>();
+ @Output() fetchParameterProvider: EventEmitter<ParameterProviderEntity> =
+ new EventEmitter<ParameterProviderEntity>();
+ @Output() manageAccessPolicies: EventEmitter<ParameterProviderEntity> =
new EventEmitter<ParameterProviderEntity>();
+
+ protected readonly ValidationErrorsTip = ValidationErrorsTip;
+
+ canRead(entity: ParameterProviderEntity): boolean {
+ return entity.permissions.canRead;
+ }
+
+ canWrite(entity: ParameterProviderEntity): boolean {
+ return entity.permissions.canWrite;
+ }
+
+ canManageAccessPolicies(): boolean {
+ return this.flowConfiguration.supportsManagedAuthorizer &&
this.currentUser.tenantsPermissions.canRead;
+ }
+
+ isSelected(parameterProvider: ParameterProviderEntity): boolean {
+ if (this.selectedParameterProviderId) {
+ return parameterProvider.id === this.selectedParameterProviderId;
+ }
+ return false;
+ }
+
+ formatName(entity: ParameterProviderEntity): string {
+ return this.canRead(entity) ? entity.component.name : entity.id;
+ }
+
+ formatType(entity: ParameterProviderEntity): string {
+ return this.canRead(entity) ?
this.nifiCommon.formatType(entity.component) : '';
+ }
+
+ formatBundle(entity: ParameterProviderEntity): string {
+ return this.canRead(entity) ?
this.nifiCommon.formatBundle(entity.component.bundle) : '';
+ }
+
+ hasErrors(entity: ParameterProviderEntity): boolean {
+ return !this.nifiCommon.isEmpty(entity.component.validationErrors);
Review Comment:
Need permissions check here.
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/settings/ui/parameter-providers/parameter-providers.component.ts:
##########
@@ -15,11 +15,109 @@
* limitations under the License.
*/
-import { Component } from '@angular/core';
+import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Store } from '@ngrx/store';
+import { NiFiState } from '../../../../state';
+import { ParameterProviderEntity, ParameterProvidersState } from
'../../state/parameter-providers';
+import { selectCurrentUser } from
'../../../../state/current-user/current-user.selectors';
+import {
+ selectParameterProvider,
+ selectParameterProviderIdFromRoute,
+ selectParameterProvidersState,
+ selectSingleEditedParameterProvider
+} from '../../state/parameter-providers/parameter-providers.selectors';
+import { selectFlowConfiguration } from
'../../../../state/flow-configuration/flow-configuration.selectors';
+import { loadFlowConfiguration } from
'../../../../state/flow-configuration/flow-configuration.actions';
+import * as ParameterProviderActions from
'../../state/parameter-providers/parameter-providers.actions';
+import { initialParameterProvidersState } from
'../../state/parameter-providers/parameter-providers.reducer';
+import { filter, switchMap, take } from 'rxjs';
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'parameter-providers',
templateUrl: './parameter-providers.component.html',
styleUrls: ['./parameter-providers.component.scss']
})
-export class ParameterProviders {}
+export class ParameterProviders implements OnInit, OnDestroy {
+ currentUser$ = this.store.select(selectCurrentUser);
+ parameterProvidersState$ =
this.store.select(selectParameterProvidersState);
+ selectedParameterProviderId$ =
this.store.select(selectParameterProviderIdFromRoute);
+ flowConfiguration$ = this.store.select(selectFlowConfiguration);
+
+ constructor(private store: Store<NiFiState>) {
+ this.store
+ .select(selectSingleEditedParameterProvider)
+ .pipe(
+ filter((id: string) => !!id),
+ switchMap((id: string) =>
+ this.store.select(selectParameterProvider(id)).pipe(
+ filter((entity) => !!entity),
+ take(1)
+ )
+ ),
+ takeUntilDestroyed()
+ )
+ .subscribe((entity) => {
+ if (entity) {
Review Comment:
Will be unnecessary with `isDefinedAndNotNull` used above.
--
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]