2.0阶段5调整2: 任务页去模型池条;模型页支持增改删(PATCH写config,待重启徽章提示);设置页去运行中会话行、未保存改动标红
This commit is contained in:
@@ -63,7 +63,6 @@ function svcCard(st) {
|
||||
html += kvPlain('版本 / Node', st.version + ' / ' + st.node);
|
||||
html += kvPlain('已运行', fmtUptime(st.uptime_ms) + '(启动于 ' + new Date(st.started_at).toLocaleString() + ')');
|
||||
html += kvPlain('端口', st.port);
|
||||
html += kvPlain('运行中会话', (st.running_sessions || []).length);
|
||||
html += kvPlain('配置文件', st.config_path);
|
||||
html += kvPlain('工作区', st.workspace_root);
|
||||
html += kvPlain('技能目录', st.skills_root);
|
||||
@@ -99,6 +98,7 @@ function formCard() {
|
||||
|
||||
async function loadSettings() {
|
||||
refreshUser();
|
||||
bindDirtyMark();
|
||||
const el = $('cfg-sections');
|
||||
if (!el) return;
|
||||
el.innerHTML = '<div class="empty-tip">加载中…</div>';
|
||||
@@ -128,6 +128,21 @@ async function refreshUser() {
|
||||
} catch (_) { /* 未启用认证 */ }
|
||||
}
|
||||
|
||||
// 未保存改动标红:委托监听(#cfg-sections 容器常驻,innerHTML 重建不影响)
|
||||
let dirtyBound = false;
|
||||
function bindDirtyMark() {
|
||||
if (dirtyBound) return;
|
||||
const box = $('cfg-sections');
|
||||
if (!box) return;
|
||||
dirtyBound = true;
|
||||
box.addEventListener('input', function (ev) {
|
||||
const inp = ev.target;
|
||||
if (inp.classList && inp.classList.contains('cfg-input')) {
|
||||
inp.classList.toggle('cfg-dirty', inp.value.trim() !== inp.dataset.orig);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 表单保存(收集与打开时不同的项,逐项 PATCH) ----------
|
||||
async function saveForm() {
|
||||
const inputs = document.querySelectorAll('#cfg-sections .cfg-input');
|
||||
|
||||
Reference in New Issue
Block a user