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


##########
experimental/traffic-portal/src/app/api/testing/server.service.ts:
##########
@@ -302,4 +303,55 @@ export class ServerService {
                srv.statusId = status.id;
                srv.offlineReason = offlineReason ?? null;
        }
+
+       /**
+        * Creates a status.
+        *
+        * @param status The status details (name & description) to create. 
Description is an optional property in status.
+        * @returns The status as created and returned by the API.
+        */
+       public async createStatus(status: RequestStatus): 
Promise<ResponseStatus> {
+               const newStatus = {
+                       description: status.description ? status.description : 
null,
+                       id: ++this.statusIdCounter,
+                       lastUpdated: new Date(),
+                       name: status.name
+               };
+               this.statuses.push(newStatus);
+               return newStatus;
+       }
+
+       /**
+        * Updates status Details.
+        *
+        * @param payload containes name and description for the status., 
unique identifier thereof.
+        * @param id The Status ID
+        */
+       public async updateStatusDetail(payload: ResponseStatus, id: number): 
Promise<ResponseStatus> {

Review Comment:
   This testing service method's call signature is not assignable to the 
"concrete" service method's signature, but in order for the testing services to 
work properly as drop-in replacements for their "concrete" counterparts, their 
call signatures must match.



##########
experimental/traffic-portal/src/app/api/server.service.ts:
##########
@@ -186,4 +187,33 @@ export class ServerService extends APIService {
 
                return this.put(`servers/${id}/status`, {offlineReason, 
status}).toPromise();
        }
+
+       /**
+        * Creating new Status.
+        *
+        * @param status The status to create.
+        * @returns The created status.
+        */
+       public async createStatus(status: RequestStatus): 
Promise<ResponseStatus> {
+               return this.post<ResponseStatus>("statuses", 
status).toPromise();
+       }
+
+       /**
+        * Updates status Details.
+        *
+        * @param status The status to update.
+        * @returns The updated status.
+        */
+       public async updateStatusDetail(status: ResponseStatus): 
Promise<ResponseStatus> {
+               return this.put<ResponseStatus>(`statuses/${status.id}`, 
status).toPromise();
+       }
+
+       /**
+        * Deletes an existing Status.
+        *
+        * @param id The Status ID
+        */
+       public async deleteStatus(id: number): Promise<ResponseStatus> {

Review Comment:
   this should also accept a `ResponseStatus` like most other similar API 
methods.



##########
experimental/traffic-portal/src/app/core/core.module.ts:
##########
@@ -128,10 +132,12 @@ export const ROUTES: Routes = [
                RegionsTableComponent,
                RegionDetailComponent,
                CacheGroupDetailsComponent,
-               CoordinatesTableComponent,
-               CoordinateDetailComponent,
                TypesTableComponent,
                TypeDetailComponent,
+               CoordinatesTableComponent,
+               CoordinateDetailComponent,

Review Comment:
   Coordinates components don't need to be moved, do they?



##########
experimental/traffic-portal/src/app/core/statuses/status-details/status-details.component.html:
##########
@@ -0,0 +1,43 @@
+<!--
+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.
+-->
+<mat-card class="statuses-details">
+    <tp-loading *ngIf="loading"></tp-loading>
+    <form [formGroup]="statusDetailsForm" (ngSubmit)="onSubmit($event)" 
*ngIf="!loading">
+        <mat-card-content>
+            <mat-form-field *ngIf="!new">
+                               <mat-label>ID</mat-label>
+                               <input matInput type="text" name="id" disabled 
readonly [defaultValue]="statusDetails.id" />
+                       </mat-form-field>
+            <mat-form-field>
+                <mat-label>Name</mat-label>
+                <input matInput type="text" name="name" required 
formControlName="name">
+            </mat-form-field>
+            <mat-form-field>
+                <mat-label>Description</mat-label>
+                <input matInput type="text" name="description" 
formControlName="description">
+            </mat-form-field>
+            <mat-form-field *ngIf="!new">
+                               <mat-label>Last Updated</mat-label>
+                               <input matInput type="text" name="lastUpdated" 
disabled readonly [defaultValue]="statusDetails.lastUpdated" />
+                       </mat-form-field>
+        </mat-card-content>
+        <mat-card-actions align="end">
+            <button mat-raised-button type="button" color="warn" 
(click)="deleteStatus()" *ngIf="!new">Delete</button>
+            <button mat-raised-button type="button" 
routerLink="/core/statuses">Cancel</button>
+            <button mat-raised-button type="submit" color="primary">
+                {{new ? 'Create' : 'Save'}}
+            </button>
+        </mat-card-actions>
+    </form>
+</mat-card>

Review Comment:
   the indentation in this file is inconsistent in matching open/closing tag 
indentation level, indentation size, and spaces vs real indentation. I don't 
believe the template parser plugin supports an indentation rule, otherwise that 
would be enforced as `["error", "tab"]` just like in the TypeScript code.



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