rimashah25 commented on code in PR #7486:
URL: https://github.com/apache/trafficcontrol/pull/7486#discussion_r1190376608


##########
experimental/traffic-portal/src/app/core/users/roles/table/roles-table.component.ts:
##########
@@ -0,0 +1,112 @@
+/*
+* Licensed 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, type OnInit } from "@angular/core";
+import { FormControl } from "@angular/forms";
+import {ActivatedRoute, type Params} from "@angular/router";
+import { BehaviorSubject } from "rxjs";
+import type { ResponseRole } from "trafficops-types";
+
+import { UserService } from "src/app/api";
+import { CurrentUserService } from 
"src/app/shared/current-user/current-user.service";
+import type { ContextMenuActionEvent, ContextMenuItem } from 
"src/app/shared/generic-table/generic-table.component";
+import { NavigationService } from 
"src/app/shared/navigation/navigation.service";
+/**
+ * RolesTableComponent is the controller for the "Roles" table.
+ */
+@Component({
+       selector: "tp-roles",
+       styleUrls: ["./roles-table.component.scss"],
+       templateUrl: "./roles-table.component.html"
+})
+export class RolesTableComponent implements OnInit {
+       /** List of roles */
+       public roles: Promise<Array<ResponseRole>>;
+       constructor(private readonly route: ActivatedRoute, private readonly 
headerSvc: NavigationService,
+               private readonly api: UserService, public readonly auth: 
CurrentUserService) {
+               this.fuzzySubject = new BehaviorSubject<string>("");
+               this.roles = this.api.getRoles();
+               this.headerSvc.headerTitle.next("Roles");
+       }
+
+       /** Initializes table data, loading it from Traffic Ops. */
+       public ngOnInit(): void {
+               this.route.queryParamMap.subscribe(
+                       m => {
+                               const search = m.get("search");
+                               if (search) {
+                                       
this.fuzzControl.setValue(decodeURIComponent(search));
+                                       this.updateURL();
+                               }
+                       },
+                       e => {
+                               console.error("Failed to get query 
parameters:", e);
+                       }
+               );
+       }
+
+       /** Definitions of the table's columns according to the ag-grid API */
+       public columnDefs = [
+               {
+                       field: "name",
+                       headerName: "Name"
+               },
+               {
+                       field: "description",
+                       headerName: "Description",
+               },
+               {
+                       field: "lastUpdated",
+                       headerName: "Last Updated"
+               }

Review Comment:
   Added filter.



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