diff --git a/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts b/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts index 2742d8a7..8f35d3ac 100644 --- a/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts +++ b/admin-ui/src/app/features/packet-status/packet-status/packet-status.component.ts @@ -61,38 +61,29 @@ export class PacketStatusComponent implements OnInit { this.error = true; } else { this.error = false; - this.dataStorageService - .getPacketStatus( - this.id, - this.headerService.getUserPreferredLanguage() - ) - .subscribe(response => { - if (response['errors']) { - this.error = true; - this.statusCheck = ''; - this.errorMessage = - this.serverMessage[response['errors'][0].errorCode]; - } else { - this.data = response['response']['packetStatusUpdateList']; + this.dataStorageService.getPacketStatus(this.id, this.headerService.getUserPreferredLanguage()).subscribe(response => { + if (response['errors']) { + this.error = true; + this.statusCheck = ''; + this.errorMessage = this.serverMessage[response['errors'][0].errorCode]; + } else{ + this.data = response['response']['packetStatusUpdateList']; + for (let i = 0 ; i < this.data.length; i++) { + if (this.data[i].statusCode.includes('FAILED')) { + this.statusCheck = this.messages.statuscheckFailed; + break; + } else { + this.statusCheck = this.messages.statuscheckCompleted; + } this.error = false; this.showDetails = true; - if (this.data && this.data.length > 0) { - const latestStatus = - this.data[this.data.length - 1].statusCode; - if (latestStatus.includes('FAILED')) { - this.statusCheck = - this.messages.statuscheckFailed; - } else { - this.statusCheck = - this.messages.statuscheckCompleted; - } - } } - }); + } + }); } } viewMore() { this.showTimeline = !this.showTimeline; } -} +} \ No newline at end of file