mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-03 14:03:40 +01:00
Fix docker status error display
This commit is contained in:
parent
7c4d8a77cf
commit
f473d324df
@ -85,7 +85,7 @@ export default function Item({ service }) {
|
|||||||
{service.container && service.server && (
|
{service.container && service.server && (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
statsOpen && !statsClosing ? "max-h-[55px] opacity-100" : " max-h-[0] opacity-0",
|
statsOpen && !statsClosing ? "max-h-[110px] opacity-100" : " max-h-[0] opacity-0",
|
||||||
"w-full overflow-hidden transition-all duration-300 ease-in-out"
|
"w-full overflow-hidden transition-all duration-300 ease-in-out"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { IoAlertCircle } from "react-icons/io5";
|
import { IoAlertCircle } from "react-icons/io5";
|
||||||
import classNames from "classnames";
|
|
||||||
|
|
||||||
function displayError(error) {
|
function displayError(error) {
|
||||||
return JSON.stringify(error[1] ? error[1] : error, null, 4);
|
return JSON.stringify(error[1] ? error[1] : error, null, 4);
|
||||||
@ -12,7 +11,7 @@ function displayData(data) {
|
|||||||
|
|
||||||
export default function Error({ error }) {
|
export default function Error({ error }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
if (error?.data?.error) {
|
if (error?.data?.error) {
|
||||||
error = error.data.error; // eslint-disable-line no-param-reassign
|
error = error.data.error; // eslint-disable-line no-param-reassign
|
||||||
}
|
}
|
||||||
@ -21,24 +20,24 @@ export default function Error({ error }) {
|
|||||||
<details className="px-1 pb-1">
|
<details className="px-1 pb-1">
|
||||||
<summary className="block text-center mt-1 mb-0 mx-auto p-3 rounded bg-rose-900/80 hover:bg-rose-900/95 text-theme-900 cursor-pointer">
|
<summary className="block text-center mt-1 mb-0 mx-auto p-3 rounded bg-rose-900/80 hover:bg-rose-900/95 text-theme-900 cursor-pointer">
|
||||||
<div className="flex items-center justify-center text-xs font-bold">
|
<div className="flex items-center justify-center text-xs font-bold">
|
||||||
<IoAlertCircle className="mr-1 w-5 h-5"/>{t("widget.api_error")} {t("widget.information")}
|
<IoAlertCircle className="mr-1 w-5 h-5"/>{t("widget.api_error")} {error.message && t("widget.information")}
|
||||||
</div>
|
</div>
|
||||||
</summary>
|
</summary>
|
||||||
<div className="bg-white dark:bg-theme-200/50 mt-2 rounded text-rose-900 text-xs font-mono whitespace-pre-wrap break-all">
|
<div className="bg-white dark:bg-theme-200/50 mt-2 rounded text-rose-900 text-xs font-mono whitespace-pre-wrap break-all">
|
||||||
<ul className="p-4">
|
<ul className="p-4">
|
||||||
<li className="mb-2">
|
{error.message && <li>
|
||||||
<span className="text-black">{t("widget.api_error")}:</span> {error.message}
|
<span className="text-black">{t("widget.api_error")}:</span> {error.message}
|
||||||
</li>
|
</li>}
|
||||||
{error.url && <li className="mb-2">
|
{error.url && <li className="mt-2">
|
||||||
<span className="text-black">{t("widget.url")}:</span> {error.url}
|
<span className="text-black">{t("widget.url")}:</span> {error.url}
|
||||||
</li>}
|
</li>}
|
||||||
{error.rawError && <li className="mb-2">
|
{error.rawError && <li className="mt-2">
|
||||||
<span className="text-black">{t("widget.raw_error")}:</span>
|
<span className="text-black">{t("widget.raw_error")}:</span>
|
||||||
<div className="ml-2">
|
<div className="ml-2">
|
||||||
{displayError(error.rawError)}
|
{displayError(error.rawError)}
|
||||||
</div>
|
</div>
|
||||||
</li>}
|
</li>}
|
||||||
{error.data && <li className="mb-2">
|
{error.data && <li className="mt-2">
|
||||||
<span className="text-black">{t("widget.response_data")}:</span>
|
<span className="text-black">{t("widget.response_data")}:</span>
|
||||||
<div className="ml-2">
|
<div className="ml-2">
|
||||||
{displayData(error.data)}
|
{displayData(error.data)}
|
||||||
|
@ -46,7 +46,7 @@ export default async function handler(req, res) {
|
|||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
res.status(500).send({
|
res.status(500).send({
|
||||||
error: "unknown error",
|
error: {message: "Unknown error"},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user