ocket8888 commented on code in PR #7358:
URL: https://github.com/apache/trafficcontrol/pull/7358#discussion_r1176805321
##########
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 | ResponseStatus):
Promise<ResponseStatus> {
+ return
this.delete<ResponseStatus>(`statuses/${id}`).toPromise();
+ }
Review Comment:
This method won't work for all call signatures; if you pass in a
`ResponseStatus` it will attempt to use the API endpoint
`/statuses/%5Bobject%20Object%5D` which does not exist because
`%5Bobject%20Object%5D` is not a valid Status ID.
--
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]