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


##########
experimental/traffic-portal/src/app/core/parameters/table/parameters-table.component.ts:
##########
@@ -56,7 +56,7 @@ export class ParametersTableComponent implements OnInit {
                {
                        field: "profiles",
                        headerName: "Profiles",
-                       valueFormatter: ({data}: {data: ResponseParameter}): 
string => `${data.profiles}`
+                       valueFormatter: ({data}: {data: ResponseParameter}): 
string => `${data.profiles}`.replace(",", ", ")

Review Comment:
   So, this doesn't actually work.
   
![image](https://github.com/apache/trafficcontrol/assets/6013378/9f535cd8-687d-422f-b9d8-67369730aab9)
   
   `.replace` only replaces the first occurrence when its first argument is a 
string. If its first argument has a `Symbol.replace` property that has the 
`function` type, then it will call that - the classic example is a regular 
expression, which (with the `/g` global flag set) _can_ be used to replace more 
than one instance of something. Or you could try to use `replaceAll`, but 
browser support is spotty.
   
   All this to say, I really think you should just literally use 
`data.profiles.join(", ")`
   



##########
experimental/traffic-portal/src/app/api/testing/profile.service.ts:
##########
@@ -282,12 +282,12 @@ export class ProfileService {
        public async createParameter(parameter: RequestParameter): 
Promise<ResponseParameter> {
                const t = {
                        ...parameter,
-                       configFile: "cfg.txt",
+                       configFile: parameter.configFile,
                        id: ++this.lastParamID,
                        lastUpdated: new Date(),
                        profiles: [],
-                       secure: false,
-                       value: "100"
+                       secure: parameter.secure,
+                       value: parameter.value ?? ""
                };

Review Comment:
   So, I think you're misunderstanding what this is doing and you copy/pasted 
it. `...` is an expansion, with arrays it lays out each member as an argument, 
with objects it does the same thing with properties. For example:
   
![image](https://github.com/apache/trafficcontrol/assets/6013378/9e2fbb14-6387-4baf-a71b-b1bd1a800e06)
   
   So you don't need the secure, value, or configFile properties at all.



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