shamrickus commented on code in PR #7585:
URL: https://github.com/apache/trafficcontrol/pull/7585#discussion_r1276358594


##########
experimental/traffic-portal/server.ts:
##########
@@ -227,6 +230,20 @@ function run(): number {
                        }
                }
        });
+       parser.add_argument("-t", "--tpv1-url", {

Review Comment:
   `-t` is already taken, it needs to be a unique argument. I'd use `-1` or `-u`



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -153,11 +162,38 @@ export class NavigationService {
                                        name: "Cache Groups"
                                }],
                        name: "Servers"
+               }, {
+                       children: [
+                               {
+                                       href: `${this.tpv1Url}/cache-checks`,

Review Comment:
   All of the TPv1 hrefs here need to be `${this.tpv1Url}/#!/...`. For whatever 
reason TPv1 expects the `#!` in the path



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -193,7 +229,15 @@ export class NavigationService {
                                {
                                        href: "/core/iso-gen",
                                        name: "Generate System ISO"
-                               }
+                               },
+                               {
+                                       href: `${this.tpv1Url}/jobs`,
+                                       name: "Invalidate Content"
+                               },
+                               {
+                                       href: `${this.tpv1Url}/notifications`,

Review Comment:
   Same as above



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -153,11 +162,38 @@ export class NavigationService {
                                        name: "Cache Groups"
                                }],
                        name: "Servers"
+               }, {
+                       children: [
+                               {
+                                       href: `${this.tpv1Url}/cache-checks`,
+                                       name: "Cache Checks"
+                               },
+                               {
+                                       href: `${this.tpv1Url}/cache-stats`,
+                                       name: "Cache Stats"
+                               }
+                       ],
+                       name: "Monitor"
+               }, {
+                       children: [
+                               {
+                                       href: 
`${this.tpv1Url}/delivery-services`,
+                                       name: "Delivery Services"
+                               },
+                               {
+                                       href: 
`${this.tpv1Url}/delivery-service-requests`,
+                                       name: "Delivery Service Requests"
+                               }
+                       ],
+                       name: "Services"
                }, {
                        children: [
                                {
                                        href: "/core/types",
                                        name: "Types"
+                               }, {
+                                       href: `${this.tpv1Url}/origins`,

Review Comment:
   Same as above



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -153,11 +162,38 @@ export class NavigationService {
                                        name: "Cache Groups"
                                }],
                        name: "Servers"
+               }, {
+                       children: [
+                               {
+                                       href: `${this.tpv1Url}/cache-checks`,
+                                       name: "Cache Checks"
+                               },
+                               {
+                                       href: `${this.tpv1Url}/cache-stats`,
+                                       name: "Cache Stats"
+                               }
+                       ],
+                       name: "Monitor"
+               }, {
+                       children: [
+                               {
+                                       href: 
`${this.tpv1Url}/delivery-services`,
+                                       name: "Delivery Services"
+                               },
+                               {
+                                       href: 
`${this.tpv1Url}/delivery-service-requests`,

Review Comment:
   Same as above



##########
experimental/traffic-portal/src/app/shared/navigation/tp-sidebar/tp-sidebar.component.html:
##########
@@ -17,9 +17,24 @@
                <div id="sidenav-container">
                        <mat-tree [dataSource]="dataSource" 
[treeControl]="treeCtrl" id="sidebar-nav-tree">
                                <mat-tree-node *matTreeNodeDef="let node" 
matTreeNodeToggle>
-                                       <a class="mat-tree-node" mat-menu-item 
[attr.aria-label]="'Navigate to ' + node.name" [routerLink]="node.href" 
[routerLinkActive]="['boldNode']" [routerLinkActiveOptions]="routeOptions">
-                                               {{node.name}}
-                                       </a>
+                                       <!-- load either redirect or relative 
path href -->
+                                       <div *ngIf="isAbsoluteURL(node.href); 
then obsoluteHrefBlock else relativeHrefBlock"></div>

Review Comment:
   `obsolute` -> `absolute`



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -153,11 +162,38 @@ export class NavigationService {
                                        name: "Cache Groups"
                                }],
                        name: "Servers"
+               }, {
+                       children: [
+                               {
+                                       href: `${this.tpv1Url}/cache-checks`,
+                                       name: "Cache Checks"
+                               },
+                               {
+                                       href: `${this.tpv1Url}/cache-stats`,
+                                       name: "Cache Stats"
+                               }
+                       ],
+                       name: "Monitor"
+               }, {
+                       children: [
+                               {
+                                       href: 
`${this.tpv1Url}/delivery-services`,

Review Comment:
   Same as above



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -193,7 +229,15 @@ export class NavigationService {
                                {
                                        href: "/core/iso-gen",
                                        name: "Generate System ISO"
-                               }
+                               },
+                               {
+                                       href: `${this.tpv1Url}/jobs`,

Review Comment:
   Same as above



##########
experimental/traffic-portal/src/app/shared/navigation/tp-sidebar/tp-sidebar.component.html:
##########
@@ -17,9 +17,24 @@
                <div id="sidenav-container">
                        <mat-tree [dataSource]="dataSource" 
[treeControl]="treeCtrl" id="sidebar-nav-tree">
                                <mat-tree-node *matTreeNodeDef="let node" 
matTreeNodeToggle>
-                                       <a class="mat-tree-node" mat-menu-item 
[attr.aria-label]="'Navigate to ' + node.name" [routerLink]="node.href" 
[routerLinkActive]="['boldNode']" [routerLinkActiveOptions]="routeOptions">
-                                               {{node.name}}
-                                       </a>
+                                       <!-- load either redirect or relative 
path href -->
+                                       <div *ngIf="isAbsoluteURL(node.href); 
then obsoluteHrefBlock else relativeHrefBlock"></div>
+                               
+                                       <!-- Checking whether href is relative 
URL -->
+                                       <ng-template #relativeHrefBlock>
+                                               <a class="mat-tree-node" 
mat-menu-item [attr.aria-label]="'Navigate to ' + node.name" 
[routerLink]="node.href"
+                                                       
[routerLinkActive]="['boldNode']" [routerLinkActiveOptions]="routeOptions">
+                                                       {{node.name}}
+                                               </a>
+                                       </ng-template>
+                               
+                                       <!-- Checking whether href is absolute 
URL - For TPv1 redirect purpose -->
+                                       <ng-template #obsoluteHrefBlock>

Review Comment:
   `obsolute` -> `absolute`



##########
experimental/traffic-portal/src/app/shared/navigation/navigation.service.ts:
##########
@@ -153,11 +162,38 @@ export class NavigationService {
                                        name: "Cache Groups"
                                }],
                        name: "Servers"
+               }, {
+                       children: [
+                               {
+                                       href: `${this.tpv1Url}/cache-checks`,
+                                       name: "Cache Checks"
+                               },
+                               {
+                                       href: `${this.tpv1Url}/cache-stats`,

Review Comment:
   Same as above



##########
experimental/traffic-portal/src/app/app.component.ts:
##########
@@ -31,7 +34,19 @@ export class AppComponent implements OnInit {
        /** The currently logged-in user */
        public currentUser: ResponseCurrentUser | null = null;
 
-       constructor(private readonly router: Router, private readonly auth: 
CurrentUserService) {
+       constructor(private readonly router: Router, private readonly auth: 
CurrentUserService,
+               @Inject(PLATFORM_ID) private readonly platformId: object,
+               @Optional() @Inject("TP_V1_URL") public tpv1url: string,
+               private readonly transferState: TransferState) {
+               const storeKey = makeStateKey<string>("messageKey");
+
+               // get data from transferState if browser side
+               if (isPlatformBrowser(this.platformId)) {
+                       this.tpv1url = this.transferState.get(storeKey, 
"defaultMessageValue");

Review Comment:
   The default value should probably something other than 
`defaultMessageValue`. Perhaps just `https://localhost`, might be a better 
option but I think localhost should be fine for now.



-- 
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: issues-unsubscr...@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to