Files
Unraid-AppOps-Gateway-Public/src/lib/setupContextView.ts
T

35 lines
833 B
TypeScript

export type SetupContextAlertTone = "warning" | "error";
export interface SetupContextAlert {
tone: SetupContextAlertTone;
title: string;
description: string;
retryLabel: string;
partial: boolean;
}
const partialPrefix = "Connector-bind context deels niet geladen.";
export const buildSetupContextAlert = (loadError?: string | null): SetupContextAlert | null => {
if (!loadError) return null;
const partial = loadError.startsWith(partialPrefix);
if (partial) {
return {
tone: "warning",
title: "Setup context deels geladen.",
description: loadError,
retryLabel: "Context opnieuw laden",
partial: true,
};
}
return {
tone: "error",
title: "Setup context laden mislukt.",
description: loadError,
retryLabel: "Opnieuw proberen",
partial: false,
};
};