From: Jérôme Benoit Date: Sun, 4 Sep 2022 20:54:44 +0000 (+0200) Subject: UI protocol: Include failed responses X-Git-Tag: v1.1.71~12 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f53c88d034b52b702f258174713e2952fa6df397;p=e-mobility-charging-stations-simulator.git UI protocol: Include failed responses Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/UIServiceWorkerBroadcastChannel.ts b/src/charging-station/UIServiceWorkerBroadcastChannel.ts index c556b26c..7e4cc877 100644 --- a/src/charging-station/UIServiceWorkerBroadcastChannel.ts +++ b/src/charging-station/UIServiceWorkerBroadcastChannel.ts @@ -81,6 +81,16 @@ export default class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChan }) .filter((hashId) => hashId !== undefined), }), + ...(responsesStatus === ResponseStatus.FAILURE && { + responsesFailed: this.responses + .get(uuid) + ?.responses.map((response) => { + if (response.status === ResponseStatus.FAILURE) { + return response; + } + }) + .filter((response) => response !== undefined), + }), }; } diff --git a/src/types/UIProtocol.ts b/src/types/UIProtocol.ts index ab46f035..0e4fb77a 100644 --- a/src/types/UIProtocol.ts +++ b/src/types/UIProtocol.ts @@ -1,4 +1,5 @@ import type { JsonObject } from './JsonType'; +import type { BroadcastChannelResponsePayload } from './WorkerBroadcastChannel'; export enum Protocol { UI = 'ui', @@ -53,4 +54,5 @@ export interface ResponsePayload extends JsonObject { status: ResponseStatus; hashIdsSucceeded?: string[]; hashIdsFailed?: string[]; + responsesFailed?: BroadcastChannelResponsePayload[]; }