From c926bae281e5b971708f199632954c8382235908 Mon Sep 17 00:00:00 2001 From: Max Frederiksen <maxfrederiksen@Maxs-MacBook-Air.local> Date: Tue, 27 Aug 2024 14:28:14 +0200 Subject: [PATCH] Refactor to include AbortError --- src/components/common/Loki/LokiPanel.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/common/Loki/LokiPanel.js b/src/components/common/Loki/LokiPanel.js index cccc3b11..477f2a41 100644 --- a/src/components/common/Loki/LokiPanel.js +++ b/src/components/common/Loki/LokiPanel.js @@ -13,6 +13,7 @@ import { formatDateAndTime } from "@ess-ics/ce-ui-common"; import Convert from "ansi-to-html"; +import { getErrorMessage } from "../Helper"; const TIME_RANGE_VALUES = [ { @@ -237,19 +238,20 @@ export function LokiPanel({ hostName, iocName, isSyslog, isDeployed }) { return sysLogData || procServLog; }; - const hasLogError = sysLogError?.error || procServLogError?.error; + const isAbortError = + (sysLogError && sysLogError?.name === "AbortError") || + (procServLogError && procServLogError?.name === "AbortError"); const logError = sysLogError || procServLogError; - const logDataReceived = sysLogData || procServLog || !isDeployed; + const hasLogData = !!sysLogData || !!procServLog || !isDeployed; + const hasLogError = !isAbortError && !!logError; if (hasLogError) { - return ( - <Alert severity="error"> - {logError?.error}: {logError?.description} - </Alert> - ); + getProcServLogAbort(); + getSysLogDataAbort(); + return <Alert severity="error">{getErrorMessage(logError)}</Alert>; } - if (!logDataReceived) { + if (!hasLogData && !hasLogError) { return ( <div style={{ width: "100%" }}> <LinearProgress color="primary" /> -- GitLab