);
}
diff --git a/src/components/services/status.jsx b/src/components/services/status.jsx
index 7adc912dbab..da120ce235a 100644
--- a/src/components/services/status.jsx
+++ b/src/components/services/status.jsx
@@ -17,13 +17,13 @@ export default function Status({ service, style }) {
} else if (data) {
if (data.status?.includes("running")) {
if (data.health === "starting") {
- statusTitle = t("docker.starting");
- colorClass = "text-blue-500/80";
+ statusTitle = t("docker.starting");
+ colorClass = "text-blue-500/80";
}
if (data.health === "unhealthy") {
- statusTitle = t("docker.unhealthy");
- colorClass = "text-orange-400/50 dark:text-orange-400/80";
+ statusTitle = t("docker.unhealthy");
+ colorClass = "text-orange-400/50 dark:text-orange-400/80";
}
if (!data.health) {
@@ -35,27 +35,31 @@ export default function Status({ service, style }) {
statusTitle = statusLabel;
colorClass = "text-emerald-500/80";
}
-
+
if (data.status === "not found" || data.status === "exited" || data.status?.startsWith("partial")) {
- if (data.status === "not found") statusLabel = t("docker.not_found")
- else if (data.status === "exited") statusLabel = t("docker.exited")
- else statusLabel = data.status.replace("partial", t("docker.partial"))
+ if (data.status === "not found") statusLabel = t("docker.not_found");
+ else if (data.status === "exited") statusLabel = t("docker.exited");
+ else statusLabel = data.status.replace("partial", t("docker.partial"));
colorClass = "text-orange-400/50 dark:text-orange-400/80";
}
}
- if (style === 'dot') {
- colorClass = colorClass.replace(/text-/g, 'bg-').replace(/\/\d\d/g, '');
+ if (style === "dot") {
+ colorClass = colorClass.replace(/text-/g, "bg-").replace(/\/\d\d/g, "");
backgroundClass = "p-4 hover:bg-theme-500/10 dark:hover:bg-theme-900/20";
statusTitle = statusLabel;
}
return (
-
- {style !== 'dot' ?
-
{statusLabel}
:
-
- }
+
+ {style !== "dot" ? (
+
{statusLabel}
+ ) : (
+
+ )}
);
}
diff --git a/src/components/services/widget/block.jsx b/src/components/services/widget/block.jsx
index a2189cf6cdb..151a1911649 100644
--- a/src/components/services/widget/block.jsx
+++ b/src/components/services/widget/block.jsx
@@ -9,7 +9,7 @@ export default function Block({ value, label }) {
className={classNames(
"bg-theme-200/50 dark:bg-theme-900/20 rounded m-1 flex-1 flex flex-col items-center justify-center text-center p-1",
value === undefined ? "animate-pulse" : "",
- "service-block"
+ "service-block",
)}
>
{value === undefined || value === null ? "-" : value}
diff --git a/src/components/services/widget/container.jsx b/src/components/services/widget/container.jsx
index 9145465f843..fbb6c79f172 100644
--- a/src/components/services/widget/container.jsx
+++ b/src/components/services/widget/container.jsx
@@ -12,14 +12,14 @@ export default function Container({ error = false, children, service }) {
return null;
}
- return
+ return
;
}
const childrenArray = Array.isArray(children) ? children : [children];
let visibleChildren = childrenArray;
let fields = service?.widget?.fields;
- if (typeof fields === 'string') fields = JSON.parse(service.widget.fields);
+ if (typeof fields === "string") fields = JSON.parse(service.widget.fields);
const type = service?.widget?.type;
if (fields && type) {
// if the field contains a "." then it most likely contains a common loc value
@@ -27,13 +27,15 @@ export default function Container({ error = false, children, service }) {
// fields: [ "resources.cpu", "resources.mem", "field"]
// or even
// fields: [ "resources.cpu", "widget_type.field" ]
- visibleChildren = childrenArray?.filter(child => fields.some(field => {
- let fullField = field;
- if (!field.includes(".")) {
- fullField = `${type}.${field}`;
- }
- return fullField === child?.props?.label;
- }));
+ visibleChildren = childrenArray?.filter((child) =>
+ fields.some((field) => {
+ let fullField = field;
+ if (!field.includes(".")) {
+ fullField = `${type}.${field}`;
+ }
+ return fullField === child?.props?.label;
+ }),
+ );
}
return
{visibleChildren}
;
diff --git a/src/components/services/widget/error.jsx b/src/components/services/widget/error.jsx
index cf5e136612b..81423b3f24a 100644
--- a/src/components/services/widget/error.jsx
+++ b/src/components/services/widget/error.jsx
@@ -6,7 +6,7 @@ function displayError(error) {
}
function displayData(data) {
- return (data.type === 'Buffer') ? Buffer.from(data).toString() : JSON.stringify(data, 4);
+ return data.type === "Buffer" ? Buffer.from(data).toString() : JSON.stringify(data, 4);
}
export default function Error({ error }) {
@@ -20,29 +20,34 @@ export default function Error({ error }) {
- {t("widget.api_error")} {error.message && t("widget.information")}
+
+ {t("widget.api_error")} {error.message && t("widget.information")}
- {error.message && -
- {t("widget.api_error")}: {error.message}
-
}
- {error.url && -
- {t("widget.url")}: {error.url}
-
}
- {error.rawError && -
- {t("widget.raw_error")}:
-
- {displayError(error.rawError)}
-
- }
- {error.data && -
- {t("widget.response_data")}:
-
- {displayData(error.data)}
-
- }
+ {error.message && (
+ -
+ {t("widget.api_error")}: {error.message}
+
+ )}
+ {error.url && (
+ -
+ {t("widget.url")}: {error.url}
+
+ )}
+ {error.rawError && (
+ -
+ {t("widget.raw_error")}:
+
{displayError(error.rawError)}
+
+ )}
+ {error.data && (
+ -
+ {t("widget.response_data")}:
+
{displayData(error.data)}
+
+ )}
diff --git a/src/components/tab.jsx b/src/components/tab.jsx
index e47f21af7ca..bba35977da6 100644
--- a/src/components/tab.jsx
+++ b/src/components/tab.jsx
@@ -4,28 +4,37 @@ import classNames from "classnames";
import { TabContext } from "utils/contexts/tab";
export function slugify(tabName) {
- return tabName !== undefined ? encodeURIComponent(tabName.toString().replace(/\s+/g, '-').toLowerCase()) : ''
+ return tabName !== undefined ? encodeURIComponent(tabName.toString().replace(/\s+/g, "-").toLowerCase()) : "";
}
export default function Tab({ tab }) {
const { activeTab, setActiveTab } = useContext(TabContext);
return (
-
-
+
+
);
}
diff --git a/src/components/toggles/color.jsx b/src/components/toggles/color.jsx
index d65d53915d1..20fb26fcb6f 100644
--- a/src/components/toggles/color.jsx
+++ b/src/components/toggles/color.jsx
@@ -65,7 +65,7 @@ export default function ColorToggle() {
title={color}
className={classNames(
active === color ? "border-2" : "border-0",
- `rounded-md w-5 h-5 border-black/50 dark:border-white/50 theme-${color} bg-theme-400`
+ `rounded-md w-5 h-5 border-black/50 dark:border-white/50 theme-${color} bg-theme-400`,
)}
/>
{color}
diff --git a/src/components/version.jsx b/src/components/version.jsx
index 4abf21a41f9..d2652f96510 100644
--- a/src/components/version.jsx
+++ b/src/components/version.jsx
@@ -6,9 +6,11 @@ import { MdNewReleases } from "react-icons/md";
export default function Version() {
const { t, i18n } = useTranslation();
- const buildTime = process.env.NEXT_PUBLIC_BUILDTIME?.length ? process.env.NEXT_PUBLIC_BUILDTIME : new Date().toISOString();
+ const buildTime = process.env.NEXT_PUBLIC_BUILDTIME?.length
+ ? process.env.NEXT_PUBLIC_BUILDTIME
+ : new Date().toISOString();
const revision = process.env.NEXT_PUBLIC_REVISION?.length ? process.env.NEXT_PUBLIC_REVISION : "dev";
- const version = process.env.NEXT_PUBLIC_VERSION?.length ? process.env.NEXT_PUBLIC_VERSION : "dev";
+ const version = process.env.NEXT_PUBLIC_VERSION?.length ? process.env.NEXT_PUBLIC_VERSION : "dev";
const { data: releaseData } = useSWR("api/releases");
@@ -44,7 +46,8 @@ export default function Version() {
{version === "main" || version === "dev" || version === "nightly"
? null
- : releaseData && latestRelease &&
+ : releaseData &&
+ latestRelease &&
compareVersions(latestRelease.tag_name, version) > 0 && (
+ return
;
}
if (!data) {
- return
- { options.cpu !== false && }
- { options.mem !== false && }
- { options.cputemp && }
- { options.disk && !Array.isArray(options.disk) && }
- { options.disk && Array.isArray(options.disk) && options.disk.map((disk) => ) }
- { options.uptime && }
- { options.label && }
- ;
+ return (
+
+ {options.cpu !== false && }
+ {options.mem !== false && }
+ {options.cputemp && }
+ {options.disk && !Array.isArray(options.disk) && (
+
+ )}
+ {options.disk &&
+ Array.isArray(options.disk) &&
+ options.disk.map((disk) => (
+
+ ))}
+ {options.uptime && }
+ {options.label && }
+
+ );
}
const unit = options.units === "imperial" ? "fahrenheit" : "celsius";
let mainTemp = 0;
let maxTemp = 80;
- const cpuSensors = data.sensors?.filter(s => cpuSensorLabels.some(label => s.label.startsWith(label)) && s.type === "temperature_core");
+ const cpuSensors = data.sensors?.filter(
+ (s) => cpuSensorLabels.some((label) => s.label.startsWith(label)) && s.type === "temperature_core",
+ );
if (options.cputemp && cpuSensors) {
try {
mainTemp = cpuSensors.reduce((acc, s) => acc + s.value, 0) / cpuSensors.length;
- maxTemp = Math.max(cpuSensors.reduce((acc, s) => acc + (s.warning > 0 ? s.warning : 0), 0) / cpuSensors.length, maxTemp);
+ maxTemp = Math.max(
+ cpuSensors.reduce((acc, s) => acc + (s.warning > 0 ? s.warning : 0), 0) / cpuSensors.length,
+ maxTemp,
+ );
if (unit === "fahrenheit") {
mainTemp = convertToFahrenheit(mainTemp);
maxTemp = convertToFahrenheit(maxTemp);
@@ -70,48 +84,53 @@ export default function Widget({ options }) {
: [data.fs.find((d) => d.mnt_point === options.disk)].filter((d) => d);
}
- const addedClasses = classNames('information-widget-glances', { 'expanded': options.expanded })
+ const addedClasses = classNames("information-widget-glances", { expanded: options.expanded });
return (
- {options.cpu !== false && }
- {options.mem !== false && }
+ {options.cpu !== false && (
+
+ )}
+ {options.mem !== false && (
+
+ )}
{disks.map((disk) => (
-
))}
- {options.cputemp && mainTemp > 0 &&
+ {options.cputemp && mainTemp > 0 && (
- }
- {options.uptime && data.uptime &&
+ )}
+ {options.uptime && data.uptime && (
- }
+ )}
{options.label && }
);
diff --git a/src/components/widgets/greeting/greeting.jsx b/src/components/widgets/greeting/greeting.jsx
index ab21df25156..cd8a8af6102 100644
--- a/src/components/widgets/greeting/greeting.jsx
+++ b/src/components/widgets/greeting/greeting.jsx
@@ -14,12 +14,14 @@ const textSizes = {
export default function Greeting({ options }) {
if (options.text) {
- return
-
-
- {options.text}
-
-
- ;
+ return (
+
+
+
+ {options.text}
+
+
+
+ );
}
}
diff --git a/src/components/widgets/kubernetes/kubernetes.jsx b/src/components/widgets/kubernetes/kubernetes.jsx
index 3610ceab456..91128020449 100644
--- a/src/components/widgets/kubernetes/kubernetes.jsx
+++ b/src/components/widgets/kubernetes/kubernetes.jsx
@@ -15,52 +15,47 @@ export default function Widget({ options }) {
cpu: {
load: 0,
total: 0,
- percent: 0
+ percent: 0,
},
memory: {
used: 0,
total: 0,
free: 0,
- percent: 0
- }
+ percent: 0,
+ },
};
- const { data, error } = useSWR(
- `api/widgets/kubernetes?${new URLSearchParams({ lang: i18n.language }).toString()}`, {
- refreshInterval: 1500
- }
- );
+ const { data, error } = useSWR(`api/widgets/kubernetes?${new URLSearchParams({ lang: i18n.language }).toString()}`, {
+ refreshInterval: 1500,
+ });
if (error || data?.error) {
- return
+ return
;
}
if (!data) {
- return
+ return (
+
+
+
+ {cluster.show && }
+ {nodes.show && }
+
+
+
+ );
+ }
+
+ return (
+
- {cluster.show &&
-
- }
+ {cluster.show && }
{nodes.show &&
-
- }
+ data.nodes &&
+ data.nodes.map((node) => )}
- ;
- }
-
- return
-
-
- {cluster.show &&
-
- }
- {nodes.show && data.nodes &&
- data.nodes.map((node) =>
- )
- }
-
-
- ;
+
+ );
}
diff --git a/src/components/widgets/kubernetes/node.jsx b/src/components/widgets/kubernetes/node.jsx
index cc864be68b4..ba8f8b770e8 100644
--- a/src/components/widgets/kubernetes/node.jsx
+++ b/src/components/widgets/kubernetes/node.jsx
@@ -8,7 +8,6 @@ import UsageBar from "../resources/usage-bar";
export default function Node({ type, options, data }) {
const { t } = useTranslation();
-
function icon() {
if (type === "cluster") {
return
;
@@ -31,7 +30,7 @@ export default function Node({ type, options, data }) {
value: data?.cpu?.percent ?? 0,
style: "unit",
unit: "percent",
- maximumFractionDigits: 0
+ maximumFractionDigits: 0,
})}
@@ -42,14 +41,16 @@ export default function Node({ type, options, data }) {
{t("common.bytes", {
value: data?.memory?.free ?? 0,
maximumFractionDigits: 0,
- binary: true
+ binary: true,
})}