mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-12-01 12:43:30 +01:00
Merge pull request #403 from Sycun/codex/unified-ui-upstream
feat(ui): unify responsive cards and detail drawers
This commit is contained in:
15 files changed
+1609
-53
No files matched your search
@@ -0,0 +1,67 @@
|
||||
# 界面样式约定
|
||||
|
||||
主应用的公共样式位于 `web/static/css/design-system.css`,在模块与移动端 CSS 后加载。
|
||||
颜色沿用现有主题变量;抽屉外框统一为直角,卡片圆角 16px,控件圆角 10px,桌面正文内边距 24px,移动端 16px。
|
||||
状态色、选中态、图表、终端和工作流画布保留各自的业务语义。
|
||||
|
||||
## 容器选择
|
||||
|
||||
- 详情、日志、长表单:右侧抽屉,默认 720px;代码、长文本等宽编辑面板 960px;标题栏可展开至 1440px。
|
||||
- 手机(小于 768px):抽屉全屏,适配安全区,正文单独滚动,底部操作保持可见。
|
||||
- 确认、重命名、简短绑定:居中短弹窗,手机上同样保持紧凑。
|
||||
- 数据比较和批量操作继续使用表格;终端、工作流、会话工作区不强制改成卡片列表。
|
||||
|
||||
`web/static/js/modal.js` 的 `DRAWER_IDS` 和 `WIDE_IDS` 管理既有模块迁移清单。
|
||||
新模块应通过 `openAppModal` / `closeAppModal` 开关容器,关闭时保留原有清理和未保存提示逻辑。
|
||||
共用生命周期负责嵌套层级、背景滚动锁定、焦点返回、Tab 焦点约束和 Escape 触发原关闭按钮。
|
||||
异步更新的标题栏会自动补齐展开按钮。短 C2 休眠设置仍为弹窗。
|
||||
|
||||
不要再为单个抽屉添加独立的定位、遮罩、圆角或主题色覆盖。
|
||||
现阶段公共布局中少量 `!important` 用于覆盖历史内联宽高和移动端旧规则;后续修改这些模块时可逐步去除对应历史声明。
|
||||
|
||||
## 验证
|
||||
|
||||
前端回归:
|
||||
|
||||
```sh
|
||||
node --test web/static/js/*.test.cjs
|
||||
```
|
||||
|
||||
浏览器验证需要外部安装的 Playwright 和 Chromium,例如:
|
||||
|
||||
```sh
|
||||
npm install --prefix /tmp/csai-ui-tools playwright
|
||||
/tmp/csai-ui-tools/node_modules/.bin/playwright install chromium
|
||||
NODE_PATH=/tmp/csai-ui-tools/node_modules node scripts/check-ui-design-system.cjs
|
||||
```
|
||||
|
||||
脚本使用真实模板、样式和选定模块的真实渲染函数,配以合成数据;不启动后端或访问测试目标。
|
||||
检查 1440、1024、390、360px 四档屏宽和深浅主题,验证抽屉边界、内部横向溢出、底栏、嵌套层级、展开、键盘关闭、焦点返回,以及主页面横向溢出。
|
||||
截图与结果默认写入系统临时目录,也可通过 `CSAI_UI_ARTIFACTS` 指定目录。
|
||||
这覆盖界面布局和公共交互,不等同于真实后端数据、保存操作、所有下拉菜单状态或物理手机软键盘的完整验收。
|
||||
|
||||
### 真实数据形态回归
|
||||
|
||||
`check-ui-design-system.cjs` 现在调用 `ui-realistic-scenarios.cjs`,并加载真实 i18next/翻译实现。
|
||||
回归数据依据实际页面的数量、文本长度和按钮状态匿名构造,不复制目标地址、凭据或业务证据。
|
||||
|
||||
- 365 条队列任务,分别渲染暂停、运行、完成状态;验证真实操作按钮不会挤压标题或越界。
|
||||
- 626 个工具、614 个已启用工具及长描述;使用真实角色编辑入口检查统计换行和正文滚动。
|
||||
- 角色与多文件 Skill 的新增/编辑切换,以及打开编辑后跨越桌面/手机断点;验证翻译刷新不改变编辑标题。
|
||||
- 50 条长漏洞记录和三页分页:验证手机整页滚动,标题与分页不会固定占用记录区。
|
||||
|
||||
所有场景都在四档屏宽与两种主题下运行;夹具请求拒绝非 GET 操作。
|
||||
需要定位单个断点时可设置 `CSAI_UI_WIDTHS=390`;提交前省略该变量运行完整矩阵。
|
||||
|
||||
### 队列动态文案与按钮对比度
|
||||
|
||||
队列标题将可翻译的前缀与原样保留的队列名称分开渲染;执行按钮的 `data-i18n` 随暂停、待执行及 Cron 状态更新。
|
||||
主要操作的小号按钮明确使用强调色背景和配套文字色,避免旧尺寸样式把背景改灰后仍保留深色文字。
|
||||
|
||||
回归增加了:暂停/待执行/运行/完成/取消、Cron 开关、中英文切换、桌面与手机断点切换、空标题和含特殊字符的标题。
|
||||
针对可见的开始/继续/重跑按钮,检查正常、悬停和键盘焦点状态下的计算颜色,要求文字与不透明背景的对比度不低于 4.5:1;每档尺寸和主题的计算结果保存为 `queue-contrast-*.json`。
|
||||
浏览器回归使用真实 i18next 翻译函数,不再用固定中文替代函数覆盖它。
|
||||
|
||||
Skill 的“查看”入口动态创建 `skill-view-modal`,与编辑入口共用宽抽屉。回归同时验证摘要展示、按需加载全文、展开、Escape 清理以及“查看 → 编辑”切换,防止只验证编辑表单而遗漏只读详情入口。
|
||||
|
||||
信息收集的字段全文、AI 查询解析结果,以及 WebShell 数据库连接配置也使用公共抽屉。信息收集动态节点采用标准 header/body/footer 类和公共关闭逻辑;回归使用长文本、警告说明与离线数据库配置夹具,检查滚动、重复打开、复制、仅应用查询语法和关闭清理,不执行外部查询或数据库连接。
|
||||
@@ -0,0 +1,372 @@
|
||||
/** Offline Chromium layout/keyboard regression checks using production HTML/CSS/renderers.
|
||||
* Install Playwright outside the source tree; run with NODE_PATH pointing to that node_modules.
|
||||
* Uses synthetic records; never starts the backend or sends requests to assessment targets.
|
||||
*/
|
||||
const { chromium } = require("playwright");
|
||||
const fs = require("fs"),
|
||||
http = require("http"),
|
||||
path = require("path");
|
||||
const root = path.resolve(__dirname, "..");
|
||||
const out =
|
||||
process.env.CSAI_UI_ARTIFACTS ||
|
||||
fs.mkdtempSync(path.join(require("os").tmpdir(), "csai-ui-"));
|
||||
fs.mkdirSync(out, { recursive: true });
|
||||
const html = fs
|
||||
.readFileSync(root + "/web/templates/index.html", "utf8")
|
||||
.replace(/<script\b[^>]*>[\s\S]*?<\/script>/g, "")
|
||||
.replace(/\{\{\.Version\}\}/g, "UI preview")
|
||||
.replace(
|
||||
"</body>",
|
||||
'<script>window.switchPage=function(){};</script><script src="/static/vendor/i18next.min.js"></script><script src="/static/js/i18n.js"></script><script src="/static/js/modal.js"></script><script src="/static/js/mobile-ui.js"></script></body>',
|
||||
);
|
||||
const server = http.createServer((req, res) => {
|
||||
const p = req.url.split("?")[0];
|
||||
if (p.startsWith("/api/")) {
|
||||
res.setHeader("Content-Type", "application/json");
|
||||
return res.end("{}");
|
||||
}
|
||||
if (p === "/") {
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
return res.end(html);
|
||||
}
|
||||
const f = path.join(root, "web", p);
|
||||
if (!f.startsWith(root + "/web/") || !fs.existsSync(f)) {
|
||||
res.statusCode = 404;
|
||||
return res.end();
|
||||
}
|
||||
res.setHeader(
|
||||
"Content-Type",
|
||||
p.endsWith(".css")
|
||||
? "text/css"
|
||||
: p.endsWith(".js")
|
||||
? "application/javascript"
|
||||
: "application/octet-stream",
|
||||
);
|
||||
res.end(fs.readFileSync(f));
|
||||
});
|
||||
(async () => {
|
||||
await new Promise((r) => server.listen(0, "127.0.0.1", r));
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const findings = [];
|
||||
let count = 0;
|
||||
for (const width of process.env.CSAI_UI_WIDTHS
|
||||
? process.env.CSAI_UI_WIDTHS.split(",").map(Number)
|
||||
: [1440, 1024, 390, 360])
|
||||
for (const theme of ["light", "dark"]) {
|
||||
const height =
|
||||
width === 360 ? 640 : width === 390 ? 844 : width === 1024 ? 768 : 900;
|
||||
const page = await browser.newPage({
|
||||
viewport: { width, height },
|
||||
colorScheme: theme,
|
||||
locale: "zh-CN",
|
||||
});
|
||||
page.on("pageerror", (e) =>
|
||||
findings.push({ width, theme, issue: e.message }),
|
||||
);
|
||||
await page.goto("http://127.0.0.1:" + server.address().port);
|
||||
await page.evaluate(() => window.i18nReady);
|
||||
await page.evaluate((t) => {
|
||||
document.documentElement.dataset.theme = t;
|
||||
document
|
||||
.querySelectorAll(".page")
|
||||
.forEach((e) => e.classList.remove("active"));
|
||||
document
|
||||
.getElementById("page-roles-management")
|
||||
.classList.add("active");
|
||||
}, theme);
|
||||
const ids = await page
|
||||
.locator('[data-ui-surface="drawer"]')
|
||||
.evaluateAll((els) => els.map((e) => e.id));
|
||||
for (const id of ids) {
|
||||
// A drawer nested in a page is visible only while that page is active.
|
||||
await page.evaluate((id) => {
|
||||
const e = document.getElementById(id);
|
||||
e.closest(".settings-section-content")?.classList.add("active");
|
||||
const parent = e.closest(".page");
|
||||
if (parent) {
|
||||
document
|
||||
.querySelectorAll(".page")
|
||||
.forEach((p) => p.classList.remove("active"));
|
||||
parent.classList.add("active");
|
||||
}
|
||||
openAppModal(id);
|
||||
}, id);
|
||||
await page.waitForTimeout(220);
|
||||
const info = await page.evaluate((id) => {
|
||||
const e = document.getElementById(id),
|
||||
p = e.firstElementChild,
|
||||
r = p.getBoundingClientRect(),
|
||||
s = getComputedStyle(p),
|
||||
b = p.querySelector(
|
||||
".modal-body,.projects-modal-body,.c2-modal-body,#vulnerability-inspector-body",
|
||||
);
|
||||
return {
|
||||
id,
|
||||
x: r.x,
|
||||
y: r.y,
|
||||
w: r.width,
|
||||
h: r.height,
|
||||
bg: s.backgroundColor,
|
||||
corners: [
|
||||
s.borderTopLeftRadius,
|
||||
s.borderTopRightRadius,
|
||||
s.borderBottomRightRadius,
|
||||
s.borderBottomLeftRadius,
|
||||
],
|
||||
overflow: b ? b.scrollWidth > b.clientWidth + 2 : false,
|
||||
footer: p
|
||||
.querySelector(
|
||||
".modal-footer,.projects-modal-footer,.c2-modal-footer",
|
||||
)
|
||||
?.getBoundingClientRect().bottom,
|
||||
};
|
||||
}, id);
|
||||
count++;
|
||||
const channel = Number(info.bg.match(/\d+/)?.[0]);
|
||||
if (
|
||||
(theme === "dark" && channel > 100) ||
|
||||
(theme === "light" && channel < 200)
|
||||
)
|
||||
findings.push({
|
||||
width,
|
||||
theme,
|
||||
id,
|
||||
issue: "surface theme mismatch",
|
||||
bg: info.bg,
|
||||
});
|
||||
if (
|
||||
info.x < -0.5 ||
|
||||
info.y < -0.5 ||
|
||||
Math.abs(info.x + info.w - width) > 2 ||
|
||||
Math.abs(info.h - height) > 2 ||
|
||||
info.footer > height + 1 ||
|
||||
info.overflow ||
|
||||
info.corners.some((radius) => radius !== "0px")
|
||||
)
|
||||
findings.push({ width, theme, ...info });
|
||||
if (
|
||||
[
|
||||
"role-modal",
|
||||
"asset-editor-modal",
|
||||
"vulnerability-modal",
|
||||
"skill-modal",
|
||||
].includes(id)
|
||||
)
|
||||
await page.screenshot({
|
||||
animations: "disabled",
|
||||
path: out + "/" + id + "-" + width + "-" + theme + ".png",
|
||||
});
|
||||
await page.evaluate((id) => closeAppModal(id), id);
|
||||
}
|
||||
// Compact actions should remain short on mobile; test nested layer and restoration.
|
||||
await page.evaluate(() => {
|
||||
openAppModal("fact-detail-modal");
|
||||
openAppModal("fact-modal");
|
||||
});
|
||||
const nested = await page.evaluate(
|
||||
() =>
|
||||
Number(
|
||||
getComputedStyle(document.getElementById("fact-modal")).zIndex,
|
||||
) >
|
||||
Number(
|
||||
getComputedStyle(document.getElementById("fact-detail-modal"))
|
||||
.zIndex,
|
||||
),
|
||||
);
|
||||
if (!nested) throw new Error("nested stacking");
|
||||
await page.evaluate(() => {
|
||||
closeAppModal("fact-modal");
|
||||
closeAppModal("fact-detail-modal");
|
||||
openAppModal("project-modal");
|
||||
});
|
||||
const small = await page.locator("#project-modal > div").boundingBox();
|
||||
if (small.height >= height - 10)
|
||||
throw new Error("short dialog is full screen");
|
||||
await page.evaluate(() => closeAppModal("project-modal"));
|
||||
if (width === 1440) {
|
||||
await page.evaluate(() => openAppModal("role-modal"));
|
||||
await page.locator("#role-modal .app-drawer-expand").click();
|
||||
const expanded = await page.locator("#role-modal > div").boundingBox();
|
||||
if (expanded.width < 1200) throw new Error("expand failed");
|
||||
await page.evaluate(() => closeAppModal("role-modal"));
|
||||
}
|
||||
// Load production renderers with synthetic data; no backend or target execution.
|
||||
await page.evaluate(() => {
|
||||
window.apiFetch = async () => ({
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
log: {
|
||||
createdAt: "2026-11-15T08:00:00Z",
|
||||
category: "config",
|
||||
action: "apply",
|
||||
result: "success",
|
||||
message: "配置已保存",
|
||||
detail: { source: "UI fixture" },
|
||||
},
|
||||
}),
|
||||
});
|
||||
window.showToast = (m) => console.log("TOAST", m);
|
||||
});
|
||||
for (const script of ["knowledge", "audit", "roles", "c2"])
|
||||
await page.addScriptTag({ url: "/static/js/" + script + ".js" });
|
||||
await page.evaluate(() => showAuditLogDetail("fixture"));
|
||||
await page.waitForTimeout(100);
|
||||
if (
|
||||
(await page
|
||||
.locator("#audit-detail-modal .app-drawer-expand")
|
||||
.count()) !== 1
|
||||
) {
|
||||
console.log(
|
||||
await page
|
||||
.locator("#audit-detail-modal")
|
||||
.evaluateAll((es) => es.map((e) => e.outerHTML)),
|
||||
);
|
||||
throw new Error("deferred audit header missing");
|
||||
}
|
||||
await page.screenshot({
|
||||
animations: "disabled",
|
||||
path: out + "/audit-" + width + "-" + theme + ".png",
|
||||
});
|
||||
await page.keyboard.press("Escape");
|
||||
if (await page.locator("#audit-detail-modal").count())
|
||||
throw new Error("Escape did not run audit cleanup");
|
||||
await page.evaluate(() =>
|
||||
showRetrievalLogDetailsModal(
|
||||
{
|
||||
createdAt: "2026-11-15T08:00:00Z",
|
||||
query: "查找接口鉴权检查方法",
|
||||
riskType: "鉴权",
|
||||
},
|
||||
[
|
||||
{
|
||||
title: "接口鉴权检查",
|
||||
category: "Web",
|
||||
content: "验证不同角色之间的数据访问边界。",
|
||||
},
|
||||
],
|
||||
),
|
||||
);
|
||||
await page.waitForTimeout(100);
|
||||
await page.screenshot({
|
||||
animations: "disabled",
|
||||
path: out + "/retrieval-" + width + "-" + theme + ".png",
|
||||
});
|
||||
await page.evaluate(() => closeRetrievalLogDetailsModal());
|
||||
await page.route("**/api/**", (route) =>
|
||||
route.fulfill({ json: { profiles: [], projects: [], listeners: [] } }),
|
||||
);
|
||||
await page.evaluate(() => C2.showCreateListenerModal());
|
||||
await page.waitForTimeout(200);
|
||||
if ((await page.locator("#c2-modal .app-drawer-expand").count()) !== 1)
|
||||
throw new Error("C2 header missing");
|
||||
await page.screenshot({
|
||||
animations: "disabled",
|
||||
path: out + "/c2-" + width + "-" + theme + ".png",
|
||||
});
|
||||
await page.evaluate(() => C2.closeModal());
|
||||
// Test focus wrap, native close cleanup and restoration through real role handlers.
|
||||
await page.evaluate(() => {
|
||||
const b = document.createElement("button");
|
||||
b.textContent = "Open editor";
|
||||
document.body.appendChild(b);
|
||||
b.focus();
|
||||
window.fixtureFocus = b;
|
||||
openAppModal("role-modal");
|
||||
});
|
||||
await page.waitForTimeout(30);
|
||||
await page.locator("#role-modal .modal-footer .btn-primary").focus();
|
||||
await page.keyboard.press("Tab");
|
||||
if (
|
||||
!(await page.evaluate(() =>
|
||||
document
|
||||
.getElementById("role-modal")
|
||||
.contains(document.activeElement),
|
||||
))
|
||||
)
|
||||
throw new Error("focus escaped");
|
||||
await page.keyboard.press("Escape");
|
||||
if (
|
||||
!(await page.evaluate(
|
||||
() =>
|
||||
!isAppModalOpen("role-modal") &&
|
||||
document.activeElement === window.fixtureFocus,
|
||||
))
|
||||
)
|
||||
throw new Error("close/focus restore failed");
|
||||
await page.evaluate(() => {
|
||||
window.fixtureFocus.remove();
|
||||
roles = [
|
||||
{
|
||||
name: "安全审计",
|
||||
description: "检查授权范围内的代码与配置,整理可复核的证据。",
|
||||
tools: ["read_file", "search_code"],
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
name: "报告整理",
|
||||
description: "汇总已验证发现,生成清晰的报告。",
|
||||
tools: [],
|
||||
enabled: true,
|
||||
},
|
||||
];
|
||||
renderRolesList();
|
||||
});
|
||||
const pageIds = await page
|
||||
.locator(".page[id]")
|
||||
.evaluateAll((es) => es.map((e) => e.id));
|
||||
for (const id of pageIds) {
|
||||
await page.evaluate((id) => {
|
||||
document
|
||||
.querySelectorAll(".page")
|
||||
.forEach((e) => e.classList.toggle("active", e.id === id));
|
||||
if (window.CSAMobile)
|
||||
CSAMobile.wrapTables(document.getElementById(id));
|
||||
}, id);
|
||||
const overflow = await page.evaluate(
|
||||
() => document.documentElement.scrollWidth > innerWidth + 2,
|
||||
);
|
||||
if (overflow)
|
||||
findings.push({ width, theme, id, issue: "page overflow" });
|
||||
if (
|
||||
[
|
||||
"page-dashboard",
|
||||
"page-roles-management",
|
||||
"page-asset-library",
|
||||
"page-workflows",
|
||||
"page-settings",
|
||||
].includes(id)
|
||||
)
|
||||
await page.screenshot({
|
||||
animations: "disabled",
|
||||
path: out + "/" + id + "-" + width + "-" + theme + ".png",
|
||||
});
|
||||
}
|
||||
await require("./ui-realistic-scenarios.cjs")({
|
||||
page,
|
||||
width,
|
||||
height,
|
||||
theme,
|
||||
out,
|
||||
});
|
||||
await require("./ui-extra-drawers.cjs")({
|
||||
page,
|
||||
width,
|
||||
height,
|
||||
theme,
|
||||
out,
|
||||
});
|
||||
await page.close();
|
||||
}
|
||||
fs.writeFileSync(
|
||||
out + "/results.json",
|
||||
JSON.stringify({ count, findings }, null, 2),
|
||||
);
|
||||
console.log(JSON.stringify({ count, findings, artifacts: out }, null, 2));
|
||||
if (findings.length) process.exitCode = 1;
|
||||
await browser.close();
|
||||
server.close();
|
||||
})().catch((e) => {
|
||||
console.error(e);
|
||||
server.close();
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,209 @@
|
||||
// Exercise the production dynamic renderers with offline data only.
|
||||
const assert = require("node:assert/strict");
|
||||
module.exports = async ({ page, width, height, theme, out }) => {
|
||||
for (const name of ["info-collect", "webshell"])
|
||||
await page.addScriptTag({ url: "/static/js/" + name + ".js" });
|
||||
const activate = (id) =>
|
||||
page.evaluate(
|
||||
(id) =>
|
||||
document
|
||||
.querySelectorAll(".page")
|
||||
.forEach((e) => e.classList.toggle("active", e.id === id)),
|
||||
id,
|
||||
);
|
||||
const verify = async (id, name) => {
|
||||
await page.locator("#" + id + " .modal-body").waitFor();
|
||||
await page.waitForTimeout(220);
|
||||
const box = await page.locator("#" + id).evaluate((e) => {
|
||||
const p = e.querySelector(".modal-content"),
|
||||
b = e.querySelector(".modal-body"),
|
||||
h = e.querySelector(".modal-header h2"),
|
||||
r = p.getBoundingClientRect(),
|
||||
s = getComputedStyle(p);
|
||||
return {
|
||||
surface: e.dataset.uiSurface,
|
||||
x: r.x,
|
||||
right: r.right,
|
||||
width: r.width,
|
||||
height: r.height,
|
||||
radius: s.borderRadius,
|
||||
bg: s.backgroundColor,
|
||||
titleColor: getComputedStyle(h).color,
|
||||
bodyWidth: b.clientWidth,
|
||||
bodyScroll: b.scrollWidth,
|
||||
footer: e.querySelector(".modal-footer").getBoundingClientRect().bottom,
|
||||
expandedButton: !!e.querySelector(".app-drawer-expand"),
|
||||
};
|
||||
});
|
||||
assert.equal(box.surface, "drawer");
|
||||
assert.equal(box.radius, "0px");
|
||||
assert(box.expandedButton);
|
||||
assert(
|
||||
Math.abs(box.right - width) < 2 && Math.abs(box.height - height) < 2,
|
||||
JSON.stringify(box),
|
||||
);
|
||||
assert(
|
||||
box.width <= (width < 768 ? width : width - 48) + 1 && box.width > 0,
|
||||
JSON.stringify(box),
|
||||
);
|
||||
assert(
|
||||
box.footer <= height + 1 && box.bodyScroll <= box.bodyWidth + 2,
|
||||
JSON.stringify(box),
|
||||
);
|
||||
assert.equal(
|
||||
box.bg,
|
||||
theme === "dark" ? "rgb(17, 24, 39)" : "rgb(255, 255, 255)",
|
||||
);
|
||||
if (theme === "dark")
|
||||
assert(Number(box.titleColor.match(/\d+/)[0]) > 150, JSON.stringify(box));
|
||||
await page.screenshot({
|
||||
animations: "disabled",
|
||||
path: `${out}/extra-${name}-${width}-${theme}.png`,
|
||||
});
|
||||
if (width >= 768) {
|
||||
await page.locator("#" + id + " .app-drawer-expand").click();
|
||||
assert(
|
||||
(await page.locator("#" + id + " .modal-content").boundingBox()).width >
|
||||
box.width,
|
||||
);
|
||||
await page.locator("#" + id + " .app-drawer-expand").click();
|
||||
}
|
||||
};
|
||||
await activate("page-info-collect");
|
||||
await page.evaluate(() => {
|
||||
window.extraDrawerRequests = [];
|
||||
window.apiFetch = async (url, options = {}) => {
|
||||
extraDrawerRequests.push({ url, method: options.method || "GET" });
|
||||
return { ok: true, json: async () => ({ conversations: [] }) };
|
||||
};
|
||||
Object.defineProperty(navigator, "clipboard", {
|
||||
configurable: true,
|
||||
value: {
|
||||
writeText: async (text) => {
|
||||
window.extraDrawerCopied = text;
|
||||
},
|
||||
},
|
||||
});
|
||||
window.extraDrawerText =
|
||||
"Content-Security-Policy: " +
|
||||
"example.test ".repeat(120) +
|
||||
"\n" +
|
||||
"详细字段内容 <script>不应执行</script>\n".repeat(60);
|
||||
showCellDetailModal("响应头完整内容", extraDrawerText);
|
||||
});
|
||||
await verify("info-collect-cell-modal", "cell-fulltext");
|
||||
assert.equal(
|
||||
await page.locator(".info-collect-cell-modal-pre").textContent(),
|
||||
await page.evaluate(() => extraDrawerText),
|
||||
);
|
||||
await page.locator("#info-collect-cell-modal-copy").click();
|
||||
assert.equal(
|
||||
await page.evaluate(() => extraDrawerCopied),
|
||||
await page.evaluate(() => extraDrawerText),
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
assert.equal(await page.locator("#info-collect-cell-modal").count(), 0);
|
||||
await page.evaluate(() => {
|
||||
showCellDetailModal("旧字段", "旧值");
|
||||
showCellDetailModal("新字段", "新值");
|
||||
});
|
||||
assert.equal(await page.locator("#info-collect-cell-modal").count(), 1);
|
||||
await page.locator("#info-collect-cell-modal-ok").click();
|
||||
assert.equal(
|
||||
await page.evaluate(() =>
|
||||
document.body.classList.contains("app-modal-open"),
|
||||
),
|
||||
false,
|
||||
);
|
||||
await page.evaluate(() =>
|
||||
showFofaParseModal("查找演示资产", {
|
||||
query: 'domain="example.test"',
|
||||
warnings: ["仅展示语法,未发起查询。".repeat(20)],
|
||||
explanation: "查询条件解释。\n".repeat(80),
|
||||
}),
|
||||
);
|
||||
await verify("fofa-parse-modal", "parse-result");
|
||||
await page.locator("#fofa-parse-query").fill('domain="demo.example.test"');
|
||||
await page.locator("#fofa-parse-apply").click();
|
||||
assert.equal(
|
||||
await page.locator("#fofa-query").inputValue(),
|
||||
'domain="demo.example.test"',
|
||||
);
|
||||
assert.equal(await page.locator("#fofa-parse-modal").count(), 0);
|
||||
assert.equal(
|
||||
await page.evaluate(() => extraDrawerRequests.length),
|
||||
0,
|
||||
"Applying syntax must not query a provider",
|
||||
);
|
||||
await page.evaluate(() => {
|
||||
showFofaParseModal("旧请求", { query: "old" });
|
||||
showFofaParseModal("新请求", { query: "new" });
|
||||
});
|
||||
await page.locator("#fofa-parse-query").waitFor();
|
||||
assert.equal(await page.locator("#fofa-parse-query").inputValue(), "new");
|
||||
await page.keyboard.press("Escape");
|
||||
assert.equal(await page.locator("#fofa-parse-modal").count(), 0);
|
||||
assert.equal(
|
||||
await page.evaluate(() =>
|
||||
document.body.classList.contains("app-modal-open"),
|
||||
),
|
||||
false,
|
||||
);
|
||||
await activate("page-webshell");
|
||||
await page.evaluate(() => {
|
||||
// Keep terminal and persistence transports out of this UI fixture. The actual
|
||||
// workspace renderer and DB add/edit/close handlers still execute unchanged.
|
||||
initWebshellTerminal = () => {};
|
||||
queueWebshellPersistStateSave = () => {};
|
||||
webshellConnections = [
|
||||
{
|
||||
id: "offline-ui",
|
||||
name: "离线界面回归",
|
||||
url: "https://example.test",
|
||||
type: "php",
|
||||
project_id: "",
|
||||
},
|
||||
];
|
||||
selectWebshell("offline-ui", true);
|
||||
});
|
||||
await page.locator('.webshell-tab[data-tab="db"]').click();
|
||||
await page.locator("#webshell-db-add-profile-btn").click();
|
||||
await verify("webshell-db-profile-modal", "db-add");
|
||||
await page.locator("#webshell-db-profile-cancel-btn").click();
|
||||
await page
|
||||
.locator('#webshell-db-profiles [data-action="edit"]')
|
||||
.first()
|
||||
.click();
|
||||
await verify("webshell-db-profile-modal", "db-edit");
|
||||
const toolbarBackground = await page
|
||||
.locator("#webshell-db-profile-modal .webshell-db-toolbar")
|
||||
.evaluate((e) => getComputedStyle(e).backgroundColor);
|
||||
if (theme === "dark")
|
||||
assert(Number(toolbarBackground.match(/\d+/)[0]) < 100, toolbarBackground);
|
||||
|
||||
await page.locator("#webshell-db-type").selectOption("sqlite");
|
||||
assert(await page.locator("#webshell-db-sqlite-path").isVisible());
|
||||
assert(!(await page.locator("#webshell-db-host").isVisible()));
|
||||
await page.keyboard.press("Escape");
|
||||
assert(!(await page.locator("#webshell-db-profile-modal").isVisible()));
|
||||
assert.equal(
|
||||
await page.evaluate(() =>
|
||||
document.body.classList.contains("app-modal-open"),
|
||||
),
|
||||
false,
|
||||
);
|
||||
const requests = await page.evaluate(() => extraDrawerRequests);
|
||||
assert(
|
||||
requests.every(
|
||||
(r) =>
|
||||
r.method === "GET" &&
|
||||
[
|
||||
"/api/roles",
|
||||
"/api/config",
|
||||
"/api/webshell/connections/offline-ui/ai-conversations",
|
||||
"/api/webshell/connections/offline-ui/ai-history",
|
||||
].includes(r.url),
|
||||
),
|
||||
JSON.stringify(requests),
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,488 @@
|
||||
// Anonymized reproductions of populated UI states: 365 tasks, 626 tools,
|
||||
// 614 enabled tools, multi-file skill, 50 long findings. All writes are rejected.
|
||||
const assert = require("node:assert/strict");
|
||||
module.exports = async function ({ page, width, height, theme, out }) {
|
||||
for (const script of [
|
||||
"tasks",
|
||||
"skills",
|
||||
"vulnerability",
|
||||
"vulnerability-workspace",
|
||||
])
|
||||
await page.addScriptTag({ url: "/static/js/" + script + ".js" });
|
||||
await page.evaluate(() => {
|
||||
const tools = Array.from({ length: 626 }, (_, i) => ({
|
||||
name: "review_tool_" + i,
|
||||
description: "检查授权范围内的接口、权限和配置,保留可复核证据。".repeat(
|
||||
4,
|
||||
),
|
||||
enabled: i < 614,
|
||||
}));
|
||||
const role = {
|
||||
name: "界面回归角色",
|
||||
description: "真实规模的长描述与工具清单",
|
||||
enabled: true,
|
||||
tools: [],
|
||||
user_prompt: "根据已有证据整理报告。".repeat(12),
|
||||
};
|
||||
const queue = {
|
||||
id: "ui-fixture",
|
||||
title: "多目标授权评估回归队列",
|
||||
status: "paused",
|
||||
role: role.name,
|
||||
agentMode: "single",
|
||||
scheduleMode: "manual",
|
||||
concurrency: 2,
|
||||
totalTasks: 365,
|
||||
completedTasks: 34,
|
||||
createdAt: "2026-11-10T13:01:13Z",
|
||||
tasks: Array.from({ length: 365 }, (_, i) => ({
|
||||
id: "task-" + i,
|
||||
status: i < 34 ? "completed" : "pending",
|
||||
message:
|
||||
"https://long-service-name-" + i + ".example.test/verification",
|
||||
})),
|
||||
};
|
||||
window.fixtureQueue = queue;
|
||||
window.apiFetch = async (input, opts = {}) => {
|
||||
if (opts.method && opts.method !== "GET")
|
||||
throw new Error("UI regression must not write: " + input);
|
||||
const url = new URL(input, location.origin);
|
||||
let data = {};
|
||||
if (url.pathname === "/api/roles") data = { roles: [role] };
|
||||
else if (url.pathname === "/api/config/tools") {
|
||||
const size = Number(url.searchParams.get("page_size") || 20),
|
||||
index = Number(url.searchParams.get("page") || 1);
|
||||
data = {
|
||||
tools: tools.slice((index - 1) * size, index * size),
|
||||
total: 626,
|
||||
total_enabled: 614,
|
||||
total_pages: Math.ceil(626 / size),
|
||||
page: index,
|
||||
page_size: size,
|
||||
};
|
||||
} else if (url.pathname === "/api/batch-tasks/ui-fixture")
|
||||
data = { queue };
|
||||
else if (url.pathname.endsWith("/files"))
|
||||
data = {
|
||||
files: [
|
||||
{ path: "SKILL.md" },
|
||||
{ path: "references/long-reference-name.md" },
|
||||
{ path: "assets/README.txt" },
|
||||
],
|
||||
};
|
||||
else if (url.pathname.startsWith("/api/skills/"))
|
||||
data = {
|
||||
skill: {
|
||||
id: "review-skill",
|
||||
description: "多文件技能包编辑测试",
|
||||
name: "review-skill",
|
||||
path: "skills/review-skill",
|
||||
scripts: [
|
||||
{ rel_path: "scripts/check.py", description: "离线证据校核" },
|
||||
],
|
||||
content:
|
||||
url.searchParams.get("depth") === "summary"
|
||||
? "# 技能摘要\n按需加载正文。"
|
||||
: "# 审核步骤\n" + "核对已有证据。\n".repeat(40),
|
||||
},
|
||||
};
|
||||
return { ok: true, json: async () => data };
|
||||
};
|
||||
window.showNotification = (message, type) => {
|
||||
if (type === "error") throw new Error(message);
|
||||
};
|
||||
roles = [role];
|
||||
});
|
||||
const activate = async (id) =>
|
||||
page.evaluate(
|
||||
(id) =>
|
||||
document
|
||||
.querySelectorAll(".page")
|
||||
.forEach((e) => e.classList.toggle("active", e.id === id)),
|
||||
id,
|
||||
);
|
||||
const shot = async (name) =>
|
||||
page.screenshot({
|
||||
animations: "disabled",
|
||||
path: `${out}/real-${name}-${width}-${theme}.png`,
|
||||
});
|
||||
const contrastResults = [];
|
||||
await activate("page-tasks");
|
||||
const states = [
|
||||
{ status: "paused", scheduleMode: "manual", label: "继续执行" },
|
||||
{ status: "pending", scheduleMode: "manual", label: "开始执行" },
|
||||
{
|
||||
status: "pending",
|
||||
scheduleMode: "cron",
|
||||
scheduleEnabled: true,
|
||||
label: "立即执行一轮",
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
scheduleMode: "cron",
|
||||
scheduleEnabled: false,
|
||||
label: "开始执行",
|
||||
},
|
||||
{ status: "running", scheduleMode: "manual" },
|
||||
{ status: "completed", scheduleMode: "manual" },
|
||||
{ status: "cancelled", scheduleMode: "manual" },
|
||||
];
|
||||
for (const state of states) {
|
||||
await page.evaluate(async (state) => {
|
||||
Object.assign(fixtureQueue, state);
|
||||
await showBatchQueueDetail("ui-fixture");
|
||||
}, state);
|
||||
await page
|
||||
.locator("#batch-queue-detail-content .batch-task-item")
|
||||
.first()
|
||||
.waitFor();
|
||||
const layout = await page
|
||||
.locator("#batch-queue-detail-modal .modal-header")
|
||||
.evaluate((e) => {
|
||||
const title = e.querySelector("h2").getBoundingClientRect(),
|
||||
header = e.getBoundingClientRect();
|
||||
const controls = Array.from(e.querySelectorAll("button"))
|
||||
.filter((b) => b.getClientRects().length)
|
||||
.map((b) => b.getBoundingClientRect());
|
||||
return {
|
||||
titleWidth: title.width,
|
||||
headerHeight: header.height,
|
||||
allInside: controls.every(
|
||||
(r) => r.left >= header.left && r.right <= header.right + 1,
|
||||
),
|
||||
titleOverlaps: controls.some(
|
||||
(r) =>
|
||||
r.left < title.right &&
|
||||
r.right > title.left &&
|
||||
r.top < title.bottom &&
|
||||
r.bottom > title.top,
|
||||
),
|
||||
};
|
||||
});
|
||||
assert(layout.titleWidth > 200, JSON.stringify(layout));
|
||||
assert(layout.headerHeight < 190, JSON.stringify(layout));
|
||||
assert(layout.allInside && !layout.titleOverlaps, JSON.stringify(layout));
|
||||
await page.evaluate(() => applyTranslations(document.body));
|
||||
const assertLabels = async () => {
|
||||
const text = await page.locator("#batch-queue-detail-title").innerText();
|
||||
assert.equal(text, "批量任务队列 - 多目标授权评估回归队列");
|
||||
if (state.label)
|
||||
assert.equal(
|
||||
await page.locator("#batch-queue-start-btn").innerText(),
|
||||
state.label,
|
||||
);
|
||||
else
|
||||
assert.equal(
|
||||
await page.locator("#batch-queue-start-btn").isVisible(),
|
||||
false,
|
||||
);
|
||||
};
|
||||
await assertLabels();
|
||||
// Real breakpoint transitions call mobile boot, which reapplies all translations.
|
||||
if (width === 1440 && state.label) {
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.waitForTimeout(150);
|
||||
await assertLabels();
|
||||
await page.setViewportSize({ width, height });
|
||||
await page.waitForTimeout(150);
|
||||
await assertLabels();
|
||||
}
|
||||
for (const button of await page
|
||||
.locator(
|
||||
"#batch-queue-detail-modal .modal-header-actions .btn-primary:visible",
|
||||
)
|
||||
.all()) {
|
||||
for (const appearance of ["normal", "hover", "focus"]) {
|
||||
if (appearance === "normal")
|
||||
await page.mouse.move(width - 4, height - 4);
|
||||
if (appearance === "hover") await button.hover();
|
||||
if (appearance === "focus") {
|
||||
await page.mouse.move(width - 4, height - 4);
|
||||
await button.focus();
|
||||
await page.keyboard.press("Tab");
|
||||
await page.keyboard.press("Shift+Tab");
|
||||
assert(
|
||||
await button.evaluate((e) => e.matches(":focus-visible")),
|
||||
"Keyboard focus indicator missing",
|
||||
);
|
||||
}
|
||||
await page.waitForTimeout(220);
|
||||
const colors = await button.evaluate((e) => ({
|
||||
foreground: getComputedStyle(e).color,
|
||||
background: getComputedStyle(e).backgroundColor,
|
||||
disabled: e.disabled,
|
||||
text: e.textContent,
|
||||
}));
|
||||
assert(!colors.disabled);
|
||||
const rgb = (value) => {
|
||||
assert(/^rgb/.test(value), JSON.stringify(colors));
|
||||
const values = value.match(/[\d.]+/g).map(Number);
|
||||
assert(
|
||||
values.length === 3 || values[3] === 1,
|
||||
"Primary background must be opaque",
|
||||
);
|
||||
return values.slice(0, 3).map((v) => {
|
||||
const c = v / 255;
|
||||
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
||||
});
|
||||
};
|
||||
const lum = (value) => {
|
||||
const [r, g, b] = rgb(value);
|
||||
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||
};
|
||||
const a = lum(colors.foreground),
|
||||
b = lum(colors.background);
|
||||
const ratio = (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
|
||||
contrastResults.push({
|
||||
state: state.status,
|
||||
label: state.label,
|
||||
appearance,
|
||||
ratio,
|
||||
...colors,
|
||||
});
|
||||
assert(
|
||||
ratio >= 4.5,
|
||||
JSON.stringify({ width, theme, appearance, ratio, ...colors }),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (state.status === "paused") await shot("queue");
|
||||
await page.evaluate(() => closeBatchQueueDetailModal());
|
||||
}
|
||||
// Queue names are literal content, including characters that look like markup.
|
||||
await page.evaluate(async () => {
|
||||
fixtureQueue.title = "复核 & <说明>";
|
||||
fixtureQueue.status = "paused";
|
||||
await showBatchQueueDetail("ui-fixture");
|
||||
applyTranslations(document.body);
|
||||
});
|
||||
assert.equal(
|
||||
await page.locator("#batch-queue-detail-title").innerText(),
|
||||
"批量任务队列 - 复核 & <说明>",
|
||||
);
|
||||
assert.equal(await page.locator("#batch-queue-detail-title > *").count(), 1);
|
||||
await page.evaluate(async () => {
|
||||
fixtureQueue.title = "";
|
||||
await showBatchQueueDetail("ui-fixture");
|
||||
applyTranslations(document.body);
|
||||
});
|
||||
assert.equal(
|
||||
await page.locator("#batch-queue-detail-title").innerText(),
|
||||
"批量任务队列",
|
||||
);
|
||||
await page.evaluate(() => {
|
||||
fixtureQueue.title = "多目标授权评估回归队列";
|
||||
});
|
||||
require("node:fs").writeFileSync(
|
||||
`${out}/queue-contrast-${width}-${theme}.json`,
|
||||
JSON.stringify(contrastResults, null, 2),
|
||||
);
|
||||
// A real language change translates the prefix and action, but never the queue name.
|
||||
await page.evaluate(async () => {
|
||||
fixtureQueue.status = "paused";
|
||||
await showBatchQueueDetail("ui-fixture");
|
||||
onLanguageSelect("en-US");
|
||||
});
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.documentElement.lang === "en-US" &&
|
||||
document.getElementById("batch-queue-start-btn").textContent === "Resume",
|
||||
);
|
||||
assert(
|
||||
(await page.locator("#batch-queue-detail-title").innerText()).endsWith(
|
||||
" - 多目标授权评估回归队列",
|
||||
),
|
||||
);
|
||||
await page.evaluate(() => onLanguageSelect("zh-CN"));
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.documentElement.lang === "zh-CN" &&
|
||||
document.getElementById("batch-queue-start-btn").textContent ===
|
||||
"继续执行",
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator("#batch-queue-detail-title").innerText(),
|
||||
"批量任务队列 - 多目标授权评估回归队列",
|
||||
);
|
||||
await page.evaluate(() => closeBatchQueueDetailModal());
|
||||
await activate("page-roles-management");
|
||||
await page.evaluate(() => editRole("界面回归角色"));
|
||||
await page.locator("#role-tools-list input").first().waitFor();
|
||||
await page.evaluate(() => applyTranslations(document));
|
||||
assert.equal(await page.locator("#role-modal-title").innerText(), "编辑角色");
|
||||
const stats = await page.locator("#role-tools-stats").evaluate((e) => ({
|
||||
width: e.clientWidth,
|
||||
scroll: e.scrollWidth,
|
||||
text: e.textContent,
|
||||
}));
|
||||
assert(stats.text.includes("614") && stats.text.includes("626"), stats.text);
|
||||
assert(stats.scroll <= stats.width + 2, JSON.stringify(stats));
|
||||
await page.locator("#role-tools-stats").scrollIntoViewIfNeeded();
|
||||
await shot("role-tools");
|
||||
await page.evaluate(() => closeRoleModal());
|
||||
await page.evaluate(() => showAddRoleModal());
|
||||
await page.evaluate(() => applyTranslations(document));
|
||||
assert.equal(await page.locator("#role-modal-title").innerText(), "添加角色");
|
||||
await page.evaluate(() => closeRoleModal());
|
||||
await activate("page-skills-management");
|
||||
// View is dynamically created and must use the same square drawer as Edit.
|
||||
await page.evaluate(() => viewSkill("review-skill"));
|
||||
await page.locator("#skill-view-modal").waitFor();
|
||||
await page.waitForTimeout(220);
|
||||
const skillView = await page.locator("#skill-view-modal").evaluate((e) => {
|
||||
const p = e.querySelector(".modal-content"),
|
||||
r = p.getBoundingClientRect(),
|
||||
s = getComputedStyle(p);
|
||||
return {
|
||||
surface: e.dataset.uiSurface,
|
||||
width: r.width,
|
||||
right: r.right,
|
||||
height: r.height,
|
||||
radius: s.borderRadius,
|
||||
bg: s.backgroundColor,
|
||||
footer: e.querySelector(".modal-footer").getBoundingClientRect().bottom,
|
||||
};
|
||||
});
|
||||
assert.equal(skillView.surface, "drawer");
|
||||
assert.equal(skillView.radius, "0px");
|
||||
assert(
|
||||
Math.abs(skillView.right - width) < 2 &&
|
||||
Math.abs(skillView.height - height) < 2,
|
||||
JSON.stringify(skillView),
|
||||
);
|
||||
assert(
|
||||
Math.abs(
|
||||
skillView.width - (width < 768 ? width : Math.min(960, width - 48)),
|
||||
) < 2,
|
||||
JSON.stringify(skillView),
|
||||
);
|
||||
assert(skillView.footer <= height + 1, JSON.stringify(skillView));
|
||||
assert.equal(
|
||||
skillView.bg,
|
||||
theme === "dark" ? "rgb(17, 24, 39)" : "rgb(255, 255, 255)",
|
||||
);
|
||||
assert.equal(
|
||||
await page.locator("#skill-view-body").innerText(),
|
||||
"# 技能摘要\n按需加载正文。",
|
||||
);
|
||||
await shot("skill-view-summary");
|
||||
await page.locator("#skill-view-modal [data-skill-load-full]").click();
|
||||
await page.waitForFunction(() =>
|
||||
document
|
||||
.getElementById("skill-view-body")
|
||||
.textContent.startsWith("# 审核步骤"),
|
||||
);
|
||||
if (width >= 768) {
|
||||
await page.locator("#skill-view-modal .app-drawer-expand").click();
|
||||
assert(
|
||||
(await page.locator("#skill-view-modal .modal-content").boundingBox())
|
||||
.width >= skillView.width,
|
||||
);
|
||||
}
|
||||
await page.keyboard.press("Escape");
|
||||
assert.equal(await page.locator("#skill-view-modal").count(), 0);
|
||||
assert.equal(
|
||||
await page.evaluate(() =>
|
||||
document.body.classList.contains("app-modal-open"),
|
||||
),
|
||||
false,
|
||||
);
|
||||
await page.evaluate(() => viewSkill("review-skill"));
|
||||
await page.locator("#skill-view-modal [data-skill-view-edit]").click();
|
||||
assert.equal(await page.locator("#skill-view-modal").count(), 0);
|
||||
await page.locator("#skill-modal").waitFor();
|
||||
assert.equal(
|
||||
await page.locator("#skill-modal").getAttribute("data-ui-surface"),
|
||||
"drawer",
|
||||
);
|
||||
await page.locator("#skill-content").waitFor();
|
||||
await page.evaluate(() => applyTranslations(document));
|
||||
assert.equal(
|
||||
await page.locator("#skill-modal-title").innerText(),
|
||||
"编辑Skill",
|
||||
);
|
||||
await shot("skill");
|
||||
await page.evaluate(() => closeSkillModal());
|
||||
await page.evaluate(() => showAddSkillModal());
|
||||
await page.evaluate(() => applyTranslations(document));
|
||||
assert.equal(
|
||||
await page.locator("#skill-modal-title").innerText(),
|
||||
"添加Skill",
|
||||
);
|
||||
await page.evaluate(() => closeSkillModal());
|
||||
// Real breakpoint transition: mobile boot reapplies the translations.
|
||||
if (width === 1440) {
|
||||
await activate("page-roles-management");
|
||||
await page.evaluate(() => editRole("界面回归角色"));
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.waitForTimeout(100);
|
||||
assert.equal(
|
||||
await page.locator("#role-modal-title").innerText(),
|
||||
"编辑角色",
|
||||
);
|
||||
await page.evaluate(() => closeRoleModal());
|
||||
await page.setViewportSize({ width, height });
|
||||
await activate("page-skills-management");
|
||||
await page.evaluate(() => editSkill("review-skill"));
|
||||
await page.setViewportSize({ width: 390, height: 844 });
|
||||
await page.waitForTimeout(100);
|
||||
assert.equal(
|
||||
await page.locator("#skill-modal-title").innerText(),
|
||||
"编辑Skill",
|
||||
);
|
||||
await page.evaluate(() => closeSkillModal());
|
||||
await page.setViewportSize({ width, height });
|
||||
}
|
||||
await activate("page-vulnerabilities");
|
||||
await page.evaluate(() => {
|
||||
const rows = Array.from({ length: 50 }, (_, i) => ({
|
||||
id: "finding-" + i,
|
||||
title: "接口响应与权限检查发现:包含较长的组件版本和复现说明 " + i,
|
||||
description: "已验证的证据摘要。".repeat(10),
|
||||
severity: i % 3 ? "low" : "high",
|
||||
status: "open",
|
||||
target: "https://service-" + i + ".example.test",
|
||||
target_host: "service-" + i + ".example.test",
|
||||
target_domain: "example.test",
|
||||
createdAt: "2026-11-10T12:00:00Z",
|
||||
}));
|
||||
vulnerabilityPagination = {
|
||||
currentPage: 1,
|
||||
totalPages: 3,
|
||||
total: 110,
|
||||
pageSize: 50,
|
||||
};
|
||||
renderVulnerabilities(rows, { view: "host" });
|
||||
renderVulnerabilityPagination();
|
||||
});
|
||||
await page.locator(".vulnerability-record-row").first().waitFor();
|
||||
if (width < 768) {
|
||||
await page
|
||||
.locator(".vulnerability-record-row")
|
||||
.first()
|
||||
.scrollIntoViewIfNeeded();
|
||||
await page.locator("#page-vulnerabilities").evaluate((e) => {
|
||||
e.scrollTop +=
|
||||
e.querySelector(".vulnerability-record-row").getBoundingClientRect()
|
||||
.top - e.getBoundingClientRect().top;
|
||||
});
|
||||
const scroll = await page
|
||||
.locator("#page-vulnerabilities")
|
||||
.evaluate((e) => ({
|
||||
height: e.clientHeight,
|
||||
scrollTop: e.scrollTop,
|
||||
contentOverflow: getComputedStyle(e.querySelector(".page-content"))
|
||||
.overflowY,
|
||||
headerBottom: e.querySelector(".page-header").getBoundingClientRect()
|
||||
.bottom,
|
||||
top: e.getBoundingClientRect().top,
|
||||
}));
|
||||
assert(
|
||||
scroll.scrollTop > 0 && scroll.headerBottom <= scroll.top + 1,
|
||||
JSON.stringify(scroll),
|
||||
);
|
||||
assert(scroll.contentOverflow === "visible", JSON.stringify(scroll));
|
||||
assert(scroll.height >= height - 150, JSON.stringify(scroll));
|
||||
}
|
||||
await shot("findings");
|
||||
};
|
||||
@@ -0,0 +1,307 @@
|
||||
/* Shared application surfaces. Loaded last to bridge legacy module styles.
|
||||
* Use data-ui-surface="drawer" for details/long forms; short actions use dialog.
|
||||
* Keep table density, semantic status colors and specialist workspaces intact.
|
||||
*/
|
||||
:root {
|
||||
--ui-radius-card: 16px;
|
||||
--ui-radius-control: 10px;
|
||||
--ui-surface: var(--bg-primary);
|
||||
--ui-surface-muted: var(--bg-secondary);
|
||||
--ui-border: var(--border-color);
|
||||
--ui-shadow: 0 2px 8px rgba(15, 23, 42, .04);
|
||||
--ui-overlay: rgba(15, 23, 42, .42);
|
||||
--ui-panel-shadow: -12px 0 40px rgba(15, 23, 42, .16);
|
||||
--ui-space: 24px;
|
||||
}
|
||||
html[data-theme="dark"] {
|
||||
--ui-shadow: 0 2px 8px rgba(0, 0, 0, .12);
|
||||
--ui-overlay: rgba(0, 0, 0, .58);
|
||||
--ui-panel-shadow: -12px 0 40px rgba(0, 0, 0, .32);
|
||||
}
|
||||
/* Explicit surface inventory: no wildcard class matching, no changes to charts,
|
||||
* terminals, graph nodes, selected-state fills or severity indicators. */
|
||||
html body .page :is(
|
||||
.dashboard-section, .dashboard-card, .dashboard-kpi-card, .asset-total-card, .asset-recent-card, .asset-panel, .asset-list-card,
|
||||
.knowledge-item-card, .retrieval-log-card, .skill-card, .role-card, .batch-queue-item,
|
||||
.tool-guard-card, .mcp-management-panel, .projects-sidebar-card, .projects-panel,
|
||||
.projects-settings-card, .rbac-panel, .rbac-catalog-card, .robot-card,
|
||||
.workflow-panel, .c2-listener-card, .c2-profile-card, .settings-subsection,
|
||||
.storage-overview-card, .skills-overview-card
|
||||
) {
|
||||
border-radius: var(--ui-radius-card);
|
||||
border-color: var(--ui-border);
|
||||
box-shadow: var(--ui-shadow);
|
||||
}
|
||||
html body .page :is(.knowledge-item-card, .skill-card, .role-card, .workflow-panel, .settings-subsection) {
|
||||
background: var(--ui-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
html body .page-header {
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
html body .page-header > h2 { font-size: 22px; line-height: 1.4; letter-spacing: -.02em; }
|
||||
html body .page-header-actions { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
html body :is(.page, [data-ui-surface]) :is(.btn-primary, .btn-secondary) {
|
||||
border-radius: var(--ui-radius-control) !important;
|
||||
min-height: 36px;
|
||||
box-shadow: none;
|
||||
}
|
||||
html body :is(.page, [data-ui-surface]) :is(button, input, textarea, select, [role="button"]):focus-visible {
|
||||
outline: 2px solid var(--accent-color);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
html body :is(.form-group, .settings-form, .modal-body, .projects-modal-body, .c2-modal-body)
|
||||
:is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]), textarea, select) {
|
||||
border-radius: var(--ui-radius-control);
|
||||
border-color: var(--ui-border);
|
||||
color: var(--text-primary);
|
||||
background-color: var(--input-bg);
|
||||
max-width: 100%;
|
||||
}
|
||||
/* Layering is assigned by the modal lifecycle, including nested short dialogs. */
|
||||
html body [data-ui-surface] {
|
||||
z-index: var(--app-overlay-order, 10060) !important;
|
||||
background: var(--ui-overlay) !important;
|
||||
backdrop-filter: none;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0 !important;
|
||||
overflow: hidden;
|
||||
--app-drawer-width: 720px;
|
||||
}
|
||||
html body [data-ui-surface="drawer"].app-drawer-wide { --app-drawer-width: 960px; }
|
||||
html body [data-ui-surface="drawer"].app-drawer-expanded { --app-drawer-width: 1440px; }
|
||||
/* !important only on the layout contract: old modules set inline dimensions. */
|
||||
html body [data-ui-surface="drawer"] > :is(.modal-content, .projects-modal-dialog, .c2-modal) {
|
||||
position: absolute !important;
|
||||
inset-block: 0 !important;
|
||||
inset-inline: auto 0 !important;
|
||||
width: min(var(--app-drawer-width), calc(100% - 48px)) !important;
|
||||
min-width: 0 !important;
|
||||
max-width: none !important;
|
||||
height: 100% !important;
|
||||
height: 100dvh !important;
|
||||
min-height: 0 !important;
|
||||
max-height: none !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border: 0;
|
||||
border-inline-start: 1px solid var(--ui-border);
|
||||
border-radius: 0 !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden !important;
|
||||
background: var(--ui-surface) !important;
|
||||
color: var(--text-primary);
|
||||
box-shadow: var(--ui-panel-shadow);
|
||||
animation: app-panel-in .18s ease-out !important;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] :is(.modal-header, .projects-modal-header, .c2-modal-header, .vulnerability-inspector-header) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
padding: 20px var(--ui-space) !important;
|
||||
border-radius: 0;
|
||||
border-bottom: 1px solid var(--ui-border);
|
||||
background: var(--ui-surface) !important;
|
||||
color: var(--text-primary);
|
||||
box-shadow: none;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] :is(.modal-header, .projects-modal-header, .c2-modal-header)::after { display: none; }
|
||||
html body [data-ui-surface="drawer"] :is(.modal-header, .projects-modal-header, .c2-modal-header, .vulnerability-inspector-header) :is(h2, h3) {
|
||||
font-size: 19px;
|
||||
line-height: 1.5;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] :is(.modal-header, .projects-modal-header, .c2-modal-header, .vulnerability-inspector-header) > :first-child { flex: 1; min-width: 0; }
|
||||
html body [data-ui-surface="drawer"] :is(.modal-close, .projects-modal-close, .c2-modal-close) {
|
||||
position: static;
|
||||
flex: 0 0 36px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
margin: 0;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] :is(.modal-body, .projects-modal-body, .c2-modal-body, #vulnerability-inspector-body) {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
max-height: none !important;
|
||||
overflow-y: auto !important;
|
||||
overscroll-behavior: contain;
|
||||
padding: var(--ui-space) !important;
|
||||
background: var(--ui-surface) !important;
|
||||
color: var(--text-primary);
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] :is(.modal-footer, .projects-modal-footer, .c2-modal-footer) {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 16px var(--ui-space) !important;
|
||||
border-top: 1px solid var(--ui-border);
|
||||
background: var(--ui-surface) !important;
|
||||
box-shadow: none;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] #c2-modal-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
html body .app-drawer-expand {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 0 0 36px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border: 1px solid var(--ui-border);
|
||||
border-radius: var(--ui-radius-control);
|
||||
background: var(--ui-surface-muted);
|
||||
color: var(--text-secondary);
|
||||
font-size: 22px;
|
||||
cursor: pointer;
|
||||
}
|
||||
html body .app-drawer-expand[aria-pressed="true"] { color: var(--accent-color); border-color: var(--accent-color); }
|
||||
html body [data-ui-surface="dialog"] > :is(.modal-content, .projects-modal-dialog, .c2-modal) {
|
||||
border-radius: var(--ui-radius-card);
|
||||
background: var(--ui-surface);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--ui-border);
|
||||
}
|
||||
@keyframes app-panel-in { from { opacity: .6; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
|
||||
@media (max-width: 767.98px) {
|
||||
:root { --ui-space: 16px; }
|
||||
html body .page-header > h2 { font-size: 20px; }
|
||||
html body :is(.page, [data-ui-surface]) :is(.btn-primary, .btn-secondary) { min-height: 44px; }
|
||||
html body [data-ui-surface="drawer"] > :is(.modal-content, .projects-modal-dialog, .c2-modal) {
|
||||
width: 100% !important;
|
||||
border: 0;
|
||||
border-radius: 0 !important;
|
||||
padding-top: env(safe-area-inset-top, 0px) !important;
|
||||
padding-bottom: env(safe-area-inset-bottom, 0px) !important;
|
||||
}
|
||||
html body [data-ui-surface="drawer"] :is(.modal-header, .projects-modal-header, .c2-modal-header, .vulnerability-inspector-header) { padding-block: 12px !important; }
|
||||
html body [data-ui-surface="drawer"] :is(.modal-close, .projects-modal-close, .c2-modal-close) { width: 44px; height: 44px; flex-basis: 44px; }
|
||||
html body .app-drawer-expand { display: none; }
|
||||
html body [data-ui-surface="drawer"] :is(input, textarea, select) { font-size: 16px; }
|
||||
html body [data-ui-surface="drawer"] .modal-header-actions { flex-wrap: wrap; }
|
||||
html body [data-ui-surface="drawer"] #skill-package-editor > div { flex-direction: column; }
|
||||
html body [data-ui-surface="drawer"] #skill-package-tree { width: 100%; max-height: 180px; }
|
||||
/* Short actions remain compact, including on phones. */
|
||||
html body [data-ui-surface="dialog"] > :is(.modal-content, .projects-modal-dialog, .c2-modal) {
|
||||
width: calc(100% - 32px) !important;
|
||||
height: auto !important;
|
||||
min-height: 0 !important;
|
||||
max-height: calc(100dvh - 48px) !important;
|
||||
margin: 24px auto !important;
|
||||
border-radius: var(--ui-radius-card) !important;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html body [data-ui-surface] { animation: none !important; }
|
||||
html body [data-ui-surface] > :is(.modal-content, .projects-modal-dialog, .c2-modal) { animation: none !important; transition: none !important; }
|
||||
}
|
||||
|
||||
/* The common header is quiet; module status badges retain their own colors. */
|
||||
html body [data-ui-surface="drawer"] :is(.modal-header, .projects-modal-header, .c2-modal-header) h2::before { display: none; }
|
||||
html body [data-ui-surface="drawer"] .form-group { margin-bottom: 18px; }
|
||||
html body [data-ui-surface="drawer"] .form-group:last-child { margin-bottom: 0; }
|
||||
|
||||
html body .page :is(.asset-table, .info-collect-table, .data-table, .chat-files-table, .audit-log-table) th {
|
||||
background: var(--ui-surface-muted);
|
||||
color: var(--text-secondary);
|
||||
border-color: var(--ui-border);
|
||||
font-weight: 600;
|
||||
}
|
||||
html body [data-ui-surface="dialog"] :is(.modal-header, .projects-modal-header, .c2-modal-header, .modal-footer, .projects-modal-footer, .c2-modal-footer) {
|
||||
background: var(--ui-surface);
|
||||
border-color: var(--ui-border);
|
||||
color: var(--text-primary);
|
||||
box-shadow: none;
|
||||
}
|
||||
html[dir="rtl"] body [data-ui-surface="drawer"] > :is(.modal-content, .projects-modal-dialog, .c2-modal) {
|
||||
animation-name: app-panel-in-rtl !important;
|
||||
}
|
||||
@keyframes app-panel-in-rtl { from { opacity: .6; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html[dir="rtl"] body [data-ui-surface="drawer"] > :is(.modal-content, .projects-modal-dialog, .c2-modal) { animation: none !important; }
|
||||
}
|
||||
|
||||
/* Data-heavy queue actions get their own row; never compete with the title. */
|
||||
html body #batch-queue-detail-modal .modal-header {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 36px 36px;
|
||||
align-items: center;
|
||||
}
|
||||
html body #batch-queue-detail-modal .modal-header > h2 { grid-column: 1; grid-row: 1; }
|
||||
html body #batch-queue-detail-modal .app-drawer-expand { grid-column: 2; grid-row: 1; }
|
||||
html body #batch-queue-detail-modal .modal-close { grid-column: 3; grid-row: 1; }
|
||||
html body #batch-queue-detail-modal .modal-header-actions {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 2;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
min-width: 0;
|
||||
}
|
||||
html body #role-modal .role-tools-stats,
|
||||
html body #role-modal .role-tools-stats-row { min-width: 0; max-width: 100%; }
|
||||
html body #role-modal .role-tools-stats span { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
html body #batch-queue-detail-modal .modal-header { grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
|
||||
html body #batch-queue-detail-modal .modal-close { grid-column: 2; }
|
||||
html body #batch-queue-detail-modal .modal-header-actions { gap: 8px; }
|
||||
/* One page scroll: actions and pagination no longer reserve most of the screen. */
|
||||
html body #page-vulnerabilities.active { display: block; overflow-y: auto; overscroll-behavior: contain; }
|
||||
html body #page-vulnerabilities > .page-header { position: static; }
|
||||
html body #page-vulnerabilities > .page-content {
|
||||
height: auto; max-height: none; overflow: visible; flex: none;
|
||||
}
|
||||
html body #page-vulnerabilities > .vulnerability-page-footer { position: static; }
|
||||
html body #vulnerability-pagination { position: static; }
|
||||
html body #page-vulnerabilities .dashboard-stats {
|
||||
display: grid; grid-template-columns: repeat(6, minmax(96px, 1fr));
|
||||
overflow-x: auto; padding-bottom: 6px;
|
||||
}
|
||||
html body #page-vulnerabilities .stat-card { min-height: 84px; padding: 10px; }
|
||||
}
|
||||
/* Queue primary actions keep their semantic fill even with .btn-small.
|
||||
* Mobile's dark foreground assumes an accent fill, never a translucent gray. */
|
||||
html body #batch-queue-detail-modal .modal-header-actions .btn-primary {
|
||||
background: var(--accent-color) !important;
|
||||
border-color: var(--accent-color);
|
||||
color: #fff !important;
|
||||
}
|
||||
html[data-theme="dark"] body #batch-queue-detail-modal .modal-header-actions .btn-primary {
|
||||
color: #0b1120 !important;
|
||||
}
|
||||
html body #batch-queue-detail-modal .modal-header-actions .btn-primary:is(:hover, :focus-visible, :active):not(:disabled) {
|
||||
background: var(--accent-hover) !important;
|
||||
border-color: var(--accent-hover);
|
||||
}
|
||||
html body #batch-queue-detail-modal #batch-queue-detail-title { display: block; }
|
||||
|
||||
/* Database profile fields are edited inside a narrower, scrollable drawer. */
|
||||
html body #webshell-db-profile-modal .webshell-db-toolbar {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
background: var(--ui-surface-muted);
|
||||
border-color: var(--ui-border);
|
||||
}
|
||||
html body #webshell-db-profile-modal .webshell-db-toolbar label > span { color: var(--text-secondary); }
|
||||
@media (max-width: 767.98px) {
|
||||
html body #webshell-db-profile-modal .webshell-db-toolbar { grid-template-columns: minmax(0, 1fr); }
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
"chatModuleMissing": "لم يتمّ تحميل وحدة المحادثة بعد"
|
||||
},
|
||||
"common": {
|
||||
"expandPanel": "توسيع اللوحة",
|
||||
"ok": "موافق",
|
||||
"cancel": "إلغاء",
|
||||
"refresh": "تحديث",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"chatModuleMissing": "Chat module not loaded yet"
|
||||
},
|
||||
"common": {
|
||||
"expandPanel": "Expand panel",
|
||||
"ok": "OK",
|
||||
"cancel": "Cancel",
|
||||
"refresh": "Refresh",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"chatModuleMissing": "Модуль чата ещё не загружен"
|
||||
},
|
||||
"common": {
|
||||
"expandPanel": "Развернуть панель",
|
||||
"ok": "ОК",
|
||||
"cancel": "Отмена",
|
||||
"refresh": "Обновить",
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
"chatModuleMissing": "对话模块尚未加载"
|
||||
},
|
||||
"common": {
|
||||
"expandPanel": "展开面板",
|
||||
"ok": "确定",
|
||||
"cancel": "取消",
|
||||
"refresh": "刷新",
|
||||
|
||||
@@ -890,7 +890,7 @@ function setFofaParseLoading(loading, statusText) {
|
||||
|
||||
function showFofaParseModal(nlText, parsed) {
|
||||
const existing = document.getElementById('fofa-parse-modal');
|
||||
if (existing) existing.remove();
|
||||
if (existing) { closeAppModal(existing); existing.remove(); }
|
||||
|
||||
const provider = getInfoCollectProvider();
|
||||
const cfg = INFO_COLLECT_PROVIDERS[provider] || INFO_COLLECT_PROVIDERS.fofa;
|
||||
@@ -908,13 +908,14 @@ function showFofaParseModal(nlText, parsed) {
|
||||
document.body.appendChild(modal);
|
||||
openAppModal(modal, { focus: false });
|
||||
deferModalContent(function () {
|
||||
if (!modal.isConnected) return;
|
||||
modal.innerHTML = `
|
||||
<div class="modal-content info-collect-parse-modal-content" style="max-width: 900px;">
|
||||
<div class="modal-header">
|
||||
<h2>${_t('infoCollect.parseResultTitle')}</h2>
|
||||
<span class="modal-close" id="fofa-parse-modal-close" title="${_t('common.close')}">×</span>
|
||||
</div>
|
||||
<div class="info-collect-parse-modal-body">
|
||||
<div class="modal-body info-collect-parse-modal-body">
|
||||
<div class="form-group">
|
||||
<label>${_t('infoCollect.naturalLanguageLabel')}</label>
|
||||
<div class="muted info-collect-parse-nl-text">${safeNL || '-'}</div>
|
||||
@@ -990,14 +991,7 @@ function showFofaParseModal(nlText, parsed) {
|
||||
document.getElementById('fofa-parse-apply')?.addEventListener('click', () => applyToQuery(false));
|
||||
document.getElementById('fofa-parse-apply-run')?.addEventListener('click', () => applyToQuery(true));
|
||||
|
||||
// Esc 关闭
|
||||
const onKey = (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
close();
|
||||
document.removeEventListener('keydown', onKey);
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', onKey);
|
||||
// Escape is handled by the shared modal lifecycle.
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1662,31 +1656,31 @@ async function batchScanSelectedFofaRows() {
|
||||
|
||||
function showCellDetailModal(field, fullText) {
|
||||
const existing = document.getElementById('info-collect-cell-modal');
|
||||
if (existing) existing.remove();
|
||||
if (existing) { closeAppModal(existing); existing.remove(); }
|
||||
|
||||
const text = fullText == null ? '' : String(fullText);
|
||||
const fieldName = field || _t('infoCollect.field');
|
||||
const charCountLabel = _t('infoCollect.cellValueLength', { count: Array.from(text).length });
|
||||
const modal = document.createElement('div');
|
||||
modal.id = 'info-collect-cell-modal';
|
||||
modal.className = 'info-collect-cell-modal';
|
||||
modal.className = 'modal info-collect-cell-modal';
|
||||
modal.innerHTML = `
|
||||
<div class="info-collect-cell-modal-content" role="dialog" aria-modal="true">
|
||||
<div class="info-collect-cell-modal-header">
|
||||
<div class="modal-content info-collect-cell-modal-content">
|
||||
<div class="modal-header info-collect-cell-modal-header">
|
||||
<div class="info-collect-cell-modal-heading">
|
||||
<div class="info-collect-cell-modal-title">${escapeHtml(fieldName)}</div>
|
||||
<h2 class="info-collect-cell-modal-title">${escapeHtml(fieldName)}</h2>
|
||||
<div class="info-collect-cell-modal-subtitle">${escapeHtml(charCountLabel)}</div>
|
||||
</div>
|
||||
<button class="btn-icon" type="button" id="info-collect-cell-modal-close" title="${_t('common.close')}">
|
||||
<button class="modal-close" type="button" id="info-collect-cell-modal-close" title="${_t('common.close')}">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="info-collect-cell-modal-body">
|
||||
<div class="modal-body info-collect-cell-modal-body">
|
||||
<pre class="info-collect-cell-modal-pre">${escapeHtml(text)}</pre>
|
||||
</div>
|
||||
<div class="info-collect-cell-modal-footer">
|
||||
<div class="modal-footer info-collect-cell-modal-footer">
|
||||
<button class="btn-secondary" type="button" id="info-collect-cell-modal-copy">${_t('common.copy')}</button>
|
||||
<button class="btn-primary" type="button" id="info-collect-cell-modal-ok">${_t('common.close')}</button>
|
||||
</div>
|
||||
@@ -1696,13 +1690,7 @@ function showCellDetailModal(field, fullText) {
|
||||
document.body.appendChild(modal);
|
||||
openAppModal(modal);
|
||||
|
||||
const onKey = (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
close();
|
||||
}
|
||||
};
|
||||
const close = function () {
|
||||
document.removeEventListener('keydown', onKey);
|
||||
closeAppModal(modal);
|
||||
modal.remove();
|
||||
syncAppModalBodyLock();
|
||||
@@ -1716,8 +1704,7 @@ function showCellDetailModal(field, fullText) {
|
||||
navigator.clipboard.writeText(text).then(() => showInlineToast(_t('common.copied'))).catch(() => alert(_t('common.copyFailed')));
|
||||
});
|
||||
|
||||
// Esc 关闭
|
||||
document.addEventListener('keydown', onKey);
|
||||
// Escape is handled by the shared modal lifecycle.
|
||||
}
|
||||
|
||||
// 暴露到全局(供 index.html onclick 调用)
|
||||
|
||||
+119
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 统一弹窗:先显示遮罩、下一帧再填大段内容,避免与 backdrop 绘制抢主线程。
|
||||
* Shared dialog/drawer lifecycle: presentation, stacking, keyboard focus and deferred rendering.
|
||||
*/
|
||||
(function () {
|
||||
const BODY_LOCK = 'app-modal-open';
|
||||
@@ -17,6 +17,74 @@
|
||||
'login-overlay',
|
||||
]);
|
||||
|
||||
// Explicitly opt long forms and inspectable records into the shared surface.
|
||||
// Short confirmations/selectors retain their existing centered-dialog behavior.
|
||||
const DRAWER_IDS = new Set([
|
||||
'asset-detail-modal', 'asset-editor-modal', 'asset-import-modal', 'asset-bulk-edit-modal',
|
||||
'vulnerability-inspector', 'vulnerability-modal', 'vulnerability-retest-modal',
|
||||
'batch-queue-detail-modal', 'batch-manage-modal', 'batch-import-modal',
|
||||
'mcp-detail-modal', 'external-mcp-modal', 'attack-chain-modal',
|
||||
'fact-modal', 'fact-detail-modal', 'knowledge-item-modal', 'retrieval-log-details-modal',
|
||||
'audit-detail-modal', 'hitl-log-modal', 'skill-modal', 'skill-view-modal', 'agent-md-modal', 'role-modal',
|
||||
'rbac-user-modal', 'rbac-role-modal', 'chat-files-edit-modal', 'webshell-modal',
|
||||
'workflow-package-import-modal', 'workflow-ai-modal', 'robot-commands-modal',
|
||||
'robot-account-binding-modal', 'c2-modal',
|
||||
'info-collect-cell-modal', 'fofa-parse-modal', 'webshell-db-profile-modal',
|
||||
]);
|
||||
const WIDE_IDS = new Set([
|
||||
'skill-modal', 'skill-view-modal', 'agent-md-modal', 'role-modal', 'fact-modal', 'vulnerability-modal',
|
||||
'chat-files-edit-modal', 'batch-queue-detail-modal', 'mcp-detail-modal', 'attack-chain-modal',
|
||||
]);
|
||||
const returnFocus = new WeakMap();
|
||||
const surfaceObservers = new WeakMap();
|
||||
const openOrder = [];
|
||||
|
||||
function prepareSurface(el) {
|
||||
if (!el || el.id === 'login-overlay') return;
|
||||
const drawer = DRAWER_IDS.has(el.id) && !el.querySelector('.c2-modal--sleep');
|
||||
el.dataset.uiSurface = drawer ? 'drawer' : 'dialog';
|
||||
el.classList.toggle('app-drawer-wide', drawer && (WIDE_IDS.has(el.id) || !!el.querySelector('.c2-modal--wide')));
|
||||
if (!drawer) return;
|
||||
el.setAttribute('role', 'dialog');
|
||||
el.setAttribute('aria-modal', 'true');
|
||||
const header = el.querySelector('.modal-header, .projects-modal-header, .c2-modal-header, .vulnerability-inspector-header');
|
||||
if (!header) return; // Asynchronously rendered details are prepared again after rendering.
|
||||
const title = header.querySelector('h2, h3');
|
||||
if (title) {
|
||||
if (!title.id) title.id = el.id + '-heading';
|
||||
el.setAttribute('aria-labelledby', title.id);
|
||||
}
|
||||
const close = header.querySelector('.modal-close, .projects-modal-close, .c2-modal-close');
|
||||
if (close && close.tagName !== 'BUTTON') {
|
||||
close.setAttribute('role', 'button');
|
||||
close.tabIndex = 0;
|
||||
close.onkeydown = function (event) {
|
||||
if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); close.click(); }
|
||||
};
|
||||
}
|
||||
if (close && !close.getAttribute('aria-label')) {
|
||||
close.setAttribute('aria-label', typeof window.t === 'function' ? window.t('common.close') : 'Close');
|
||||
}
|
||||
if (!header.querySelector('.app-drawer-expand')) {
|
||||
const button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.className = 'app-drawer-expand';
|
||||
button.textContent = '⤢';
|
||||
button.setAttribute('aria-pressed', 'false');
|
||||
button.setAttribute('data-i18n', 'common.expandPanel');
|
||||
button.setAttribute('data-i18n-attr', 'aria-label,title');
|
||||
button.setAttribute('data-i18n-skip-text', 'true');
|
||||
const label = typeof window.t === 'function' ? window.t('common.expandPanel') : 'Expand panel';
|
||||
button.setAttribute('aria-label', label);
|
||||
button.title = label;
|
||||
button.onclick = function () {
|
||||
const expanded = el.classList.toggle('app-drawer-expanded');
|
||||
button.setAttribute('aria-pressed', String(expanded));
|
||||
};
|
||||
header.insertBefore(button, close && close.parentNode === header ? close : null);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveEl(idOrEl) {
|
||||
if (!idOrEl) return null;
|
||||
return typeof idOrEl === 'string' ? document.getElementById(idOrEl) : idOrEl;
|
||||
@@ -55,13 +123,27 @@
|
||||
opts = opts || {};
|
||||
const el = resolveEl(idOrEl);
|
||||
if (!el) return null;
|
||||
prepareSurface(el);
|
||||
if (!surfaceObservers.has(el)) {
|
||||
const observer = new MutationObserver(function () { prepareSurface(el); });
|
||||
observer.observe(el, { childList: true, subtree: true });
|
||||
surfaceObservers.set(el, observer);
|
||||
}
|
||||
if (!isElVisible(el)) returnFocus.set(el, document.activeElement);
|
||||
const previous = openOrder.indexOf(el);
|
||||
if (previous !== -1) openOrder.splice(previous, 1);
|
||||
openOrder.push(el);
|
||||
// Nested editors must stack above the detail panel they were opened from.
|
||||
el.style.setProperty('--app-overlay-order', String(10060 + openOrder.length * 2));
|
||||
el.style.display = opts.display || defaultDisplay(el);
|
||||
syncBodyLock();
|
||||
requestAnimationFrame(function () { if (isElVisible(el)) prepareSurface(el); });
|
||||
if (opts.focus === false) return el;
|
||||
const sel =
|
||||
opts.focusSelector ||
|
||||
'input.form-input, textarea.form-input, select.form-input, input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled])';
|
||||
const focusTarget = opts.focusEl || el.querySelector(sel);
|
||||
const focusTarget = opts.focusEl || Array.from(el.querySelectorAll(sel)).find(item => item.getClientRects().length)
|
||||
|| el.querySelector('.modal-close, .projects-modal-close, .c2-modal-close');
|
||||
if (focusTarget) {
|
||||
requestAnimationFrame(function () {
|
||||
focusTarget.focus();
|
||||
@@ -72,7 +154,19 @@
|
||||
|
||||
function closeAppModal(idOrEl) {
|
||||
const el = resolveEl(idOrEl);
|
||||
if (el) el.style.display = 'none';
|
||||
if (el) {
|
||||
el.style.display = 'none';
|
||||
surfaceObservers.get(el)?.disconnect();
|
||||
surfaceObservers.delete(el);
|
||||
el.classList.remove('app-drawer-expanded');
|
||||
const button = el.querySelector('.app-drawer-expand');
|
||||
if (button) button.setAttribute('aria-pressed', 'false');
|
||||
const index = openOrder.indexOf(el);
|
||||
if (index !== -1) openOrder.splice(index, 1);
|
||||
const target = returnFocus.get(el);
|
||||
if (target && target.isConnected) target.focus({ preventScroll: true });
|
||||
returnFocus.delete(el);
|
||||
}
|
||||
syncBodyLock();
|
||||
return el;
|
||||
}
|
||||
@@ -88,6 +182,28 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Keep keyboard focus within the topmost drawer. Existing close handlers own
|
||||
// cleanup and dirty-form semantics, so Escape activates their close control.
|
||||
document.addEventListener('keydown', function (event) {
|
||||
const el = openOrder.filter(isElVisible).at(-1);
|
||||
if (!el || el.dataset.uiSurface !== 'drawer' || event.defaultPrevented) return;
|
||||
if (event.key === 'Escape') {
|
||||
const close = el.querySelector('.modal-close, .projects-modal-close, .c2-modal-close');
|
||||
if (close) { event.preventDefault(); event.stopImmediatePropagation(); close.click(); }
|
||||
} else if (event.key === 'Tab') {
|
||||
const items = Array.from(el.querySelectorAll('button, [href], input, select, textarea, [tabindex]'))
|
||||
.filter(item => !item.disabled && item.tabIndex >= 0 && item.getClientRects().length);
|
||||
if (!items.length) return;
|
||||
const first = items[0], last = items[items.length - 1];
|
||||
if (event.shiftKey && (document.activeElement === first || !el.contains(document.activeElement))) {
|
||||
event.preventDefault(); last.focus();
|
||||
} else if (!event.shiftKey && (document.activeElement === last || !el.contains(document.activeElement))) {
|
||||
event.preventDefault(); first.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
document.querySelectorAll(OVERLAY_SELECTOR).forEach(prepareSurface);
|
||||
|
||||
window.openAppModal = openAppModal;
|
||||
window.closeAppModal = closeAppModal;
|
||||
window.isAppModalOpen = isAppModalOpen;
|
||||
|
||||
@@ -1296,6 +1296,7 @@ async function showAddRoleModal() {
|
||||
const modal = document.getElementById('role-modal');
|
||||
if (!modal) return;
|
||||
|
||||
document.getElementById('role-modal-title').setAttribute('data-i18n', 'roleModal.addRole');
|
||||
document.getElementById('role-modal-title').textContent = _t('roleModal.addRole');
|
||||
document.getElementById('role-name').value = '';
|
||||
document.getElementById('role-name').disabled = false;
|
||||
@@ -1379,6 +1380,7 @@ async function editRole(roleName) {
|
||||
const modal = document.getElementById('role-modal');
|
||||
if (!modal) return;
|
||||
|
||||
document.getElementById('role-modal-title').setAttribute('data-i18n', 'roleModal.editRole');
|
||||
document.getElementById('role-modal-title').textContent = _t('roleModal.editRole');
|
||||
document.getElementById('role-name').value = role.name;
|
||||
document.getElementById('role-name').disabled = true; // 编辑时不允许修改名称
|
||||
|
||||
@@ -498,6 +498,7 @@ function showAddSkillModal() {
|
||||
if (pkg) pkg.style.display = 'none';
|
||||
if (addEd) addEd.style.display = 'block';
|
||||
|
||||
document.getElementById('skill-modal-title').setAttribute('data-i18n', 'skills.addSkill');
|
||||
document.getElementById('skill-modal-title').textContent = _t('skills.addSkill');
|
||||
document.getElementById('skill-name').value = '';
|
||||
document.getElementById('skill-name').disabled = false;
|
||||
@@ -612,6 +613,7 @@ async function editSkill(skillId) {
|
||||
const addEd = document.getElementById('skill-add-editor');
|
||||
if (pkg) pkg.style.display = 'block';
|
||||
if (addEd) addEd.style.display = 'none';
|
||||
document.getElementById('skill-modal-title').setAttribute('data-i18n', 'skills.editSkill');
|
||||
document.getElementById('skill-modal-title').textContent = _t('skills.editSkill');
|
||||
document.getElementById('skill-name').value = '';
|
||||
document.getElementById('skill-name').disabled = true;
|
||||
|
||||
+13
-10
@@ -1798,8 +1798,14 @@ async function showBatchQueueDetail(queueId) {
|
||||
const allowSubtaskMutation = batchQueueAllowsSubtaskMutation(queue);
|
||||
|
||||
if (title) {
|
||||
// textContent 本身会做转义;这里不要再 escapeHtml,否则会把 && 显示成 &...(看起来像“变形/乱码”)
|
||||
title.textContent = queue.title ? _t('tasks.batchQueueTitle') + ' - ' + String(queue.title) : _t('tasks.batchQueueTitle');
|
||||
// Translate only the label. The queue name is literal user content and
|
||||
// must survive mobile boot / language refresh without being replaced.
|
||||
title.removeAttribute('data-i18n');
|
||||
const label = document.createElement('span');
|
||||
label.setAttribute('data-i18n', 'tasks.batchQueueTitle');
|
||||
label.textContent = _t('tasks.batchQueueTitle');
|
||||
title.replaceChildren(label);
|
||||
if (queue.title) title.appendChild(document.createTextNode(' - ' + String(queue.title)));
|
||||
}
|
||||
|
||||
// 更新按钮显示
|
||||
@@ -1810,14 +1816,11 @@ async function showBatchQueueDetail(queueId) {
|
||||
if (startBtn) {
|
||||
// pending状态显示"开始执行",paused状态显示"继续执行"
|
||||
startBtn.style.display = (queue.status === 'pending' || queue.status === 'paused') ? 'inline-block' : 'none';
|
||||
if (startBtn && queue.status === 'paused') {
|
||||
startBtn.textContent = _t('tasks.resumeExecute');
|
||||
} else if (startBtn && queue.status === 'pending') {
|
||||
const isCronPending = queue.scheduleMode === 'cron' && queue.scheduleEnabled !== false;
|
||||
startBtn.textContent = isCronPending
|
||||
? _t('batchQueueDetailModal.startExecuteNow')
|
||||
: _t('batchQueueDetailModal.startExecute');
|
||||
}
|
||||
const isCronPending = queue.status === 'pending' && queue.scheduleMode === 'cron' && queue.scheduleEnabled !== false;
|
||||
const startLabelKey = queue.status === 'paused' ? 'tasks.resumeExecute'
|
||||
: isCronPending ? 'batchQueueDetailModal.startExecuteNow' : 'batchQueueDetailModal.startExecute';
|
||||
startBtn.setAttribute('data-i18n', startLabelKey);
|
||||
startBtn.textContent = _t(startLabelKey);
|
||||
}
|
||||
const rerunBtn = document.getElementById('batch-queue-rerun-btn');
|
||||
if (rerunBtn) {
|
||||
|
||||
+13
-14
@@ -49,6 +49,7 @@
|
||||
<link rel="stylesheet" href="/static/css/mobile.css?v=20261015-project-table-3">
|
||||
<link rel="stylesheet" href="/static/css/vulnerability-workspace.css?v=20261113-aligned-overview">
|
||||
<link rel="stylesheet" href="/static/css/vulnerability-list.css?v=20261115-timestamps">
|
||||
<link rel="stylesheet" href="/static/css/design-system.css?v=20261115-extra-drawers">
|
||||
<script src="/static/js/router.js?v=20261011-token-settings"></script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -6402,16 +6403,14 @@
|
||||
<div class="modal-content" style="max-width: 900px;">
|
||||
<div class="modal-header">
|
||||
<h2 id="batch-queue-detail-title" data-i18n="batchQueueDetailModal.title">批量任务队列详情</h2>
|
||||
<div style="display: flex; align-items: center; gap: 12px;">
|
||||
<div class="modal-header-actions">
|
||||
<button class="btn-secondary btn-small" data-require-permission="tasks:write" id="batch-queue-add-task-btn" onclick="showAddBatchTaskModal()" style="display: none;" data-i18n="batchQueueDetailModal.addTask">添加任务</button>
|
||||
<button class="btn-primary btn-small" data-require-permission="tasks:write" id="batch-queue-start-btn" onclick="startBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.startExecute">开始执行</button>
|
||||
<button class="btn-primary btn-small" data-require-permission="tasks:write" id="batch-queue-rerun-btn" onclick="rerunBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.rerunQueue">重跑一轮</button>
|
||||
<button class="btn-secondary btn-small" data-require-permission="tasks:write" id="batch-queue-pause-btn" onclick="pauseBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.pauseQueue">暂停队列</button>
|
||||
<button class="btn-secondary btn-small btn-danger" data-require-permission="tasks:delete" id="batch-queue-delete-btn" onclick="deleteBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.deleteQueue">删除队列</button>
|
||||
</div>
|
||||
<span class="modal-close" onclick="closeBatchQueueDetailModal()">×</span>
|
||||
<div class="modal-header-actions">
|
||||
<button class="btn-secondary btn-small" data-require-permission="tasks:write" id="batch-queue-add-task-btn" onclick="showAddBatchTaskModal()" style="display: none;" data-i18n="batchQueueDetailModal.addTask">添加任务</button>
|
||||
<button class="btn-primary btn-small" data-require-permission="tasks:write" id="batch-queue-start-btn" onclick="startBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.startExecute">开始执行</button>
|
||||
<button class="btn-primary btn-small" data-require-permission="tasks:write" id="batch-queue-rerun-btn" onclick="rerunBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.rerunQueue">重跑一轮</button>
|
||||
<button class="btn-secondary btn-small" data-require-permission="tasks:write" id="batch-queue-pause-btn" onclick="pauseBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.pauseQueue">暂停队列</button>
|
||||
<button class="btn-secondary btn-small btn-danger" data-require-permission="tasks:delete" id="batch-queue-delete-btn" onclick="deleteBatchQueue()" style="display: none;" data-i18n="batchQueueDetailModal.deleteQueue">删除队列</button>
|
||||
</div>
|
||||
<button type="button" class="modal-close" onclick="closeBatchQueueDetailModal()" data-i18n="common.close" data-i18n-attr="aria-label" data-i18n-skip-text="true" aria-label="关闭">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="batch-queue-detail-content"></div>
|
||||
@@ -7068,7 +7067,7 @@
|
||||
<script src="/static/js/theme.js"></script>
|
||||
<script src="/static/js/builtin-tools.js"></script>
|
||||
<script src="/static/js/auth.js?v=20261008-password-eye-1"></script>
|
||||
<script src="/static/js/modal.js"></script>
|
||||
<script src="/static/js/modal.js?v=20261115-extra-drawers"></script>
|
||||
<dialog id="vulnerability-download-dialog" aria-labelledby="vulnerability-download-heading" aria-describedby="vulnerability-download-hint">
|
||||
<div class="vulnerability-download-content">
|
||||
<h3 id="vulnerability-download-heading" data-i18n="vulnerabilityDownload.title">下载漏洞报告</h3>
|
||||
@@ -7083,7 +7082,7 @@
|
||||
</dialog>
|
||||
|
||||
<script src="/static/js/notifications.js"></script>
|
||||
<script src="/static/js/info-collect.js?v=20260717-1"></script>
|
||||
<script src="/static/js/info-collect.js?v=20261115-extra-drawers"></script>
|
||||
<script src="/static/js/assets.js?v=20260717-7"></script>
|
||||
<script src="/static/js/agents.js"></script>
|
||||
<script src="/static/js/dashboard.js?v=20261011-token-settings-cache-only"></script>
|
||||
@@ -7104,7 +7103,7 @@
|
||||
<script src="/static/vendor/xterm-addon-fit.js"></script>
|
||||
<script src="/static/js/terminal.js"></script>
|
||||
<script src="/static/js/knowledge.js"></script>
|
||||
<script src="/static/js/skills.js?v=20261027-pagination-custom-select"></script>
|
||||
<script src="/static/js/skills.js?v=20261115-ui-drawers"></script>
|
||||
<script src="/static/js/fact-graph.js"></script>
|
||||
<script src="/static/js/projects.js?v=20260819-1-pagination-20261027"></script>
|
||||
<script src="/static/js/vulnerability.js?v=20261115-timestamps"></script>
|
||||
@@ -7112,11 +7111,11 @@
|
||||
<script src="/static/js/vulnerability-download.js?v=20261030-2"></script>
|
||||
<script src="/static/js/webshell.js?v=20261011-token-usage"></script>
|
||||
<script src="/static/js/chat-files.js?v=20261027-pagination-custom-select"></script>
|
||||
<script src="/static/js/tasks.js?v=20261027-pagination-custom-select"></script>
|
||||
<script src="/static/js/tasks.js?v=20261115-ui-drawers"></script>
|
||||
<script src="/static/js/workflow-package-client.js"></script>
|
||||
<script src="/static/js/workflows.js"></script>
|
||||
<script src="/static/js/update.js?v={{.Version}}-activation"></script>
|
||||
<script src="/static/js/roles.js?v=20261027-pagination-custom-select"></script>
|
||||
<script src="/static/js/roles.js?v=20261115-ui-drawers"></script>
|
||||
<script src="/static/js/rbac.js"></script>
|
||||
<script src="/static/js/c2.js?v=20261027-pagination-custom-select"></script>
|
||||
<script src="/static/js/rbac-guards.js?v=20260907-1"></script>
|
||||
|
||||
Reference in new issue
Block a user