fix: 去掉双滚动条;顶栏新增开源地址与导航站链接
This commit is contained in:
1 parent
d4548da464
commit
9ed390830a
6 files changed
+48
-2
No files matched your search
@@ -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 → ✨ 网络页新增顶栏「新建网络」按钮
|
||||
|
||||
- ✨ 网络页右上角新增「新建网络」按钮(原来只有页内表单),点开弹窗填写网络名/驱动/子网/网关/内部网络,创建后列表即时刷新
|
||||
|
||||
@@ -38,6 +38,10 @@ Docker 自带面板和 Portainer 都是按「容器」管理:六十多个容
|
||||
|
||||
- 在容器抽屉或应用详情页给应用设 CPU(核)与内存(MB)上限,走 Docker cgroup 硬限制;应用级一次对全部容器生效,行内显示 `限 0.3核/96M` 角标;限制值持久化在 `data/limits.json`
|
||||
|
||||
**顶栏外链**
|
||||
|
||||
- 右上角「开源地址 / 导航站」两个按钮,默认指向本机 Gitea 仓库与 BestNav;可在告警设置页改成自己的地址
|
||||
|
||||
**告警**
|
||||
- CPU/内存阈值、Webhook 推送、同应用去重间隔、测试推送
|
||||
|
||||
|
||||
@@ -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) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="${d}"/></svg>`;
|
||||
box.innerHTML = `
|
||||
<a href="${esc(repo)}" target="_blank" rel="noopener" title="我的开源地址:${esc(repo)}">${icon('M3 12h18M12 3v18')}开源地址</a>
|
||||
<a href="${esc(nav)}" target="_blank" rel="noopener" title="我的导航站:${esc(nav)}">${icon('M4 6h16M4 12h16M4 18h10')}导航站</a>`;
|
||||
}
|
||||
|
||||
async function render(silent) {
|
||||
const scY = window.scrollY || 0;
|
||||
const viewEl = document.getElementById('view');
|
||||
@@ -1444,6 +1464,9 @@ async function renderSettings() {
|
||||
<div class="form-row"><label>同一应用推送间隔</label><input id="th_debounce" type="number" value="${s.debounceMinutes}" /> 分钟</div>
|
||||
<div class="form-row"><label>Webhook 地址</label><input id="th_webhook" placeholder="https://..." value="${esc(s.webhook)}" style="flex:1" /></div>
|
||||
<div class="form-row"><label>启用推送</label><input id="th_notify" type="checkbox" ${s.notify ? 'checked' : ''} style="width:auto" /></div>
|
||||
<div class="form-row"><label>开源地址</label><input id="th_repo" placeholder="http://192.168.68.19:3200/jinghui/docker-center" value="${esc((s.links && s.links.repo) || '')}" style="flex:1" /></div>
|
||||
<div class="form-row"><label>导航站地址</label><input id="th_nav" placeholder="http://192.168.68.19:10788" value="${esc((s.links && s.links.nav) || '')}" style="flex:1" /></div>
|
||||
<div class="muted" style="margin-top:2px">这两项会显示在右上角,留空则用默认地址(本机的 Gitea 仓库与 BestNav 导航站)</div>
|
||||
<div class="muted" style="margin-top:10px">容器未运行、健康检查失败、重启次数增加、超过资源阈值时产生事件;「异常」级事件按上面的间隔去重后推送到 webhook(POST JSON:title / level / app / detail / time / host)。</div>
|
||||
<div style="display:flex;gap:8px;margin-top:14px">
|
||||
<button class="btn primary" id="saveBtn">保存</button>
|
||||
@@ -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');
|
||||
@@ -60,6 +60,7 @@
|
||||
<option value="30000">30 秒</option>
|
||||
</select>
|
||||
</div>
|
||||
<span class="ext-links" id="extLinks"></span>
|
||||
<button id="pauseBtn" class="btn ghost" title="暂停 / 继续自动刷新">⏸ 暂停</button>
|
||||
<button id="refreshBtn" class="btn ghost"><i data-ico="refresh"></i>刷新</button>
|
||||
<button id="addBtn" class="btn primary"><i data-ico="plus"></i>添加容器</button>
|
||||
|
||||
+8
-2
@@ -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}
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user