mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-16 09:49:49 +00:00
Feature: true ping, rename old ping to siteMonitor (#2215)
This commit is contained in:
parent
0c8c759f8a
commit
792f768a7f
12 changed files with 206 additions and 48 deletions
|
@ -9,7 +9,7 @@ export default function Ping({ group, service, style }) {
|
|||
|
||||
let colorClass = "text-black/20 dark:text-white/40 opacity-20";
|
||||
let backgroundClass = "bg-theme-500/10 dark:bg-theme-900/50 px-1.5 py-0.5";
|
||||
let statusTitle = t("ping.http_status");
|
||||
let statusTitle = t("ping.ping");
|
||||
let statusText = "";
|
||||
|
||||
if (error) {
|
||||
|
@ -19,18 +19,13 @@ export default function Ping({ group, service, style }) {
|
|||
} else if (!data) {
|
||||
statusText = t("ping.ping");
|
||||
statusTitle += ` ${t("ping.not_available")}`;
|
||||
} else if (data.status > 403) {
|
||||
} else if (!data.alive) {
|
||||
colorClass = "text-rose-500/80";
|
||||
statusTitle += ` ${data.status}`;
|
||||
|
||||
if (style === "basic") {
|
||||
statusText = t("ping.down");
|
||||
} else {
|
||||
statusText = data.status;
|
||||
}
|
||||
} else if (data) {
|
||||
const ping = t("common.ms", { value: data.latency, style: "unit", unit: "millisecond", maximumFractionDigits: 0 });
|
||||
statusTitle += ` ${data.status} (${ping})`;
|
||||
statusTitle += ` ${t("ping.down")}`;
|
||||
statusText = t("ping.down");
|
||||
} else if (data.alive) {
|
||||
const ping = t("common.ms", { value: data.time, style: "unit", unit: "millisecond", maximumFractionDigits: 0 });
|
||||
statusTitle += ` ${t("ping.up")} (${ping})`;
|
||||
colorClass = "text-emerald-500/80";
|
||||
|
||||
if (style === "basic") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue