rfellows commented on code in PR #8399:
URL: https://github.com/apache/nifi/pull/8399#discussion_r1489484153


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-frontend/src/main/nifi/src/app/pages/flow-configuration-history/ui/flow-configuration-history-listing/flow-configuration-history-table/flow-configuration-history-table.component.ts:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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 { MatTableDataSource, MatTableModule } from '@angular/material/table';
+import { MatSortModule, Sort } from '@angular/material/sort';
+import { ActionEntity } from 
'../../../state/flow-configuration-history-listing';
+import { NiFiCommon } from '../../../../../service/nifi-common.service';
+
+@Component({
+    selector: 'flow-configuration-history-table',
+    standalone: true,
+    imports: [CommonModule, MatTableModule, MatSortModule],
+    templateUrl: './flow-configuration-history-table.component.html',
+    styleUrls: ['./flow-configuration-history-table.component.scss']
+})
+export class FlowConfigurationHistoryTable {
+    @Input() selectedHistoryActionId: string | null = null;
+    @Input() initialSortColumn: 'timestamp' | 'sourceName' | 'sourceType' | 
'operation' | 'userIdentity' = 'timestamp';
+    @Input() initialSortDirection: 'asc' | 'desc' = 'desc';
+
+    @Input() set historyActions(historyActions: ActionEntity[]) {
+        if (historyActions) {
+            this.dataSource.data = historyActions;
+        }
+    }
+
+    @Output() selectionChanged: EventEmitter<ActionEntity> = new 
EventEmitter<ActionEntity>();
+    @Output() sortChanged: EventEmitter<Sort> = new EventEmitter<Sort>();
+    @Output() moreDetailsClicked: EventEmitter<ActionEntity> = new 
EventEmitter<ActionEntity>();
+
+    activeSort: Sort = {
+        active: this.initialSortColumn,
+        direction: this.initialSortDirection
+    };
+
+    displayedColumns: string[] = ['moreDetails', 'timestamp', 'sourceName', 
'sourceType', 'operation', 'userIdentity'];
+    dataSource: MatTableDataSource<ActionEntity> = new 
MatTableDataSource<ActionEntity>();
+
+    constructor(private nifiCommon: NiFiCommon) {}
+
+    sortData(sort: Sort) {
+        this.sortChanged.next(sort);
+    }
+
+    canRead(item: ActionEntity): boolean {
+        return item.canRead;
+    }
+
+    private format(item: ActionEntity, property: string): string {
+        if (this.canRead(item) && Object.hasOwn(item.action, property)) {
+            const value = (item.action as any)[property];
+            if (!value) {
+                return 'Empty String Set';
+            }
+            return value;
+        }
+        return 'Not Authorized';
+    }
+
+    formatTimestamp(item: ActionEntity): string {
+        return this.format(item, 'timestamp');
+    }
+
+    formatName(item: ActionEntity): string {
+        return this.format(item, 'sourceName');
+    }
+
+    formatType(item: ActionEntity): string {
+        return this.format(item, 'sourceType');
+    }
+
+    formatOperation(item: ActionEntity): string {
+        return this.format(item, 'operation');
+    }
+
+    formatUser(item: ActionEntity): string {
+        return this.format(item, 'userIdentity');
+    }
+
+    select(item: ActionEntity) {
+        this.selectionChanged.next(item);
+    }
+
+    isSelected(item: ActionEntity): boolean {
+        if (this.selectedHistoryActionId) {
+            return `${item.id}` === this.selectedHistoryActionId;

Review Comment:
   This is no longer a concern as we removed selection from the route.



-- 
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]

Reply via email to