ocket8888 commented on code in PR #6967:
URL: https://github.com/apache/trafficcontrol/pull/6967#discussion_r926092748


##########
experimental/traffic-portal/src/app/core/users/users.component.ts:
##########
@@ -229,8 +229,8 @@ export class UsersComponent implements OnInit {
                        newTab: true
                },
                {
-                       action: "viewChangelogs",
-                       disabled: (): true =>true,
+                       disabled: (us: GetResponseUser | 
Array<GetResponseUser>): boolean => Array.isArray(us),

Review Comment:
   if `multiRow` isn't `true`, the action is implicitly disabled when multiple 
rows are selected, so you shouldn't need to define this. If you do, that's a 
bug in the generic table component.



##########
experimental/traffic-portal/src/app/utils/time.ts:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+/**
+ * Takes the difference between two times (in milliseconds) and returns a 
formatted string with relative time
+ *
+ * @param delta time delta in milliseconds
+ * @returns Formatted string in the form of 'N X Ago' where X is anything 
between Seconds and Years
+ */
+export function relativeTimeString(delta: number): string {
+       const SEC = 1000;
+       const MIN = SEC * 60;
+       const HOUR = MIN * 60;
+       const DAY = HOUR * 24;
+       const YEAR = 365 * DAY;
+       const MONTH = YEAR / 12;
+       const WEEK = MONTH / 4;

Review Comment:
   This probably doesn't really have any performance impact at all, but I'd 
define these outside the function so they aren't recalculated every time it's 
called. Do it or don't, just wanted to point it out.



##########
experimental/traffic-portal/src/app/api/testing/index.ts:
##########
@@ -17,7 +17,7 @@ import { NgModule } from "@angular/core";
 
 import {
        CacheGroupService,
-       CDNService,
+       CDNService, ChangeLogsService,

Review Comment:
   nit: this should be on the next line



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