feat: 仓库导入、分支模型重构与审查历史摘要
仓库接入 - 新增「从 Gitea 导入」:用全局 Token 列出可见仓库,一键建配置 - 新增仓库只填 Git 地址,自动解析 owner/name,支持 https/ssh/scp 写法 - 新增「测试连接」按钮,保存前即可校验地址并拉取分支 分支模型 - 由单一 base_branch + glob 改为「一个管理分支 + 多个检查分支」 - 管理分支是唯一合并目标;检查分支全部纳入监控 - 支持从任意分支克隆创建管理分支 - 审查基准改为管理分支的 merge-base;仅目标为管理分支的 PR 才自动合并 - 旧库自动迁移:base_branch 播种 managed_branch,branch_patterns 展开为检查分支 审查历史 - 新增 review_records 表与「审查历史」页 - 记录触发来源、PR 链接、审查范围、阻断阈值、发布方式、自动合并设置、 排除路径、LLM 模型、token 消耗、耗时、需求背景与全部审查意见 - 详情弹窗一览,支持按仓库过滤 AI 摘要 - 新增独立摘要模块(app/lib/summary.js),与代码审查提示词分离 - 专用提示词输出固定四节、500 字内的中文记录:结论/范围/问题/要点 - 与代码审查共用全局 LLM 设置;摘要失败不影响审查与合并,可单条重跑 修复 - 摘要改用内置 fetch:运行镜像没有 curl,原先 spawn curl 必然 ENOENT - 去掉 blob:none 部分克隆并把凭据写入 .git/config: 惰性取 blob 不会带上 per-command extraHeader,私有库会报 could not read Username UI - 审查背景改为多行文本域(可滚动) - 分支改为可点选列表,管理分支高亮 - 仓库表格展示管理分支与检查分支
This commit is contained in:
+390
-44
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
const state = { repos: [], jobs: [], token: "" };
|
||||
const state = { repos: [], jobs: [], records: [], token: "", branches: [] };
|
||||
|
||||
/* ---------------------------------- auth ---------------------------------- */
|
||||
|
||||
@@ -83,9 +83,10 @@ async function api(path, { method = "GET", body } = {}) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
function show(selector, content) {
|
||||
function show(selector, content, cls) {
|
||||
const el = document.querySelector(selector);
|
||||
el.textContent = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
||||
if (cls) el.className = cls; else el.className = "log";
|
||||
el.classList.remove("hidden");
|
||||
}
|
||||
|
||||
@@ -102,6 +103,15 @@ function fmtTime(value) {
|
||||
return String(value).replace("T", " ").replace("Z", "");
|
||||
}
|
||||
|
||||
function handleError(err) {
|
||||
if (err.status === 401) {
|
||||
document.getElementById("sign-out").classList.add("hidden");
|
||||
showGate("Token 无效或已过期,请重新输入。");
|
||||
return;
|
||||
}
|
||||
setBanner(err.message);
|
||||
}
|
||||
|
||||
/* ---------------------------------- tabs ---------------------------------- */
|
||||
|
||||
for (const tab of document.querySelectorAll(".tab")) {
|
||||
@@ -111,12 +121,11 @@ for (const tab of document.querySelectorAll(".tab")) {
|
||||
p.classList.toggle("active", p.id === `tab-${tab.dataset.tab}`);
|
||||
}
|
||||
if (tab.dataset.tab === "jobs") loadJobs().catch(handleError);
|
||||
if (tab.dataset.tab === "records") loadRecords().catch(handleError);
|
||||
if (tab.dataset.tab === "settings") loadSettings().catch(handleError);
|
||||
});
|
||||
}
|
||||
|
||||
/* --------------------------------- health --------------------------------- */
|
||||
|
||||
async function loadHealth() {
|
||||
try {
|
||||
const h = await api("/health");
|
||||
@@ -129,19 +138,10 @@ async function loadHealth() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleError(err) {
|
||||
if (err.status === 401) {
|
||||
document.getElementById("sign-out").classList.add("hidden");
|
||||
showGate("Token 无效或已过期,请重新输入。");
|
||||
return;
|
||||
}
|
||||
setBanner(err.message);
|
||||
}
|
||||
|
||||
/* ---------------------------------- repos --------------------------------- */
|
||||
|
||||
const REPO_FIELDS = [
|
||||
"id", "owner", "name", "enabled", "base_branch", "branch_patterns", "review_scope",
|
||||
"id", "repo_url", "enabled", "managed_branch", "check_branches", "review_scope",
|
||||
"gitea_token", "llm_model", "llm_token", "background_template", "excludes",
|
||||
"publish_mode", "create_issue", "issue_labels", "block_severity", "block_categories",
|
||||
"fail_on_findings", "auto_merge", "auto_merge_mode", "merge_method", "delete_branch",
|
||||
@@ -152,23 +152,38 @@ async function loadRepos() {
|
||||
state.repos = await api("/repos");
|
||||
const tbody = document.querySelector("#repos-table tbody");
|
||||
if (state.repos.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="7" class="empty">还没有配置仓库。点右上角「新增仓库」开始,然后在 Gitea 仓库里添加 Webhook。</td></tr>';
|
||||
return;
|
||||
tbody.innerHTML = '<tr><td colspan="8" class="empty">还没有配置仓库。点「从 Gitea 导入」批量选择,或「新增仓库」手动填 Git 地址。</td></tr>';
|
||||
} else {
|
||||
tbody.innerHTML = state.repos.map((r) => `
|
||||
<tr>
|
||||
<td><strong>${esc(r.owner)}/${esc(r.name)}</strong><br><span class="hint">${esc(shortUrl(r.repo_url))}</span></td>
|
||||
<td><code>${esc(r.managed_branch)}</code></td>
|
||||
<td>${branchTags(r.check_branches, r.managed_branch)}</td>
|
||||
<td>${esc(scopeLabel(r.review_scope))}</td>
|
||||
<td>${r.enabled ? '<span class="tag ok">启用</span>' : '<span class="tag muted">停用</span>'}</td>
|
||||
<td>${r.auto_merge ? `<span class="tag warn">${esc(r.merge_method)}</span>` : '<span class="tag muted">否</span>'}</td>
|
||||
<td><code>${esc(r.block_severity || "—")}</code></td>
|
||||
<td>
|
||||
<button data-edit="${r.id}">编辑</button>
|
||||
<button data-run="${r.id}">立即审查</button>
|
||||
<button data-records="${r.id}">历史</button>
|
||||
<button class="danger" data-del="${r.id}">删除</button>
|
||||
</td>
|
||||
</tr>`).join("");
|
||||
}
|
||||
tbody.innerHTML = state.repos.map((r) => `
|
||||
<tr>
|
||||
<td><strong>${esc(r.owner)}/${esc(r.name)}</strong><br><span class="tag muted">${esc(r.base_branch)}</span></td>
|
||||
<td><code>${esc(r.branch_patterns)}</code></td>
|
||||
<td>${esc(scopeLabel(r.review_scope))}</td>
|
||||
<td>${r.enabled ? '<span class="tag ok">启用</span>' : '<span class="tag muted">停用</span>'}</td>
|
||||
<td>${r.auto_merge ? `<span class="tag warn">${esc(r.merge_method)}</span>` : '<span class="tag muted">否</span>'}</td>
|
||||
<td><code>${esc(r.block_severity || "—")}</code></td>
|
||||
<td>
|
||||
<button data-edit="${r.id}">编辑</button>
|
||||
<button data-run="${r.id}">立即审查</button>
|
||||
<button class="danger" data-del="${r.id}">删除</button>
|
||||
</td>
|
||||
</tr>`).join("");
|
||||
syncRecordFilter();
|
||||
}
|
||||
|
||||
function shortUrl(url) {
|
||||
return String(url || "").replace(/^https?:\/\//, "");
|
||||
}
|
||||
|
||||
function branchTags(list, managed) {
|
||||
const names = String(list || "").split(",").map((s) => s.trim()).filter(Boolean);
|
||||
if (!names.length) return '<span class="tag muted">—</span>';
|
||||
return names.map((n) => n === managed
|
||||
? `<span class="tag ok">${esc(n)}</span>`
|
||||
: `<span class="tag muted">${esc(n)}</span>`).join(" ");
|
||||
}
|
||||
|
||||
function scopeLabel(scope) {
|
||||
@@ -179,13 +194,17 @@ document.querySelector("#repos-table").addEventListener("click", async (ev) => {
|
||||
const target = ev.target.closest("button");
|
||||
if (!target) return;
|
||||
try {
|
||||
if (target.dataset.edit) openRepo(Number(target.dataset.edit));
|
||||
if (target.dataset.edit) await openRepo(Number(target.dataset.edit));
|
||||
if (target.dataset.del) {
|
||||
if (!confirm("删除该仓库配置?历史任务会一并删除。")) return;
|
||||
await api(`/repos/${target.dataset.del}`, { method: "DELETE" });
|
||||
await loadRepos();
|
||||
}
|
||||
if (target.dataset.run) openManual(Number(target.dataset.run));
|
||||
if (target.dataset.records) {
|
||||
document.querySelector('#record-filter').value = String(target.dataset.records);
|
||||
document.querySelector('.tab[data-tab="records"]').click();
|
||||
}
|
||||
} catch (err) {
|
||||
handleError(err);
|
||||
}
|
||||
@@ -193,35 +212,130 @@ document.querySelector("#repos-table").addEventListener("click", async (ev) => {
|
||||
|
||||
document.getElementById("add-repo").addEventListener("click", () => openRepo(null));
|
||||
document.getElementById("refresh-jobs").addEventListener("click", () => loadJobs().catch(handleError));
|
||||
document.getElementById("refresh-records").addEventListener("click", () => loadRecords().catch(handleError));
|
||||
document.getElementById("record-filter").addEventListener("change", () => loadRecords().catch(handleError));
|
||||
|
||||
/* ------------------------------- repo dialog ------------------------------ */
|
||||
/* ------------------------------ repo dialog ------------------------------- */
|
||||
|
||||
const modal = document.getElementById("modal");
|
||||
const form = document.getElementById("repo-form");
|
||||
const branchList = document.getElementById("branch-list");
|
||||
|
||||
function openRepo(id) {
|
||||
function selectedBranches() {
|
||||
return String(form.elements.check_branches.value || "")
|
||||
.split(",").map((s) => s.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
function setSelectedBranches(list) {
|
||||
form.elements.check_branches.value = list.join(",");
|
||||
}
|
||||
|
||||
function renderBranchList() {
|
||||
const chosen = new Set(selectedBranches());
|
||||
const managed = form.elements.managed_branch.value.trim();
|
||||
if (!state.branches.length) {
|
||||
branchList.innerHTML = '<span class="hint">点「加载分支」获取远端分支列表。</span>';
|
||||
return;
|
||||
}
|
||||
branchList.innerHTML = state.branches.map((b) => {
|
||||
const on = chosen.has(b);
|
||||
const label = b === managed ? `${b}(管理)` : b;
|
||||
return `<button type="button" class="${on ? "on" : ""}" data-branch="${esc(b)}">${esc(label)}</button>`;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
branchList.addEventListener("click", (ev) => {
|
||||
const btn = ev.target.closest("button[data-branch]");
|
||||
if (!btn) return;
|
||||
const name = btn.dataset.branch;
|
||||
const chosen = selectedBranches();
|
||||
const idx = chosen.indexOf(name);
|
||||
if (idx >= 0) chosen.splice(idx, 1); else chosen.push(name);
|
||||
setSelectedBranches(chosen);
|
||||
renderBranchList();
|
||||
});
|
||||
|
||||
async function openRepo(id) {
|
||||
form.reset();
|
||||
hide("#repo-result");
|
||||
state.branches = [];
|
||||
renderBranchList();
|
||||
const repo = id ? state.repos.find((r) => r.id === id) : null;
|
||||
document.getElementById("modal-title").textContent = repo ? `${repo.owner}/${repo.name}` : "新增仓库";
|
||||
document.getElementById("repo-parsed").textContent = "";
|
||||
for (const field of REPO_FIELDS) {
|
||||
const input = form.elements[field];
|
||||
if (!input) continue;
|
||||
if (!repo) {
|
||||
// Defaults for a brand-new repository.
|
||||
if (field === "enabled" || field === "create_issue") input.checked = true;
|
||||
if (field === "managed_branch") input.value = "main";
|
||||
if (field === "check_branches") input.value = "main";
|
||||
continue;
|
||||
}
|
||||
if (input.type === "checkbox") input.checked = Boolean(repo[field]);
|
||||
else if (input.type === "password") input.value = "";
|
||||
else input.value = repo[field] ?? "";
|
||||
}
|
||||
if (repo) {
|
||||
document.getElementById("repo-parsed").textContent = `${repo.owner}/${repo.name}`;
|
||||
// Existing repositories get their branch list loaded for the picker.
|
||||
loadBranches({ silent: true }).catch(() => {});
|
||||
}
|
||||
modal.classList.remove("hidden");
|
||||
}
|
||||
|
||||
document.getElementById("modal-close").addEventListener("click", () => modal.classList.add("hidden"));
|
||||
modal.addEventListener("click", (ev) => { if (ev.target === modal) modal.classList.add("hidden"); });
|
||||
|
||||
/** Fetch branch info for whatever git URL is currently in the form. */
|
||||
async function loadBranches({ silent = false } = {}) {
|
||||
const repoUrl = form.elements.repo_url.value.trim();
|
||||
const id = form.elements.id.value;
|
||||
const hint = document.getElementById("repo-parsed");
|
||||
if (!repoUrl && !id) {
|
||||
if (!silent) hint.textContent = "请先填写 Git 地址。";
|
||||
return;
|
||||
}
|
||||
if (!silent) hint.textContent = "正在连接…";
|
||||
try {
|
||||
const body = repoUrl ? { repo_url: repoUrl } : undefined;
|
||||
const info = body
|
||||
? await api("/repos/branches", { method: "POST", body })
|
||||
: await api(`/repos/${id}/discover`, { method: "POST" });
|
||||
state.branches = info.branches || [];
|
||||
if (!form.elements.managed_branch.value) form.elements.managed_branch.value = info.default_branch || "main";
|
||||
if (!form.elements.check_branches.value) form.elements.check_branches.value = state.branches.join(",");
|
||||
renderBranchList();
|
||||
hint.className = "hint ok";
|
||||
hint.textContent =
|
||||
`连接成功:${info.owner}/${info.name} · 默认分支 ${info.default_branch} · 共 ${state.branches.length} 个分支` +
|
||||
(info.has_issues ? "" : " · 该仓库未启用 Issue");
|
||||
document.getElementById("clone-source").innerHTML =
|
||||
state.branches.map((b) => `<option value="${esc(b)}">${esc(b)}</option>`).join("");
|
||||
return info;
|
||||
} catch (err) {
|
||||
hint.className = "hint err";
|
||||
hint.textContent = `连接失败:${err.message}`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("repo-test").addEventListener("click", () => loadBranches().catch(() => {}));
|
||||
document.getElementById("branch-reload").addEventListener("click", () => loadBranches().catch(() => {}));
|
||||
|
||||
form.elements.repo_url.addEventListener("blur", async () => {
|
||||
const url = form.elements.repo_url.value.trim();
|
||||
if (!url) return;
|
||||
try {
|
||||
const parsed = await api("/repos/parse", { method: "POST", body: { repo_url: url } });
|
||||
document.getElementById("repo-parsed").className = "hint";
|
||||
document.getElementById("repo-parsed").textContent = `识别为:${parsed.owner}/${parsed.name}`;
|
||||
} catch (err) {
|
||||
document.getElementById("repo-parsed").className = "hint err";
|
||||
document.getElementById("repo-parsed").textContent = err.message;
|
||||
}
|
||||
});
|
||||
|
||||
form.addEventListener("submit", async (ev) => {
|
||||
ev.preventDefault();
|
||||
const data = {};
|
||||
@@ -244,17 +358,116 @@ form.addEventListener("submit", async (ev) => {
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("discover").addEventListener("click", async () => {
|
||||
/* ------------------------------ clone branch ------------------------------ */
|
||||
|
||||
const cloneModal = document.getElementById("clone-modal");
|
||||
const cloneForm = document.getElementById("clone-form");
|
||||
|
||||
document.getElementById("branch-create").addEventListener("click", () => {
|
||||
cloneForm.reset();
|
||||
hide("#clone-result");
|
||||
cloneForm.elements.new_branch.value = form.elements.managed_branch.value.trim() || "main";
|
||||
if (!state.branches.length) {
|
||||
loadBranches().then(() => cloneModal.classList.remove("hidden")).catch(() => {});
|
||||
return;
|
||||
}
|
||||
cloneModal.classList.remove("hidden");
|
||||
});
|
||||
|
||||
document.getElementById("clone-close").addEventListener("click", () => cloneModal.classList.add("hidden"));
|
||||
cloneModal.addEventListener("click", (ev) => { if (ev.target === cloneModal) cloneModal.classList.add("hidden"); });
|
||||
|
||||
cloneForm.addEventListener("submit", async (ev) => {
|
||||
ev.preventDefault();
|
||||
const id = form.elements.id.value;
|
||||
if (!id) return show("#repo-result", "请先保存仓库,再测试连接。");
|
||||
show("#repo-result", "测试中…");
|
||||
if (!id) return show("#clone-result", "请先保存仓库,再创建分支。");
|
||||
try {
|
||||
const info = await api(`/repos/${id}/discover`, { method: "POST" });
|
||||
show("#repo-result",
|
||||
`连接成功\n默认分支:${info.default_branch}\nIssue 功能:${info.has_issues}\nPR 功能:${info.has_pull_requests}\n分支:${info.branches.join(", ")}`);
|
||||
const res = await api(`/repos/${id}/branches`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
new_branch: cloneForm.elements.new_branch.value.trim(),
|
||||
from_branch: cloneForm.elements.from_branch.value,
|
||||
},
|
||||
});
|
||||
state.branches = res.branches || [];
|
||||
form.elements.managed_branch.value = res.repo.managed_branch;
|
||||
form.elements.check_branches.value = res.repo.check_branches;
|
||||
renderBranchList();
|
||||
cloneModal.classList.add("hidden");
|
||||
show("#repo-result", `已创建分支 ${res.repo.managed_branch}`);
|
||||
} catch (err) {
|
||||
if (err.status === 401) return handleError(err);
|
||||
show("#repo-result", err.message);
|
||||
show("#clone-result", err.message);
|
||||
}
|
||||
});
|
||||
|
||||
/* ------------------------------ import dialog ----------------------------- */
|
||||
|
||||
const importModal = document.getElementById("import-modal");
|
||||
|
||||
document.getElementById("import-repo").addEventListener("click", async () => {
|
||||
importModal.classList.remove("hidden");
|
||||
document.getElementById("import-list").innerHTML = '<div class="empty">正在拉取仓库列表…</div>';
|
||||
try {
|
||||
state.remoteRepos = await api("/gitea/repos");
|
||||
renderImportList();
|
||||
} catch (err) {
|
||||
document.getElementById("import-list").innerHTML = `<div class="empty">拉取失败:${esc(err.message)}</div>`;
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("import-close").addEventListener("click", () => importModal.classList.add("hidden"));
|
||||
importModal.addEventListener("click", (ev) => { if (ev.target === importModal) importModal.classList.add("hidden"); });
|
||||
document.getElementById("import-search").addEventListener("input", renderImportList);
|
||||
|
||||
function renderImportList() {
|
||||
const q = document.getElementById("import-search").value.trim().toLowerCase();
|
||||
const list = (state.remoteRepos || []).filter((r) => !q || r.full_name.toLowerCase().includes(q));
|
||||
const box = document.getElementById("import-list");
|
||||
if (!list.length) {
|
||||
box.innerHTML = '<div class="empty">没有匹配的仓库。</div>';
|
||||
return;
|
||||
}
|
||||
box.innerHTML = list.map((r) => `
|
||||
<div class="import-row">
|
||||
<div>
|
||||
<div class="name">${esc(r.full_name)}</div>
|
||||
<div class="meta">${esc(r.default_branch || "main")}${r.private ? " · 私有" : ""}${r.empty ? " · 空仓库" : ""}${r.archived ? " · 已归档" : ""}${r.description ? ` · ${esc(r.description)}` : ""}</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
${r.configured
|
||||
? '<span class="tag ok">已配置</span>'
|
||||
: `<button data-import="${esc(r.full_name)}" ${r.empty ? "disabled" : ""}>${r.empty ? "空仓库" : "添加"}</button>`}
|
||||
</div>
|
||||
</div>`).join("");
|
||||
}
|
||||
|
||||
document.getElementById("import-list").addEventListener("click", async (ev) => {
|
||||
const btn = ev.target.closest("button[data-import]");
|
||||
if (!btn) return;
|
||||
const fullName = btn.dataset.import;
|
||||
const remote = (state.remoteRepos || []).find((r) => r.full_name === fullName);
|
||||
if (!remote) return;
|
||||
btn.disabled = true;
|
||||
btn.textContent = "添加中…";
|
||||
try {
|
||||
const created = await api("/repos", {
|
||||
method: "POST",
|
||||
body: {
|
||||
repo_url: remote.clone_url,
|
||||
managed_branch: remote.default_branch || "main",
|
||||
check_branches: remote.default_branch || "main",
|
||||
},
|
||||
});
|
||||
// Discover immediately so the branch list is populated on first open.
|
||||
await api(`/repos/${created.id}/discover`, { method: "POST" }).catch(() => {});
|
||||
remote.configured = true;
|
||||
renderImportList();
|
||||
await loadRepos();
|
||||
setBanner(`已添加 ${fullName}`, "ok");
|
||||
} catch (err) {
|
||||
btn.disabled = false;
|
||||
btn.textContent = "添加";
|
||||
setBanner(`添加 ${fullName} 失败:${err.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -269,8 +482,8 @@ function openManual(repoId) {
|
||||
manualForm.reset();
|
||||
hide("#manual-result");
|
||||
manualForm.elements.repo_id.value = repo.id;
|
||||
manualForm.elements.ref.value = repo.base_branch || "main";
|
||||
manualForm.elements.base_ref.value = repo.base_branch || "main";
|
||||
manualForm.elements.ref.value = repo.managed_branch || "main";
|
||||
manualForm.elements.base_ref.value = repo.managed_branch || "main";
|
||||
document.getElementById("manual-repo").textContent = `${repo.owner}/${repo.name}`;
|
||||
manualModal.classList.remove("hidden");
|
||||
}
|
||||
@@ -299,6 +512,139 @@ manualForm.addEventListener("submit", async (ev) => {
|
||||
}
|
||||
});
|
||||
|
||||
/* -------------------------------- records --------------------------------- */
|
||||
|
||||
function syncRecordFilter() {
|
||||
const sel = document.getElementById("record-filter");
|
||||
const current = sel.value;
|
||||
sel.innerHTML = '<option value="">全部仓库</option>' +
|
||||
state.repos.map((r) => `<option value="${r.id}">${esc(r.owner)}/${esc(r.name)}</option>`).join("");
|
||||
sel.value = current;
|
||||
}
|
||||
|
||||
async function loadRecords() {
|
||||
const repoId = document.getElementById("record-filter").value;
|
||||
state.records = await api(`/records${repoId ? `?repo_id=${repoId}` : ""}`);
|
||||
const box = document.getElementById("records-list");
|
||||
if (!state.records.length) {
|
||||
box.innerHTML = '<div class="empty">暂无审查记录。仓库收到 push 或 PR 后,这里会出现摘要。</div>';
|
||||
return;
|
||||
}
|
||||
box.innerHTML = state.records.map(renderRecordCard).join("");
|
||||
}
|
||||
|
||||
function renderRecordCard(r) {
|
||||
const summaryCls = r.summary_status === "done" ? "" : (r.summary_status === "failed" ? " failed" : " pending");
|
||||
let summary;
|
||||
if (r.summary_status === "done") {
|
||||
summary = esc(r.summary || "");
|
||||
} else if (r.summary_status === "failed") {
|
||||
summary = `摘要生成失败:${esc(r.summary_error || "未知原因")}`;
|
||||
} else if (r.summary_status === "skipped") {
|
||||
summary = "未生成摘要。";
|
||||
} else {
|
||||
summary = "摘要生成中…";
|
||||
}
|
||||
return `
|
||||
<article class="record">
|
||||
<div class="record-head">
|
||||
<div>
|
||||
<div class="who">${esc(r.owner)}/${esc(r.name)} · ${esc(r.ref_name)}</div>
|
||||
<div class="record-meta">
|
||||
<span>${fmtTime(r.created_at)}</span>
|
||||
<span>提交 <code>${esc(String(r.to_sha).slice(0, 10))}</code></span>
|
||||
<span>${esc(r.trigger || "")}</span>
|
||||
${r.pr_number ? `<a href="${esc(r.pr_url || "#")}" target="_blank" rel="noreferrer">PR #${r.pr_number}</a>` : ""}
|
||||
<span>发现 ${r.findings_count ?? 0} 条</span>
|
||||
${r.tokens_total ? `<span>${r.tokens_total} tokens</span>` : ""}
|
||||
${r.elapsed ? `<span>${esc(r.elapsed)}</span>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<span class="tag ${r.summary_status === "done" ? "ok" : (r.summary_status === "failed" ? "err" : "muted")}">${esc(r.summary_status)}</span>
|
||||
<button data-record="${r.id}">详情</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="record-summary${summaryCls}">${summary}</div>
|
||||
</article>`;
|
||||
}
|
||||
|
||||
document.getElementById("records-list").addEventListener("click", async (ev) => {
|
||||
const btn = ev.target.closest("button[data-record]");
|
||||
if (!btn) return;
|
||||
try {
|
||||
const rec = await api(`/records/${btn.dataset.record}`);
|
||||
showRecord(rec);
|
||||
} catch (err) {
|
||||
handleError(err);
|
||||
}
|
||||
});
|
||||
|
||||
const recordModal = document.getElementById("record-modal");
|
||||
let currentRecordId = null;
|
||||
|
||||
function showRecord(rec) {
|
||||
currentRecordId = rec.id;
|
||||
document.getElementById("record-title").textContent =
|
||||
`审查记录 #${rec.id} · ${rec.repository || ""} · ${rec.ref_name}`;
|
||||
const params = rec.params || {};
|
||||
const findings = rec.findings || [];
|
||||
const rows = [
|
||||
["提交", `<code>${esc(rec.to_sha)}</code>`],
|
||||
["对比基准", rec.from_sha ? `<code>${esc(rec.from_sha)}</code>` : "—"],
|
||||
["触发来源", esc(rec.trigger || "—")],
|
||||
["Pull Request", rec.pr_number
|
||||
? `<a href="${esc(rec.pr_url || "#")}" target="_blank" rel="noreferrer">#${rec.pr_number}</a>`
|
||||
: "—"],
|
||||
["管理分支", esc(params.managed_branch || "—")],
|
||||
["PR 目标分支", esc(params.base_ref || "—")],
|
||||
["审查范围", esc(params.review_scope || "—")],
|
||||
["阻断阈值", `${esc(params.block_severity || "—")}${params.block_categories ? ` / ${esc(params.block_categories)}` : ""}`],
|
||||
["发布方式", esc(params.publish_mode || "—")],
|
||||
["自动合并", params.auto_merge ? `${esc(params.auto_merge_mode || "")} · ${esc(params.merge_method || "")}` : "关闭"],
|
||||
["排除路径", esc(params.excludes || "—")],
|
||||
["LLM 模型", esc(rec.llm_model || "—")],
|
||||
["审查状态", `${esc(rec.llm_status || "—")}${params.review_incomplete ? "(覆盖不完整)" : ""}`],
|
||||
["消耗 / 耗时", `${rec.tokens_total || 0} tokens · ${esc(rec.elapsed || "—")}`],
|
||||
["摘要模型", esc(rec.summary_model || "—")],
|
||||
];
|
||||
const findingsHtml = findings.length
|
||||
? findings.map((f) => `
|
||||
<div class="finding${f.blocking ? " blocking" : ""}">
|
||||
<div class="where">${esc(f.path)}${f.start_line ? `:${f.start_line}${f.end_line && f.end_line !== f.start_line ? `-${f.end_line}` : ""}` : ""} · ${esc(f.severity || "未分级")}/${esc(f.category || "-")}${f.blocking ? " · 阻断" : ""}</div>
|
||||
<div>${esc(f.content || "")}</div>
|
||||
</div>`).join("")
|
||||
: '<div class="empty">本次没有产生意见。</div>';
|
||||
|
||||
document.getElementById("record-body").innerHTML = `
|
||||
<h3>审查需求 / 背景</h3>
|
||||
<div class="record-summary">${rec.requirement ? esc(rec.requirement) : "(未填写)"}</div>
|
||||
<h3 style="margin-top:16px">AI 摘要</h3>
|
||||
<div class="record-summary${rec.summary_status === "done" ? "" : " pending"}">${
|
||||
rec.summary_status === "done" ? esc(rec.summary || "") : esc(rec.summary_error || "生成中…")
|
||||
}</div>
|
||||
<h3 style="margin-top:16px">运行参数</h3>
|
||||
<dl class="kv">${rows.map(([k, v]) => `<dt>${esc(k)}</dt><dd>${v}</dd>`).join("")}</dl>
|
||||
<h3 style="margin-top:16px">审查意见(${findings.length})</h3>
|
||||
${findingsHtml}`;
|
||||
recordModal.classList.remove("hidden");
|
||||
}
|
||||
|
||||
document.getElementById("record-close").addEventListener("click", () => recordModal.classList.add("hidden"));
|
||||
recordModal.addEventListener("click", (ev) => { if (ev.target === recordModal) recordModal.classList.add("hidden"); });
|
||||
|
||||
document.getElementById("record-resummarise").addEventListener("click", async () => {
|
||||
if (!currentRecordId) return;
|
||||
try {
|
||||
await api(`/records/${currentRecordId}/summarise`, { method: "POST" });
|
||||
recordModal.classList.add("hidden");
|
||||
setBanner("已重新排队生成摘要。", "ok");
|
||||
await loadRecords();
|
||||
} catch (err) {
|
||||
handleError(err);
|
||||
}
|
||||
});
|
||||
|
||||
/* ---------------------------------- jobs ---------------------------------- */
|
||||
|
||||
const STATUS_TAG = {
|
||||
|
||||
+125
-36
@@ -10,11 +10,15 @@
|
||||
<body>
|
||||
<header>
|
||||
<h1>Gitea 代码审查</h1>
|
||||
<div class="right"><div class="status" id="status">加载中…</div><button class="linkish hidden" id="sign-out">清除访问 Token</button></div>
|
||||
<div class="right">
|
||||
<div class="status" id="status">加载中…</div>
|
||||
<button class="linkish hidden" id="sign-out">清除访问 Token</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav>
|
||||
<button class="tab active" data-tab="repos">仓库</button>
|
||||
<button class="tab" data-tab="records">审查历史</button>
|
||||
<button class="tab" data-tab="jobs">任务</button>
|
||||
<button class="tab" data-tab="settings">设置</button>
|
||||
</nav>
|
||||
@@ -25,19 +29,33 @@
|
||||
<section id="tab-repos" class="panel active">
|
||||
<div class="row">
|
||||
<h2>已配置仓库</h2>
|
||||
<button id="add-repo">新增仓库</button>
|
||||
<div class="actions">
|
||||
<button id="import-repo">从 Gitea 导入</button>
|
||||
<button class="primary" id="add-repo">新增仓库</button>
|
||||
</div>
|
||||
</div>
|
||||
<table id="repos-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>仓库</th><th>分支过滤</th><th>范围</th><th>启用</th>
|
||||
<th>自动合并</th><th>阻断级别</th><th></th>
|
||||
<th>仓库</th><th>管理分支</th><th>检查分支</th><th>范围</th>
|
||||
<th>启用</th><th>自动合并</th><th>阻断级别</th><th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section id="tab-records" class="panel">
|
||||
<div class="row">
|
||||
<h2>审查历史摘要</h2>
|
||||
<div class="actions">
|
||||
<select id="record-filter"><option value="">全部仓库</option></select>
|
||||
<button id="refresh-records">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="records-list" class="records"></div>
|
||||
</section>
|
||||
|
||||
<section id="tab-jobs" class="panel">
|
||||
<div class="row">
|
||||
<h2>审查任务</h2>
|
||||
@@ -58,17 +76,17 @@
|
||||
<form id="settings-form">
|
||||
<fieldset>
|
||||
<legend>Gitea</legend>
|
||||
<label>API 地址 <input name="giteaUrl" placeholder="http://127.0.0.1:80" /></label>
|
||||
<label>API 地址 <input name="giteaUrl" placeholder="http://192.168.31.51" /></label>
|
||||
<label>管理员 Token <input name="giteaToken" type="password" placeholder="留空表示不修改" /></label>
|
||||
<label>Webhook 密钥 <input name="webhookSecret" type="password" placeholder="留空表示不修改" /></label>
|
||||
<label>后台访问 Token <input name="adminToken" type="password" placeholder="留空表示不修改" /></label>
|
||||
<p class="hint">Webhook 地址:<code id="hook-url"></code>(在仓库 Settings → Webhooks 中添加,密钥填上面这一项)</p>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>LLM</legend>
|
||||
<legend>LLM(代码审查与历史摘要共用)</legend>
|
||||
<label>接口地址 <input name="llmUrl" placeholder="https://api.openai.com/v1" /></label>
|
||||
<label>API Key <input name="llmToken" type="password" placeholder="留空表示不修改" /></label>
|
||||
<label>模型 <input name="llmModel" placeholder="gpt-5.5" /></label>
|
||||
<label>模型 <input name="llmModel" placeholder="gpt-5.6-sol" /></label>
|
||||
<label>协议 <input name="llmProtocol" placeholder="openai / anthropic" /></label>
|
||||
<label>自定义认证头 <input name="llmAuthHeader" placeholder="留空使用默认" /></label>
|
||||
<label>附加请求头 <input name="llmExtraHeaders" placeholder="K=V,K=V" /></label>
|
||||
@@ -100,6 +118,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="import-modal" class="modal hidden">
|
||||
<div class="modal-body">
|
||||
<h2>从 Gitea 导入仓库</h2>
|
||||
<p class="hint">使用全局 Token 拉取当前账号可见的仓库,点击即可创建监控配置。</p>
|
||||
<input id="import-search" placeholder="按仓库名过滤…" />
|
||||
<div id="import-list" class="import-list"></div>
|
||||
<div class="actions">
|
||||
<button type="button" id="import-close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="manual-modal" class="modal hidden">
|
||||
<div class="modal-body narrow">
|
||||
<h2>立即审查</h2>
|
||||
@@ -108,7 +138,7 @@
|
||||
<p class="hint" id="manual-repo"></p>
|
||||
<label>分支 <input name="ref" placeholder="main" required /></label>
|
||||
<label>提交 SHA <input name="sha" placeholder="40 位 commit hash" required /></label>
|
||||
<label>基准分支 <input name="base_ref" placeholder="main" /></label>
|
||||
<label>基准分支 <input name="base_ref" placeholder="管理分支" /></label>
|
||||
<label>关联 Pull Request 编号(可选) <input name="pr_number" type="number" min="1" /></label>
|
||||
<div class="actions">
|
||||
<button type="submit">加入队列</button>
|
||||
@@ -119,40 +149,83 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="record-modal" class="modal hidden">
|
||||
<div class="modal-body">
|
||||
<h2 id="record-title">审查记录</h2>
|
||||
<div id="record-body"></div>
|
||||
<div class="actions">
|
||||
<button type="button" id="record-resummarise">重新生成摘要</button>
|
||||
<button type="button" id="record-close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal" class="modal hidden">
|
||||
<div class="modal-body">
|
||||
<h2 id="modal-title">仓库配置</h2>
|
||||
<form id="repo-form">
|
||||
<input type="hidden" name="id" />
|
||||
<div class="grid">
|
||||
<label>所有者 <input name="owner" required /></label>
|
||||
<label>仓库名 <input name="name" required /></label>
|
||||
<label>目标分支 <input name="base_branch" placeholder="main" /></label>
|
||||
<label>监听分支模式 <input name="branch_patterns" placeholder="*, release/*" /></label>
|
||||
<label>审查范围
|
||||
<select name="review_scope">
|
||||
<option value="both">Push 与 PR 都审查</option>
|
||||
<option value="pr">仅 Pull Request</option>
|
||||
<option value="push">仅分支 Push</option>
|
||||
</select>
|
||||
<fieldset>
|
||||
<legend>仓库</legend>
|
||||
<label>Git 地址
|
||||
<span class="inline">
|
||||
<input name="repo_url" placeholder="http://192.168.31.51/kgod/myrepo.git" required />
|
||||
<button type="button" id="repo-test">测试连接</button>
|
||||
</span>
|
||||
</label>
|
||||
<label>发布方式
|
||||
<select name="publish_mode">
|
||||
<option value="inline">PR 内联评论</option>
|
||||
<option value="issue-only">仅 Issue</option>
|
||||
</select>
|
||||
<p class="hint" id="repo-parsed"></p>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>分支</legend>
|
||||
<label>管理分支(合并目标)
|
||||
<span class="inline">
|
||||
<input name="managed_branch" placeholder="main" />
|
||||
<button type="button" id="branch-create">克隆创建</button>
|
||||
</span>
|
||||
</label>
|
||||
<label>阻断级别 <input name="block_severity" placeholder="critical,high" /></label>
|
||||
<label>阻断类别 <input name="block_categories" placeholder="security" /></label>
|
||||
<label>Issue 标签 <input name="issue_labels" placeholder="code-review" /></label>
|
||||
<label>最大意见数 <input name="max_comments" type="number" min="1" max="200" /></label>
|
||||
<label>并发数 <input name="concurrency" type="number" min="1" max="16" /></label>
|
||||
<label>排除路径 <input name="excludes" placeholder="**/dist/**,**/*.lock" /></label>
|
||||
<label>仓库专用 Gitea Token <input name="gitea_token" type="password" placeholder="留空使用全局" /></label>
|
||||
<label>仓库专用 LLM Key <input name="llm_token" type="password" placeholder="留空使用全局" /></label>
|
||||
<label>LLM 模型 <input name="llm_model" placeholder="留空使用全局" /></label>
|
||||
<label>审查背景 <input name="background_template" placeholder="补充业务上下文" /></label>
|
||||
</div>
|
||||
<p class="hint">所有检查通过后只合并到这一个分支。</p>
|
||||
<label>检查分支(可多选)
|
||||
<span class="inline">
|
||||
<input name="check_branches" placeholder="main,release/1.0" />
|
||||
<button type="button" id="branch-reload">加载分支</button>
|
||||
</span>
|
||||
</label>
|
||||
<div id="branch-list" class="branch-list"></div>
|
||||
<p class="hint">这些分支都会被监控审查;只有指向管理分支的 PR 才会自动合并。</p>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>审查</legend>
|
||||
<div class="grid">
|
||||
<label>审查范围
|
||||
<select name="review_scope">
|
||||
<option value="both">Push 与 PR 都审查</option>
|
||||
<option value="pr">仅 Pull Request</option>
|
||||
<option value="push">仅分支 Push</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>发布方式
|
||||
<select name="publish_mode">
|
||||
<option value="inline">PR 内联评论</option>
|
||||
<option value="issue-only">仅 Issue</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>阻断级别 <input name="block_severity" placeholder="critical,high" /></label>
|
||||
<label>阻断类别 <input name="block_categories" placeholder="security" /></label>
|
||||
<label>Issue 标签 <input name="issue_labels" placeholder="code-review" /></label>
|
||||
<label>最大意见数 <input name="max_comments" type="number" min="1" max="200" /></label>
|
||||
<label>并发数 <input name="concurrency" type="number" min="1" max="16" /></label>
|
||||
<label>排除路径 <input name="excludes" placeholder="**/dist/**,**/*.lock" /></label>
|
||||
<label>仓库专用 Gitea Token <input name="gitea_token" type="password" placeholder="留空使用全局" /></label>
|
||||
<label>仓库专用 LLM Key <input name="llm_token" type="password" placeholder="留空使用全局" /></label>
|
||||
<label>LLM 模型 <input name="llm_model" placeholder="留空使用全局" /></label>
|
||||
</div>
|
||||
<label>审查背景 / 需求
|
||||
<textarea name="background_template" rows="6" placeholder="补充业务上下文、本次需求说明;会作为审查背景传给模型,并记录到审查历史。"></textarea>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<div class="checks">
|
||||
<label><input type="checkbox" name="enabled" /> 启用</label>
|
||||
<label><input type="checkbox" name="create_issue" /> 发现问题时创建 Issue</label>
|
||||
@@ -179,7 +252,6 @@
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="submit">保存</button>
|
||||
<button type="button" id="discover">测试连接</button>
|
||||
<button type="button" id="modal-close">取消</button>
|
||||
</div>
|
||||
<pre id="repo-result" class="log hidden"></pre>
|
||||
@@ -187,6 +259,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="clone-modal" class="modal hidden">
|
||||
<div class="modal-body narrow">
|
||||
<h2>创建管理分支</h2>
|
||||
<form id="clone-form">
|
||||
<label>新分支名 <input name="new_branch" placeholder="main" required /></label>
|
||||
<label>从哪个分支复制
|
||||
<select name="from_branch" id="clone-source"></select>
|
||||
</label>
|
||||
<div class="actions">
|
||||
<button type="submit">创建</button>
|
||||
<button type="button" id="clone-close">取消</button>
|
||||
</div>
|
||||
<pre id="clone-result" class="log hidden"></pre>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+51
-6
@@ -23,8 +23,10 @@ header {
|
||||
}
|
||||
h1 { font-size: 18px; margin: 0; }
|
||||
h2 { font-size: 15px; margin: 0 0 12px; }
|
||||
h3 { font-size: 14px; margin: 0 0 8px; }
|
||||
.status { color: var(--muted); font-size: 13px; }
|
||||
nav { display: flex; gap: 4px; padding: 12px 24px 0; }
|
||||
header .right { display: flex; align-items: center; gap: 12px; }
|
||||
nav { display: flex; gap: 4px; padding: 12px 24px 0; flex-wrap: wrap; }
|
||||
.tab {
|
||||
background: transparent; border: 1px solid transparent; color: var(--muted);
|
||||
padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 14px;
|
||||
@@ -33,7 +35,7 @@ nav { display: flex; gap: 4px; padding: 12px 24px 0; }
|
||||
main { padding: 0 24px 48px; }
|
||||
.panel { display: none; background: var(--panel); border: 1px solid var(--border); border-radius: 0 8px 8px 8px; padding: 20px; }
|
||||
.panel.active { display: block; }
|
||||
.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
|
||||
.row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
|
||||
button {
|
||||
background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
|
||||
padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
|
||||
@@ -41,6 +43,7 @@ button {
|
||||
button:hover { border-color: var(--accent); }
|
||||
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
||||
button.danger:hover { border-color: var(--err); color: var(--err); }
|
||||
button:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
|
||||
th { color: var(--muted); font-weight: 500; }
|
||||
@@ -54,17 +57,23 @@ code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-si
|
||||
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 18px; padding: 16px; }
|
||||
legend { color: var(--muted); padding: 0 6px; }
|
||||
label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
|
||||
input, select {
|
||||
input, select, textarea {
|
||||
display: block; width: 100%; margin-top: 4px; padding: 7px 9px;
|
||||
background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
|
||||
color: var(--text); font-size: 13px;
|
||||
color: var(--text); font-size: 13px; font-family: inherit;
|
||||
}
|
||||
textarea { resize: vertical; min-height: 120px; max-height: 360px; overflow-y: auto; line-height: 1.6; }
|
||||
.inline { display: flex; gap: 8px; align-items: flex-start; }
|
||||
.inline input { flex: 1; }
|
||||
.inline button { margin-top: 4px; white-space: nowrap; }
|
||||
.checks { display: flex; flex-wrap: wrap; gap: 16px; margin: 8px 0 14px; }
|
||||
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; }
|
||||
.checks input { width: auto; margin: 0; }
|
||||
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 16px; }
|
||||
.actions { display: flex; gap: 8px; margin-top: 10px; }
|
||||
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
|
||||
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
|
||||
.hint.ok { color: var(--ok); }
|
||||
.hint.err { color: var(--err); }
|
||||
.log {
|
||||
background: #0a0c10; border: 1px solid var(--border); border-radius: 6px;
|
||||
padding: 12px; font-size: 12px; overflow: auto; max-height: 420px; white-space: pre-wrap;
|
||||
@@ -75,15 +84,51 @@ input, select {
|
||||
|
||||
/* Keep this last: it has to beat the display rules above. */
|
||||
.hidden { display: none !important; }
|
||||
|
||||
.banner {
|
||||
margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
|
||||
border: 1px solid var(--err); color: var(--err); background: rgba(248,81,73,0.08);
|
||||
}
|
||||
.banner.ok { border-color: var(--ok); color: var(--ok); background: rgba(63,185,80,0.08); }
|
||||
.empty { color: var(--muted); padding: 18px 4px; }
|
||||
header .right { display: flex; align-items: center; gap: 12px; }
|
||||
.linkish {
|
||||
background: none; border: none; color: var(--muted); cursor: pointer;
|
||||
font-size: 13px; text-decoration: underline; padding: 0;
|
||||
}
|
||||
.linkish:hover { color: var(--accent); }
|
||||
|
||||
.branch-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; min-height: 20px; }
|
||||
.branch-list button {
|
||||
padding: 3px 10px; border-radius: 12px; font-size: 12px;
|
||||
}
|
||||
.branch-list button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
|
||||
.import-list { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-top: 10px; }
|
||||
.import-row {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
||||
padding: 10px 14px; border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.import-row:last-child { border-bottom: none; }
|
||||
.import-row .meta { color: var(--muted); font-size: 12px; }
|
||||
.import-row .name { font-family: ui-monospace, Consolas, monospace; }
|
||||
|
||||
.records { display: flex; flex-direction: column; gap: 12px; }
|
||||
.record {
|
||||
border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--panel-2);
|
||||
}
|
||||
.record-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
|
||||
.record-head .who { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
|
||||
.record-meta { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
|
||||
.record-summary {
|
||||
margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--accent);
|
||||
background: rgba(76,141,255,0.06); border-radius: 0 6px 6px 0;
|
||||
white-space: pre-wrap; font-size: 13px; line-height: 1.7;
|
||||
}
|
||||
.record-summary.pending { border-left-color: var(--warn); color: var(--muted); }
|
||||
.record-summary.failed { border-left-color: var(--err); color: var(--muted); }
|
||||
.record-actions { margin-top: 10px; display: flex; gap: 8px; }
|
||||
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13px; margin: 10px 0; }
|
||||
.kv dt { color: var(--muted); }
|
||||
.kv dd { margin: 0; word-break: break-all; }
|
||||
.finding { border-left: 3px solid var(--border); padding: 6px 10px; margin: 6px 0; background: rgba(255,255,255,0.02); }
|
||||
.finding.blocking { border-left-color: var(--err); }
|
||||
.finding .where { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
|
||||
Reference in New Issue
Block a user