Skip to content
Snippets Groups Projects
Commit c926bae2 authored by Max Frederiksen's avatar Max Frederiksen
Browse files

Refactor to include AbortError

parent 0ccc4395
No related branches found
No related tags found
2 merge requests!542Prepare 4.1.0,!531CE-3097: Error fallback for console stream + fix undefined loading variable
Pipeline #196579 passed
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
formatDateAndTime formatDateAndTime
} from "@ess-ics/ce-ui-common"; } from "@ess-ics/ce-ui-common";
import Convert from "ansi-to-html"; import Convert from "ansi-to-html";
import { getErrorMessage } from "../Helper";
const TIME_RANGE_VALUES = [ const TIME_RANGE_VALUES = [
{ {
...@@ -237,19 +238,20 @@ export function LokiPanel({ hostName, iocName, isSyslog, isDeployed }) { ...@@ -237,19 +238,20 @@ export function LokiPanel({ hostName, iocName, isSyslog, isDeployed }) {
return sysLogData || procServLog; return sysLogData || procServLog;
}; };
const hasLogError = sysLogError?.error || procServLogError?.error; const isAbortError =
(sysLogError && sysLogError?.name === "AbortError") ||
(procServLogError && procServLogError?.name === "AbortError");
const logError = sysLogError || procServLogError; const logError = sysLogError || procServLogError;
const logDataReceived = sysLogData || procServLog || !isDeployed; const hasLogData = !!sysLogData || !!procServLog || !isDeployed;
const hasLogError = !isAbortError && !!logError;
if (hasLogError) { if (hasLogError) {
return ( getProcServLogAbort();
<Alert severity="error"> getSysLogDataAbort();
{logError?.error}: {logError?.description} return <Alert severity="error">{getErrorMessage(logError)}</Alert>;
</Alert>
);
} }
if (!logDataReceived) { if (!hasLogData && !hasLogError) {
return ( return (
<div style={{ width: "100%" }}> <div style={{ width: "100%" }}>
<LinearProgress color="primary" /> <LinearProgress color="primary" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment