rfellows commented on code in PR #8945:
URL: https://github.com/apache/nifi/pull/8945#discussion_r1633684468
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/summary/ui/common/summary-table-filter/summary-table-filter.component.html:
##########
@@ -50,6 +50,21 @@
</mat-form-field>
</div>
}
+ @if (includeVersionedFlowStateFilter) {
+ <div>
+ <mat-form-field subscriptSizing="dynamic">
+ <mat-label>Version State</mat-label>
+ <mat-select
formControlName="filterVersionedFlowState">
+ <mat-option value="All">All States</mat-option>
+ <mat-option value="Up to date">Up to
date</mat-option>
+ <mat-option value="Locally modified">Locally
modified</mat-option>
+ <mat-option value="Stale">Stale</mat-option>
+ <mat-option value="Locally modified and
stale">Locally modified and stale</mat-option>
+ <mat-option value="Sync failure">Sync
failure</mat-option>
+ </mat-select>
Review Comment:
The values used should be the values found in the data returned from the API
and not the labels that the UI has assigned to them. These are enum values
defined in `org.apache.nifi.registry.flow.VersionedFlowState` and probably
won't change.
However, the labels used in the UI could change at any time, especially
if/when NiFi supports another language.
```suggestion
<mat-select
formControlName="filterVersionedFlowState">
<mat-option value="All">All
States</mat-option>
<mat-option value="UP_TO_DATE">Up to
date</mat-option>
<mat-option value="LOCALLY_MODIFIED">Locally
modified</mat-option>
<mat-option value="STALE">Stale</mat-option>
<mat-option
value="LOCALLY_MODIFIED_AND_STALE">Locally modified and stale</mat-option>
<mat-option value="SYNC_FAILURE">Sync
failure</mat-option>
</mat-select>
```
This would then require a change in the filter predicate as well... see my
other comment there.
##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/pages/summary/ui/process-group-status-listing/process-group-status-table/process-group-status-table.component.ts:
##########
@@ -83,7 +83,14 @@ export class ProcessGroupStatusTable extends
ComponentStatusTable<ProcessGroupSt
@Input() rootProcessGroup!: ProcessGroupStatusSnapshot;
override filterPredicate(data: ProcessGroupStatusSnapshotEntity, filter:
string): boolean {
- const { filterTerm, filterColumn } = JSON.parse(filter);
+ const { filterTerm, filterColumn, filterVersionedFlowState } =
JSON.parse(filter);
+ const matchOnVersionedFlowState: boolean = filterVersionedFlowState
!== 'All';
+
+ if (matchOnVersionedFlowState) {
+ if (this.formatVersionedFlowState(data) !==
filterVersionedFlowState) {
+ return false;
+ }
Review Comment:
If the value of the selection is the enum value, then we shouldn't have to
coerce the data into the label displayed to compare when filtering...
```suggestion
if (data.processGroupStatusSnapshot.versionedFlowState !==
filterVersionedFlowState) {
return false;
}
```
--
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]