Files
nezha-dash-v1/index.html
T
2d46fb6b86 fix: support per-server max/from/to in cycle transfer stats (#64)
* Initial plan

* fix: support per-server max/from/to values in cycle transfer stats

When the Nezha backend has multiple transfer rules within one alert rule,
the API may return per-server max values (as a map) instead of a single
max value. Update the TypeScript interface and CycleTransferStats component
to handle both formats:
- Single value (number/string): used for all servers (current behavior)
- Per-server map ({[serverId]: value}): uses the correct value per server

Fixes #63

Agent-Logs-Url: https://github.com/hamster1963/nezha-dash-v2/sessions/88f98dad-c2eb-4728-ac98-e02a95d5144d

Co-authored-by: hamster1963 <71394853+hamster1963@users.noreply.github.com>

* fix: update schema version in biome.json and improve null checks in components

* chore: auto-fix linting and formatting issues

* fix: guard null/zero in CycleTransferStats per-server map lookups

Agent-Logs-Url: https://github.com/hamster1963/nezha-dash-v2/sessions/2fb2306b-8011-487d-b284-9768778db8c3

Co-authored-by: hamster1963 <71394853+hamster1963@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: hamster1963 <71394853+hamster1963@users.noreply.github.com>
Co-authored-by: hamster1963 <1410514192@qq.com>
2026-05-26 01:34:02 +08:00

128 lines
3.6 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<script>
// 在页面渲染前就执行主题初始化
try {
const storageKey = "vite-ui-theme"
let theme = localStorage.getItem(storageKey)
if (theme === "system" || !theme) {
theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
}
document.documentElement.classList.add(theme)
} catch (_e) {
document.documentElement.classList.add("light")
}
</script>
<style>
/* Prevent FOUC in Safari */
html:not(.dark):not(.light) * {
visibility: hidden;
}
:root {
color-scheme: light;
--bg: #ffffff;
}
html.dark {
color-scheme: dark;
--bg: #242424;
}
html.light {
color-scheme: light;
--bg: #ffffff;
}
html {
background-color: var(--bg);
}
body {
background-color: var(--bg);
}
#root {
background-color: var(--bg);
visibility: hidden;
}
#root.loaded {
visibility: visible;
animation: fadein 0.2s;
}
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>
<script>
;(() => {
const storageKey = "vite-ui-theme"
const theme = localStorage.getItem(storageKey) || "system"
const root = document.documentElement
function updateThemeColor(isDark) {
const themeColor = isDark ? "#242424" : "#fafafa"
document.querySelector('meta[name="theme-color"]')?.setAttribute("content", themeColor)
}
function setTheme(newTheme) {
root.classList.remove("light", "dark")
root.classList.add(newTheme)
updateThemeColor(newTheme === "dark")
}
if (theme === "system") {
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
setTheme(systemTheme)
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
setTheme(e.matches ? "dark" : "light")
})
} else {
setTheme(theme)
}
// Add loaded class after React has mounted
window.addEventListener("load", () => {
const root = document.getElementById("root")
if (root) {
// 使用 RAF 确保在下一帧渲染
requestAnimationFrame(() => {
requestAnimationFrame(() => {
root.classList.add("loaded")
})
})
}
})
})()
</script>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/apple-touch-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>哪吒监控 Nezha Monitoring</title>
<!-- PWA -->
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="hsl(0 0% 98%)" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<meta name="apple-mobile-web-app-title" content="Nezha Monitoring" />
<link rel="apple-touch-icon" href="/android-chrome-192x192.png" />
<link rel="stylesheet" href="https://fastly.jsdelivr.net/gh/lipis/flag-icons@7.0.0/css/flag-icons.min.css" />
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/font-logos@1/assets/font-logos.css" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>