From 9ed390830a1e5065a293fbca52bab338af3aecbb Mon Sep 17 00:00:00 2001 From: jinghui <181050043@qq.com> Date: Tue, 27 Oct 2026 09:10:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89=E5=8F=8C=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=9D=A1=EF=BC=9B=E9=A1=B6=E6=A0=8F=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BC=80=E6=BA=90=E5=9C=B0=E5=9D=80=E4=B8=8E=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E7=AB=99=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ README.md | 4 ++++ public/app.js | 25 +++++++++++++++++++++++++ public/index.html | 1 + public/style.css | 10 ++++++++-- server/index.js | 2 ++ 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f2b7f5..6abee27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # 更新日志 +## 2026-10-27 → 🔧 修掉双滚动条 + 顶栏加「开源地址 / 导航站」 + +- 🔧 双滚动条:外层 `html,body` 改为 `overflow:hidden`、`.app` 由 `height:100vh` 改为 `height:100%`,滚动只由 `#view` 承担;实测 `innerWidth - clientWidth = 0`(外层无滚动条),页内仅 1 个滚动条 +- ✨ 顶栏右上新增两个链接按钮:**开源地址**(默认 `http://<当前主机>:3200/jinghui/docker-center`)与**导航站**(默认 `http://<当前主机>:10788`),新窗口打开 +- ✨ 两个地址可在「告警设置」页修改(`links.repo` / `links.nav`,存 `data/settings.json`),留空则用默认值 +- 🔧 顺带修正:`返回概览` 按钮此前被批量替换误伤,已恢复为 `go('apps')` +- ✅ 实测:顶栏两按钮 85×28 / 73×28 显示正常、顶栏无溢出;逐页切换(容器/镜像/网络/备份/设置/概览)无报错 + ## 2026-10-27 → ✨ 网络页新增顶栏「新建网络」按钮 - ✨ 网络页右上角新增「新建网络」按钮(原来只有页内表单),点开弹窗填写网络名/驱动/子网/网关/内部网络,创建后列表即时刷新 diff --git a/README.md b/README.md index a569526..73b7ca0 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ Docker 自带面板和 Portainer 都是按「容器」管理:六十多个容 - 在容器抽屉或应用详情页给应用设 CPU(核)与内存(MB)上限,走 Docker cgroup 硬限制;应用级一次对全部容器生效,行内显示 `限 0.3核/96M` 角标;限制值持久化在 `data/limits.json` +**顶栏外链** + +- 右上角「开源地址 / 导航站」两个按钮,默认指向本机 Gitea 仓库与 BestNav;可在告警设置页改成自己的地址 + **告警** - CPU/内存阈值、Webhook 推送、同应用去重间隔、测试推送 diff --git a/public/app.js b/public/app.js index 250d849..01a3fac 100644 --- a/public/app.js +++ b/public/app.js @@ -133,6 +133,7 @@ const SORTS = { containers: [['created', '最新安装'], ['cpu', 'CPU 占用'], ['mem', '内存占用'], ['net', '网络速率'], ['io', '磁盘 IO'], ['pids', '进程数'], ['name', '名称']], stopped: [['created', '最新安装'], ['name', '名称'], ['mem', '内存占用']], }; +document.addEventListener('DOMContentLoaded', () => renderExtLinks()); function go(view) { if (state.view !== view && state.sel) state.sel.clear(); state.view = view; @@ -162,6 +163,25 @@ function go(view) { paintPauseBtn(); } + +/* 顶栏:开源地址 / 导航站 */ +async function renderExtLinks() { + const box = document.getElementById('extLinks'); + if (!box) return; + const host = location.hostname || 'localhost'; + let repo = `http://${host}:3200/jinghui/docker-center`; + let nav = `http://${host}:10788`; + try { + const s = await api('/api/settings'); + if (s.links && s.links.repo) repo = s.links.repo; + if (s.links && s.links.nav) nav = s.links.nav; + } catch (e) {} + const icon = (d) => ``; + box.innerHTML = ` + ${icon('M3 12h18M12 3v18')}开源地址 + ${icon('M4 6h16M4 12h16M4 18h10')}导航站`; +} + async function render(silent) { const scY = window.scrollY || 0; const viewEl = document.getElementById('view'); @@ -1444,6 +1464,9 @@ async function renderSettings() {
分钟
+
+
+
这两项会显示在右上角,留空则用默认地址(本机的 Gitea 仓库与 BestNav 导航站)
容器未运行、健康检查失败、重启次数增加、超过资源阈值时产生事件;「异常」级事件按上面的间隔去重后推送到 webhook(POST JSON:title / level / app / detail / time / host)。
@@ -1460,6 +1483,7 @@ async function renderSettings() { thresholds: { cpu: Number($('#th_cpu').value), mem: Number($('#th_mem').value) }, debounceMinutes: Number($('#th_debounce').value), webhook: $('#th_webhook').value, + links: { repo: $('#th_repo') ? $('#th_repo').value.trim() : '', nav: $('#th_nav') ? $('#th_nav').value.trim() : '' }, notify: $('#th_notify').checked, }), }); @@ -1581,4 +1605,5 @@ $('#modalMask').onclick = () => $('#modal').classList.add('hidden'); document.addEventListener('keydown', e => { if (e.key === 'Escape') { $('#modal').classList.add('hidden'); $('#drawer').classList.add('hidden'); } }); paintIcons(); +renderExtLinks(); go('apps'); diff --git a/public/index.html b/public/index.html index c15ba01..68014af 100644 --- a/public/index.html +++ b/public/index.html @@ -60,6 +60,7 @@
+ diff --git a/public/style.css b/public/style.css index 192df1c..fc2a956 100644 --- a/public/style.css +++ b/public/style.css @@ -4,9 +4,9 @@ --radius:10px; --shadow:0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06); } *{box-sizing:border-box} -html,body{overflow-x:hidden;margin:0;height:100%} +html,body{overflow:hidden;margin:0;height:100%} body{background:var(--bg);color:var(--text);font:14px/1.5 -apple-system,"PingFang SC","Microsoft YaHei",Segoe UI,Roboto,sans-serif} -.app{display:flex;height:100vh;overflow:hidden} +.app{display:flex;height:100%;overflow:hidden;min-height:0} a{color:var(--blue);text-decoration:none;cursor:pointer} .muted{color:var(--muted);font-size:12px} @@ -407,3 +407,9 @@ table.tb th.num{text-align:right} .row .inst{flex-shrink:0;width:76px;text-align:right;line-height:1.3} .row .inst .k{display:block;font-size:10.5px;color:#9aa4b5} .row .inst .v{display:block;font-size:11.5px;color:#3d4859;font-variant-numeric:tabular-nums} + +/* 顶栏外部链接 */ +.ext-links{display:flex;gap:6px;align-items:center} +.ext-links a{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 9px;border:1px solid #dfe6ef;border-radius:8px;font-size:12px;color:#5a6b82;background:#fff;white-space:nowrap} +.ext-links a:hover{border-color:#c9d5e4;background:#f5f8fc;color:#1a5fbf} +.ext-links a svg{width:13px;height:13px} diff --git a/server/index.js b/server/index.js index 1a1f525..e066a3b 100644 --- a/server/index.js +++ b/server/index.js @@ -39,6 +39,7 @@ const DEFAULT_SETTINGS = { webhook: '', notify: true, debounceMinutes: 10, + links: { repo: '', nav: '' }, }; let settings = JSON.parse(JSON.stringify(DEFAULT_SETTINGS)); try { @@ -935,6 +936,7 @@ app.post('/api/settings', (req, res) => { webhook: b.webhook !== undefined ? String(b.webhook).trim() : settings.webhook, notify: b.notify !== undefined ? !!b.notify : settings.notify, debounceMinutes: b.debounceMinutes !== undefined ? (Number(b.debounceMinutes) || 10) : settings.debounceMinutes, + links: { ...(settings.links || {}), ...(b.links || {}) }, }; saveSettings(); res.json(settings);