From f53c88d034b52b702f258174713e2952fa6df397 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 4 Sep 2022 22:54:44 +0200 Subject: [PATCH] UI protocol: Include failed responses MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../UIServiceWorkerBroadcastChannel.ts | 10 ++++++++++ src/types/UIProtocol.ts | 2 ++ 2 files changed, 12 insertions(+) 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[]; } -- 2.34.1