Skip to content

NIFI-14485 Add Bounded Process Group column to Parameter Contexts Page #9884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
</td>
</ng-container>

<!-- Process Group Column -->
<ng-container matColumnDef="process groups">
<th mat-header-cell
*matHeaderCellDef
mat-sort-header>Process Groups</th>
<td mat-cell *matCellDef="let item" [title]="formatProcessGroups(item)">
{{ formatProcessGroups(item) }}
</td>
</ng-container>

<!-- Actions Column -->
<ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.parameter-context-table {
.listing-table {
.mat-column-name {
width: 25%;
width: 20%;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MatSortModule, Sort } from '@angular/material/sort';
import { NiFiCommon } from '@nifi/shared';
import { FlowConfiguration } from '../../../../../state/flow-configuration';
import { CurrentUser } from '../../../../../state/current-user';
import { ParameterContextEntity } from '../../../../../state/shared';
import {ParameterContext, ParameterContextEntity} from '../../../../../state/shared';
import { MatIconButton } from '@angular/material/button';
import { MatMenu, MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
import { RouterLink } from '@angular/router';
Expand All @@ -34,7 +34,7 @@ import { NgClass } from '@angular/common';
imports: [MatTableModule, MatSortModule, MatIconButton, MatMenuTrigger, MatMenu, MatMenuItem, RouterLink, NgClass]
})
export class ParameterContextTable {
@Input() initialSortColumn: 'name' | 'provider' | 'description' = 'name';
@Input() initialSortColumn: 'name' | 'provider' | 'description' | 'process groups' = 'name';
@Input() initialSortDirection: 'asc' | 'desc' = 'asc';
activeSort: Sort = {
active: this.initialSortColumn,
Expand All @@ -54,7 +54,7 @@ export class ParameterContextTable {
@Output() deleteParameterContext: EventEmitter<ParameterContextEntity> = new EventEmitter<ParameterContextEntity>();
@Output() manageAccessPolicies: EventEmitter<ParameterContextEntity> = new EventEmitter<ParameterContextEntity>();

displayedColumns: string[] = ['name', 'provider', 'description', 'actions'];
displayedColumns: string[] = ['name', 'provider', 'description', 'process groups', 'actions'];
dataSource: MatTableDataSource<ParameterContextEntity> = new MatTableDataSource<ParameterContextEntity>();

constructor(private nifiCommon: NiFiCommon) {}
Expand Down Expand Up @@ -86,6 +86,19 @@ export class ParameterContextTable {
return this.canRead(entity) && entity.component ? entity.component.description : '';
}

formatProcessGroups(entity: ParameterContextEntity): string {
return this.canRead(entity) && entity.component ? this.getHighLevelProcessGroups(entity.component) : '';
}

private getHighLevelProcessGroups(component: ParameterContext) : string {
const componentIds: string[] = component.boundProcessGroups.map(group => group.component.id)
const boundProcessGroupNames: string[] = component.boundProcessGroups
.filter(group => !componentIds.includes(group.component.parentGroupId))
.map(group => group.component.name);

return boundProcessGroupNames.length <= 1 ? boundProcessGroupNames.toString() : boundProcessGroupNames.length.toString()
}

editClicked(entity: ParameterContextEntity): void {
this.editParameterContext.next(entity);
}
Expand Down Expand Up @@ -157,6 +170,9 @@ export class ParameterContextTable {
case 'description':
retVal = this.nifiCommon.compareString(this.formatDescription(a), this.formatDescription(b));
break;
case 'process groups':
retVal = this.nifiCommon.compareString(this.formatProcessGroups(a), this.formatProcessGroups(b))
break;
default:
return 0;
}
Expand Down