feat: 完成 issue #153 模型管理页补充按模型审计历史视图
This commit is contained in:
@@ -97,6 +97,11 @@ function renderModels() {
|
||||
rb.onclick = function () { rollbackModel(i); };
|
||||
ops.appendChild(rb);
|
||||
}
|
||||
// issue #153:该模型的审计历史(promote/rollback/register 可追溯)
|
||||
var hist = el("button", null, "历史");
|
||||
hist.style.marginLeft = "6px";
|
||||
hist.onclick = function () { renderModelHistory(m.name); };
|
||||
ops.appendChild(hist);
|
||||
tr.appendChild(ops);
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
@@ -141,6 +146,22 @@ function rollbackModel(i) {
|
||||
audit("rollback", "model", m.name + "@" + m.version + " → " + prev);
|
||||
renderModels();
|
||||
}
|
||||
/* issue #153:按模型名过滤审计日志,展示版本/阶段变迁历史 */
|
||||
function renderModelHistory(name) {
|
||||
var box = document.getElementById("model-history");
|
||||
box.hidden = false;
|
||||
box.innerHTML = "";
|
||||
box.appendChild(el("div", null, "模型「" + name + "」审计历史:"));
|
||||
var log = (typeof UserStore !== "undefined") ? UserStore.auditLog() : [];
|
||||
var hits = log.filter(function (e) {
|
||||
return e.resource === "model" && e.reason.indexOf(name) >= 0;
|
||||
});
|
||||
if (!hits.length) { box.appendChild(el("div", "hint", "(暂无该模型的审计记录)")); return; }
|
||||
hits.slice().reverse().forEach(function (e) {
|
||||
box.appendChild(el("div", null,
|
||||
e.time.slice(0, 19).replace("T", " ") + " | " + e.actor + " | " + e.action + " | " + e.reason));
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------------- 知识库管理 ---------------- */
|
||||
function getKbDocs() { return load(KB_KEY, []); }
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
<thead><tr><th>模型</th><th>版本</th><th>阶段</th><th>作者</th><th>更新时间</th><th>操作</th></tr></thead>
|
||||
<tbody id="model-tbody"></tbody>
|
||||
</table>
|
||||
<!-- issue #153:按模型过滤的审计历史(验收:promote/rollback 可追溯) -->
|
||||
<div id="model-history" class="detail" hidden></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user