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


##########
experimental/traffic-portal/src/app/core/cache-groups/asns/table/asns-table.component.ts:
##########
@@ -0,0 +1,134 @@
+/*
+* 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 { MatDialog } from "@angular/material/dialog";
+import { ActivatedRoute, type Params } from "@angular/router";
+import { BehaviorSubject } from "rxjs";
+import type { ResponseASN } from "trafficops-types";
+
+import { CacheGroupService } from "src/app/api";
+import { CurrentUserService } from 
"src/app/shared/currentUser/current-user.service";
+import { DecisionDialogComponent } from 
"src/app/shared/dialogs/decision-dialog/decision-dialog.component";
+import type { ContextMenuActionEvent, ContextMenuItem } from 
"src/app/shared/generic-table/generic-table.component";
+import { NavigationService } from 
"src/app/shared/navigation/navigation.service";
+
+/**
+ * AsnsTableComponent is the controller for the "Asns" table.
+ */
+@Component({
+       selector: "tp-asns",
+       styleUrls: ["./asns-table.component.scss"],
+       templateUrl: "./asns-table.component.html"
+})
+export class AsnsTableComponent implements OnInit {
+       /** List of asns */
+       public asns: Promise<Array<ResponseASN>>;
+
+       constructor(private readonly route: ActivatedRoute, private readonly 
headerSvc: NavigationService,
+               private readonly api: CacheGroupService, private readonly 
dialog: MatDialog, public readonly auth: CurrentUserService) {
+               this.fuzzySubject = new BehaviorSubject<string>("");
+               this.asns = this.api.getASNs();
+               this.headerSvc.headerTitle.next("ASNs");
+       }
+
+       /** 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: "asn",
+                       headerName: "ASN"
+               },
+               {
+                       field: "cachegroup",
+                       headerName: "Cache Group",
+                       valueGetter: ({data}: {data: ResponseASN}): string => 
`${data.cachegroup}`
+               },
+               {
+                       field: "lastUpdated",
+                       headerName: "Last Updated"
+               }
+       ];
+
+       /** Definitions for the context menu items (which act on augmented asn 
data). */
+       public contextMenuItems: Array<ContextMenuItem<ResponseASN>> = [
+               {
+                       href: (selectedRow: ResponseASN): string => 
`${selectedRow.asn}`,
+                       name: "Edit"
+               },
+               {
+                       href: (selectedRow: ResponseASN): string => 
`${selectedRow.asn}`,

Review Comment:
   You are right it should be id even in line 83.



##########
experimental/traffic-portal/src/app/core/cache-groups/asns/table/asns-table.component.ts:
##########
@@ -0,0 +1,134 @@
+/*
+* 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 { MatDialog } from "@angular/material/dialog";
+import { ActivatedRoute, type Params } from "@angular/router";
+import { BehaviorSubject } from "rxjs";
+import type { ResponseASN } from "trafficops-types";
+
+import { CacheGroupService } from "src/app/api";
+import { CurrentUserService } from 
"src/app/shared/currentUser/current-user.service";
+import { DecisionDialogComponent } from 
"src/app/shared/dialogs/decision-dialog/decision-dialog.component";
+import type { ContextMenuActionEvent, ContextMenuItem } from 
"src/app/shared/generic-table/generic-table.component";
+import { NavigationService } from 
"src/app/shared/navigation/navigation.service";
+
+/**
+ * AsnsTableComponent is the controller for the "Asns" table.
+ */
+@Component({
+       selector: "tp-asns",
+       styleUrls: ["./asns-table.component.scss"],
+       templateUrl: "./asns-table.component.html"
+})
+export class AsnsTableComponent implements OnInit {
+       /** List of asns */
+       public asns: Promise<Array<ResponseASN>>;
+
+       constructor(private readonly route: ActivatedRoute, private readonly 
headerSvc: NavigationService,
+               private readonly api: CacheGroupService, private readonly 
dialog: MatDialog, public readonly auth: CurrentUserService) {
+               this.fuzzySubject = new BehaviorSubject<string>("");
+               this.asns = this.api.getASNs();
+               this.headerSvc.headerTitle.next("ASNs");
+       }
+
+       /** 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: "asn",
+                       headerName: "ASN"
+               },
+               {
+                       field: "cachegroup",
+                       headerName: "Cache Group",
+                       valueGetter: ({data}: {data: ResponseASN}): string => 
`${data.cachegroup}`
+               },
+               {
+                       field: "lastUpdated",
+                       headerName: "Last Updated"
+               }
+       ];
+
+       /** Definitions for the context menu items (which act on augmented asn 
data). */
+       public contextMenuItems: Array<ContextMenuItem<ResponseASN>> = [
+               {
+                       href: (selectedRow: ResponseASN): string => 
`${selectedRow.asn}`,
+                       name: "Edit"
+               },
+               {
+                       href: (selectedRow: ResponseASN): string => 
`${selectedRow.asn}`,

Review Comment:
   You are right it should be `id` even in line 83.



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