update server

This commit is contained in:
2026-07-30 11:12:31 +08:00
commit 4312cb878c
99 changed files with 24034 additions and 0 deletions
+219
View File
@@ -0,0 +1,219 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' data:; style-src 'self'; script-src 'self'">
<title>ReinLoop B 端工作台</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header class="topbar">
<div>
<p class="eyebrow">REINLOOP / B CONSOLE</p>
<h1>数据评审工作台</h1>
</div>
<div id="status" class="status" data-tone="idle">未连接</div>
</header>
<section id="connection-screen" class="connection-screen" aria-labelledby="connection-title">
<form id="connection-form" class="connection-form">
<p class="section-kicker">SERVER ACCESS</p>
<h2 id="connection-title">连接管理服务</h2>
<label><span>Server API URL</span><input id="api-url" type="url" placeholder="https://server.example.com/api" required></label>
<label><span>Admin Token</span><input id="admin-token" type="password" autocomplete="current-password" placeholder="请输入管理令牌"></label>
<button id="connect-button" class="button primary" type="submit">连接并校验</button>
<p id="connection-message" class="connection-message">校验通过后开放业务工作台</p>
</form>
</section>
<main id="workspace" hidden>
<section class="connection-band" aria-label="当前业务目标">
<label>
<span>公司</span>
<select id="company-select" aria-label="选择公司"><option value="">请先刷新组织</option></select>
</label>
<label>
<span>产线</span>
<select id="device-id" aria-label="选择产线"><option value="">请选择产线</option></select>
</label>
</section>
<nav class="tabs" aria-label="功能切换">
<button class="tab active" data-target="plot-panel">绘图预览</button>
<button class="tab" data-target="identification-data-panel">辨识数据</button>
<button class="tab" data-target="config-panel">配置发布</button>
<button class="tab" data-target="model-panel">模型管理</button>
<button class="tab" data-target="license-panel">许可证</button>
<button class="tab" data-target="organization-panel">组织管理</button>
</nav>
<section id="plot-panel" class="panel active">
<div class="panel-head">
<div>
<p class="section-kicker">IDENTIFICATION REVIEW</p>
<h2>数据曲线</h2>
</div>
<div class="review-actions">
<span id="review-target">等待辨识结果</span>
<button id="reject-review" class="button danger" disabled>未通过</button>
<button id="approve-review" class="button primary" disabled>通过</button>
</div>
</div>
<div class="plot-grid">
<article class="plot-item">
<div class="plot-title">
<div>
<span>辨识 CSV</span>
<strong>阀门开度与压力</strong>
</div>
<div class="plot-actions"><button class="button icon" data-open-plot="csv" title="放大图像" disabled aria-label="放大辨识图">+</button><button id="show-csv-image" class="button icon" title="在文件夹中显示" disabled aria-label="在文件夹中显示辨识图"></button></div>
</div>
<div class="plot-stage">
<div id="empty-csv-plot" class="empty-state">
<strong>尚未载入辨识曲线</strong>
<span>等待 ReinLoop 上传 CSV</span>
</div>
<img id="csv-plot-image" alt="辨识 CSV 绘图预览" hidden>
</div>
<div class="plot-meta">
<p id="csv-image-path" class="file-path">未接收 CSV</p>
<p id="csv-upload-time" class="upload-time">等待数据</p>
</div>
</article>
<article class="plot-item">
<div class="plot-title">
<div>
<span>行程 JSON</span>
<strong>行程与稳态压力</strong>
</div>
<div class="plot-actions"><button class="button icon" data-open-plot="json" title="放大图像" disabled aria-label="放大行程图">+</button><button id="show-json-image" class="button icon" title="在文件夹中显示" disabled aria-label="在文件夹中显示行程图"></button></div>
</div>
<div class="plot-stage">
<div id="empty-json-plot" class="empty-state">
<strong>尚未载入行程曲线</strong>
<span>等待 ReinLoop 上传行程 JSON</span>
</div>
<img id="json-plot-image" alt="行程稳态压力绘图预览" hidden>
</div>
<div class="plot-meta">
<p id="json-image-path" class="file-path">未接收行程 JSON</p>
<p id="json-upload-time" class="upload-time">等待数据</p>
</div>
</article>
</div>
</section>
<section id="identification-data-panel" class="panel">
<div class="panel-head">
<div><p class="section-kicker">IDENTIFICATION ARCHIVE</p><h2>辨识数据暂存</h2></div>
<button id="refresh-identification-files" class="button secondary">刷新</button>
</div>
<div class="data-surface">
<table><thead><tr><th>上传时间</th><th>文件名</th><th>类型</th><th>大小</th><th>状态</th><th>操作</th></tr></thead><tbody id="identification-file-list"></tbody></table>
<p id="identification-file-empty" class="empty-row">选择公司和产线后刷新辨识数据</p>
</div>
</section>
<section id="config-panel" class="panel">
<div class="panel-head">
<div>
<p class="section-kicker">FUNCTION PARAMETERS</p>
<h2>配置数据</h2>
</div>
<div class="segmented" aria-label="配置类型">
<button class="segment active" data-type="volume">容积测量</button>
<button class="segment" data-type="identification">系统辨识</button>
</div>
</div>
<div class="editor-layout">
<div class="editor-column">
<div class="editor-toolbar">
<span id="config-label">容积测量配置</span>
<button id="import-config" class="text-button">导入 JSON</button>
</div>
<textarea id="config-editor" spellcheck="false" aria-label="JSON 配置编辑器"></textarea>
<p id="config-path" class="file-path">可直接编辑,或从本地 JSON 导入</p>
</div>
<aside class="publish-aside">
<h3>发布检查</h3>
<dl>
<div><dt>目标</dt><dd id="publish-target">Server 配置文件</dd></div>
<div><dt>格式</dt><dd>JSON</dd></div>
<div><dt>鉴权</dt><dd>Admin Token</dd></div>
</dl>
<button id="load-server" class="button secondary full">读取 Server 配置</button>
<button id="publish-config" class="button primary full">上传容积配置</button>
<p id="publish-result" class="result">等待操作</p>
</aside>
</div>
</section>
<section id="model-panel" class="panel">
<div class="panel-head">
<div><p class="section-kicker">MODEL CONTROL</p><h2>产线模型</h2></div>
<div class="actions">
<button id="refresh-models" class="button secondary">刷新</button>
<button id="upload-model" class="button primary">上传模型</button>
</div>
</div>
<div class="data-surface">
<table><thead><tr><th>文件名</th><th>上传时间</th><th>大小</th><th>操作</th></tr></thead><tbody id="model-list"></tbody></table>
<p id="model-empty" class="empty-row">选择公司和产线后刷新模型列表</p>
</div>
</section>
<section id="license-panel" class="panel">
<div class="panel-head">
<div><p class="section-kicker">LICENSE REGISTRY</p><h2>许可证签发与管理</h2></div>
<button id="refresh-licenses" class="button secondary">刷新列表</button>
</div>
<div class="management-layout">
<form id="license-form" class="form-surface">
<h3>签发许可证</h3>
<label><span>当前目标</span><input id="license-target" readonly placeholder="请先选择公司和产线"></label>
<label><span>签发时间</span><input id="license-issued" type="datetime-local" required></label>
<label><span>到期时间</span><input id="license-expiry" type="datetime-local" required></label>
<label><span>功能</span><input id="license-features" value="*" required></label>
<button class="button primary" type="submit">选择私钥并签发</button>
<p class="form-note">许可证保存到本地后同步登记到 Server;私钥不会上传或保存。</p>
</form>
<div class="data-surface">
<table><thead><tr><th>公司 / 产线</th><th>有效期</th><th>状态</th><th>操作</th></tr></thead><tbody id="license-list"></tbody></table>
<p id="license-empty" class="empty-row">尚未读取许可证</p>
<pre id="license-detail" class="detail-view" hidden></pre>
</div>
</div>
</section>
<section id="organization-panel" class="panel">
<div class="panel-head">
<div><p class="section-kicker">ORGANIZATION</p><h2>公司与产线</h2></div>
<button id="refresh-organizations" class="button secondary">刷新组织</button>
</div>
<div class="management-layout equal">
<form id="company-form" class="form-surface">
<h3>添加公司</h3>
<label><span>公司名称</span><input id="company-name" required></label>
<label><span>公司编码</span><input id="company-code" pattern="[a-z0-9][a-z0-9_-]{1,63}" required></label>
<button class="button primary" type="submit">添加公司</button>
</form>
<form id="line-form" class="form-surface">
<h3>添加产线</h3>
<label><span>所属公司</span><select id="line-company" required><option value="">请选择公司</option></select></label>
<label><span>产线名称</span><input id="line-name" required></label>
<label><span>产线编码</span><input id="line-code" pattern="[a-z0-9][a-z0-9_-]{1,63}" required></label>
<button class="button primary" type="submit">添加产线</button>
</form>
</div>
</section>
</main>
<div id="image-lightbox" class="lightbox" hidden role="dialog" aria-modal="true" aria-labelledby="lightbox-title">
<div class="lightbox-shell">
<div class="lightbox-toolbar"><strong id="lightbox-title">图像预览</strong><div class="lightbox-actions"><button id="zoom-out" class="button icon" title="缩小" aria-label="缩小图像">-</button><button id="zoom-in" class="button icon" title="放大" aria-label="放大图像">+</button><button id="zoom-fit" class="button secondary" type="button">适应窗口</button><button id="zoom-reset" class="button secondary" type="button">原始比例</button><button id="close-lightbox" class="button icon" title="关闭" aria-label="关闭图像预览">x</button></div></div>
<div id="lightbox-canvas" class="lightbox-canvas"><img id="lightbox-image" alt="放大的图像预览"></div>
</div>
</div>
<script src="renderer.js"></script>
</body>
</html>
+716
View File
@@ -0,0 +1,716 @@
const volumeExample = {
q_in_val: 91,
dt: 0.1,
p_max: 200,
fit_low: 50,
fit_high: 200,
T_delta: 30,
xa_full: 1000,
num_runs: 6
};
const identificationExample = {
q_in_val: 91,
dt: 0.1,
n_order: 8,
t_c: 2.5,
levels: [10, 20, 30, 40, 50, 60, 70, 80],
dead_area: 0,
xa_full: 1000,
V_val: 1,
repeat: 2
};
const state = {
configType: "volume",
imagePaths: { csv: null, json: null },
imageDataUrls: { csv: null, json: null },
identificationFiles: [],
configs: { volume: volumeExample, identification: identificationExample },
companies: [],
models: [],
defaultDeviceId: "",
review: null,
retryDeviceId: null,
lightbox: { mediaType: null, scale: 1, fit: true, previousFocus: null },
connected: false
};
const elements = {
status: document.querySelector("#status"),
connectionScreen: document.querySelector("#connection-screen"),
connectionForm: document.querySelector("#connection-form"),
connectionMessage: document.querySelector("#connection-message"),
connectButton: document.querySelector("#connect-button"),
workspace: document.querySelector("#workspace"),
apiUrl: document.querySelector("#api-url"),
adminToken: document.querySelector("#admin-token"),
companySelect: document.querySelector("#company-select"),
deviceId: document.querySelector("#device-id"),
plots: {
csv: {
image: document.querySelector("#csv-plot-image"),
empty: document.querySelector("#empty-csv-plot"),
path: document.querySelector("#csv-image-path"),
uploadTime: document.querySelector("#csv-upload-time"),
showImage: document.querySelector("#show-csv-image"),
openImage: document.querySelector('[data-open-plot="csv"]')
},
json: {
image: document.querySelector("#json-plot-image"),
empty: document.querySelector("#empty-json-plot"),
path: document.querySelector("#json-image-path"),
uploadTime: document.querySelector("#json-upload-time"),
showImage: document.querySelector("#show-json-image"),
openImage: document.querySelector('[data-open-plot="json"]')
}
},
configEditor: document.querySelector("#config-editor"),
configLabel: document.querySelector("#config-label"),
configPath: document.querySelector("#config-path"),
publishTarget: document.querySelector("#publish-target"),
publishButton: document.querySelector("#publish-config"),
publishResult: document.querySelector("#publish-result"),
lineCompany: document.querySelector("#line-company"),
licenseTarget: document.querySelector("#license-target"),
licenseList: document.querySelector("#license-list"),
licenseEmpty: document.querySelector("#license-empty"),
licenseDetail: document.querySelector("#license-detail"),
modelList: document.querySelector("#model-list"),
modelEmpty: document.querySelector("#model-empty"),
identificationFileList: document.querySelector("#identification-file-list"),
identificationFileEmpty: document.querySelector("#identification-file-empty"),
reviewTarget: document.querySelector("#review-target"),
approveReview: document.querySelector("#approve-review"),
rejectReview: document.querySelector("#reject-review"),
lightbox: document.querySelector("#image-lightbox"),
lightboxTitle: document.querySelector("#lightbox-title"),
lightboxImage: document.querySelector("#lightbox-image"),
lightboxCanvas: document.querySelector("#lightbox-canvas"),
zoomIn: document.querySelector("#zoom-in"),
zoomOut: document.querySelector("#zoom-out"),
zoomFit: document.querySelector("#zoom-fit"),
zoomReset: document.querySelector("#zoom-reset"),
closeLightbox: document.querySelector("#close-lightbox")
};
function setStatus(message, tone = "idle") {
elements.status.textContent = message;
elements.status.dataset.tone = tone;
}
function credentials() {
return {
apiUrl: elements.apiUrl.value.trim(),
adminToken: elements.adminToken.value,
deviceId: elements.deviceId.value.trim()
};
}
function selectedCompany() {
return state.companies.find((company) => company.id === elements.companySelect.value);
}
function selectedLine() {
const company = selectedCompany();
return company?.productionLines.find((line) => line.deviceId === elements.deviceId.value);
}
function formatLicenseDate(value) {
return value.replace("T", " ");
}
function formatSize(value) {
if (!Number.isFinite(value)) return "-";
if (value < 1024) return `${value} B`;
if (value < 1024 * 1024) return `${(value / 1024).toFixed(1)} KB`;
return `${(value / 1024 / 1024).toFixed(1)} MB`;
}
function escapeHtml(value) {
const node = document.createElement("span");
node.textContent = String(value ?? "");
return node.innerHTML;
}
async function syncConnection() {
await window.reinloop.setConnection(credentials());
}
function showConnectionError(error) {
const message = (error?.message || String(error))
.replace(/^Error invoking remote method '[^']+': Error: /, "");
elements.connectionMessage.textContent = message;
elements.connectionMessage.dataset.tone = "error";
setStatus("连接失败", "error");
}
async function connectWorkspace() {
const apiUrl = elements.apiUrl.value.trim();
if (!apiUrl) return showConnectionError(new Error("请输入 Server API URL"));
elements.connectButton.disabled = true;
elements.connectionMessage.textContent = "正在校验 Server 与 Admin Token";
elements.connectionMessage.dataset.tone = "busy";
setStatus("正在连接", "busy");
try {
const result = await window.reinloop.testConnection({
apiUrl,
adminToken: elements.adminToken.value
});
state.companies = result.companies;
renderOrganizationOptions();
elements.connectionScreen.hidden = true;
elements.workspace.hidden = false;
state.connected = true;
delete elements.connectionMessage.dataset.tone;
setStatus("连接成功", "success");
} catch (error) {
showConnectionError(error);
} finally {
elements.connectButton.disabled = false;
}
}
function renderOrganizationOptions() {
const previousCompany = elements.companySelect.value;
const companyOptions = state.companies.map((company) => {
const lines = company.productionLines || [];
const onlineCount = lines.filter((line) => line.online === true).length;
const hasKnownStatus = lines.some((line) => typeof line.online === "boolean");
const statusSummary = !lines.length
? " · 暂无产线"
: hasKnownStatus
? `${onlineCount > 0 ? " · ● 在线" : " · ○ 离线"} (${onlineCount}/${lines.length})`
: " · ◇ 状态未知";
return `<option value="${escapeHtml(company.id)}">${escapeHtml(company.name)} (${escapeHtml(company.code)})${escapeHtml(statusSummary)}</option>`;
}).join("");
elements.companySelect.innerHTML = `<option value="">请选择公司</option>${companyOptions}`;
elements.lineCompany.innerHTML = `<option value="">请选择公司</option>${companyOptions}`;
if (state.companies.some((company) => company.id === previousCompany)) {
elements.companySelect.value = previousCompany;
} else if (state.defaultDeviceId) {
const defaultCompany = state.companies.find((company) =>
company.productionLines.some((line) => line.deviceId === state.defaultDeviceId));
if (defaultCompany) elements.companySelect.value = defaultCompany.id;
}
renderLineOptions();
}
function renderLineOptions() {
const company = selectedCompany();
const previousDevice = elements.deviceId.value;
const lines = company?.productionLines || [];
elements.deviceId.innerHTML = `<option value="">请选择产线</option>${lines.map((line) =>
`<option value="${escapeHtml(line.deviceId)}">${escapeHtml(line.online === true ? "● 在线" : line.online === false ? "○ 离线" : "◇ 状态未知")} · ${escapeHtml(line.name)} (${escapeHtml(line.code)})</option>`
).join("")}`;
if (lines.some((line) => line.deviceId === previousDevice)) {
elements.deviceId.value = previousDevice;
} else if (lines.some((line) => line.deviceId === state.defaultDeviceId)) {
elements.deviceId.value = state.defaultDeviceId;
}
updateSelectedTarget();
}
function updateSelectedTarget() {
const company = selectedCompany();
const line = selectedLine();
elements.licenseTarget.value = company && line ? `${company.name} / ${line.name}` : "";
void syncConnection();
}
async function refreshOrganizations(silent = false) {
if (silent) {
try {
const result = await window.reinloop.listOrganizations(credentials());
state.companies = result.companies;
renderOrganizationOptions();
} catch (_error) {
// Keep the last known status; explicit operations still report errors.
}
return;
}
const result = await runBusy("正在读取组织", () => window.reinloop.listOrganizations(credentials()));
if (!result) return;
state.companies = result.companies;
renderOrganizationOptions();
setStatus("组织已刷新", "success");
}
async function refreshLicenses() {
const result = await runBusy("正在读取许可证", () => window.reinloop.listLicenses(credentials()));
if (!result) return;
elements.licenseList.innerHTML = result.licenses.map((license) => `
<tr><td>${escapeHtml(license.companyName)} / ${escapeHtml(license.productionLineName)}</td>
<td>${escapeHtml(license.expiry)}</td><td>${license.status === "active" ? "有效" : "已撤销"}</td>
<td><button class="table-action" data-license-detail="${escapeHtml(license.licenseId)}">详情</button>${license.status === "active" ? `<button class="table-action danger" data-license-revoke="${escapeHtml(license.licenseId)}">撤销</button>` : ""}</td></tr>
`).join("");
elements.licenseEmpty.hidden = result.licenses.length > 0;
setStatus("许可证已刷新", "success");
}
async function refreshModels() {
if (!elements.deviceId.value) return showError(new Error("请先选择公司和产线"));
const result = await runBusy("正在读取模型", () => window.reinloop.listModels({
deviceId: elements.deviceId.value, credentials: credentials()
}));
if (!result) return;
state.models = result.fileList;
elements.modelList.innerHTML = state.models.map((model) => `
<tr><td>${escapeHtml(model.fileName)}</td><td>${escapeHtml(model.uploadTime || "-")}</td>
<td>${formatSize(model.size)}</td><td><button class="table-action" data-model-download="${escapeHtml(model.fileID)}">下载</button><button class="table-action danger" data-model-delete="${escapeHtml(model.fileID)}">删除</button></td></tr>
`).join("");
elements.modelEmpty.hidden = state.models.length > 0;
setStatus("模型已刷新", "success");
}
async function refreshIdentificationFiles() {
if (!elements.deviceId.value) return showError(new Error("请先选择公司和产线"));
const result = await runBusy("正在读取辨识暂存数据", () => window.reinloop.listIdentificationFiles({
deviceId: elements.deviceId.value, page: 1, pageSize: 100, credentials: credentials()
}));
if (!result) return;
state.identificationFiles = result.files || result.fileList || [];
elements.identificationFileList.innerHTML = state.identificationFiles.map((file) => `
<tr><td>${escapeHtml(file.uploadTime || "-")}</td><td>${escapeHtml(file.fileName)}</td>
<td>${file.mediaType === "json" ? "行程 JSON" : "辨识 CSV"}</td><td>${formatSize(file.size)}</td>
<td>${file.status === "processed" ? "已处理" : "待处理"}</td>
<td><button class="table-action" data-identification-preview="${escapeHtml(file.fileID)}">查看</button><button class="table-action" data-identification-download="${escapeHtml(file.fileID)}">下载</button><button class="table-action danger" data-identification-delete="${escapeHtml(file.fileID)}">删除</button></td></tr>
`).join("");
elements.identificationFileEmpty.hidden = state.identificationFiles.length > 0;
setStatus("辨识数据已刷新", "success");
}
function showError(error) {
const message = (error?.message || String(error))
.replace(/^Error invoking remote method '[^']+': Error: /, "");
setStatus(message, "error");
elements.status.title = message;
elements.publishResult.textContent = message;
elements.publishResult.dataset.tone = "error";
}
function showImage(result) {
if (!result) return;
const mediaType = result.mediaType === "json" || result.fileName?.toLowerCase().endsWith(".json")
? "json"
: "csv";
const plot = elements.plots[mediaType];
state.imagePaths[mediaType] = result.filePath;
state.imageDataUrls[mediaType] = result.dataUrl;
plot.image.src = result.dataUrl;
plot.image.hidden = false;
plot.empty.hidden = true;
plot.path.textContent = result.filePath;
if (result.uploadTime) {
const uploadedAt = new Date(result.uploadTime);
plot.uploadTime.textContent = `上传时间:${uploadedAt.toLocaleString("zh-CN", { hour12: false })}`;
} else {
plot.uploadTime.textContent = "已接收";
}
plot.showImage.disabled = false;
plot.openImage.disabled = false;
if (mediaType === "csv" && result.reviewable) {
state.review = { runId: result.fileName, deviceId: result.deviceId };
elements.reviewTarget.textContent = result.fileName;
elements.approveReview.disabled = false;
elements.rejectReview.disabled = false;
}
setStatus("图片已载入", "success");
}
function updateLightboxImage() {
const image = elements.lightboxImage;
if (state.lightbox.fit) {
image.classList.add("fit-image");
image.style.width = "";
return;
}
image.classList.remove("fit-image");
if (image.complete && image.naturalWidth) image.style.width = `${Math.round(image.naturalWidth * state.lightbox.scale)}px`;
}
function openLightbox(mediaType) {
const source = state.imageDataUrls[mediaType];
if (!source) return;
state.lightbox.mediaType = mediaType;
state.lightbox.scale = 1;
state.lightbox.fit = true;
state.lightbox.previousFocus = document.activeElement;
elements.lightboxTitle.textContent = mediaType === "json" ? "行程稳态压力图" : "辨识 CSV 图";
elements.lightboxImage.src = source;
elements.lightboxImage.onload = updateLightboxImage;
elements.lightbox.hidden = false;
elements.closeLightbox.focus();
}
function closeLightbox() {
if (elements.lightbox.hidden) return;
elements.lightbox.hidden = true;
elements.lightboxImage.removeAttribute("src");
state.lightbox.previousFocus?.focus();
state.lightbox.previousFocus = null;
}
function zoomLightbox(direction) {
state.lightbox.fit = false;
state.lightbox.scale = Math.min(4, Math.max(0.25, state.lightbox.scale * direction));
updateLightboxImage();
}
function finishReview(result) {
state.review = null;
elements.reviewTarget.textContent = result === 1 ? "已提交:通过" : "已提交:未通过";
elements.approveReview.disabled = true;
elements.rejectReview.disabled = true;
}
function activateTab(target) {
document.querySelectorAll(".tab").forEach((item) => item.classList.toggle("active", item.dataset.target === target));
document.querySelectorAll(".panel").forEach((panel) => panel.classList.toggle("active", panel.id === target));
}
function activateConfigType(configType) {
try {
state.configs[state.configType] = JSON.parse(elements.configEditor.value);
} catch (_error) {
// Keep the last valid configuration when changing views.
}
state.configType = configType;
document.querySelectorAll(".segment").forEach((item) => item.classList.toggle("active", item.dataset.type === configType));
renderConfig();
}
function switchToIdentificationConfigForRetry() {
if (!state.review) return;
state.retryDeviceId = state.review.deviceId;
activateTab("config-panel");
activateConfigType("identification");
elements.publishResult.textContent = `本轮辨识未通过。请检查配置后发布到设备 ${state.retryDeviceId},发布成功后将自动要求重测。`;
elements.publishResult.dataset.tone = "error";
setStatus("请重新发布辨识配置", "busy");
}
async function submitReview(result) {
if (!state.review) return;
if (result === 0) return switchToIdentificationConfigForRetry();
const review = state.review;
const submitted = await runBusy("正在提交辨识结论", () => window.reinloop.submitReview({
deviceId: review.deviceId,
runId: review.runId,
result,
credentials: credentials()
}));
if (submitted) {
finishReview(result);
state.retryDeviceId = null;
setStatus("辨识结果已通过", "success");
}
}
async function submitRetryReview() {
if (!state.review || !state.retryDeviceId) return;
const review = state.review;
const submitted = await runBusy("正在提交未通过结论", () => window.reinloop.submitReview({
deviceId: review.deviceId, runId: review.runId, result: 0, credentials: credentials()
}));
if (!submitted) return;
finishReview(0);
state.retryDeviceId = null;
setStatus("新配置已发布,已要求设备重测", "success");
}
function renderConfig() {
const isVolume = state.configType === "volume";
elements.configEditor.value = JSON.stringify(state.configs[state.configType], null, 2);
elements.configLabel.textContent = isVolume ? "容积测量配置" : "系统辨识配置";
elements.publishTarget.textContent = isVolume ? "Server 配置文件" : "设备辨识配置";
elements.publishButton.textContent = isVolume ? "上传容积配置" : "发布辨识配置";
elements.configPath.textContent = "可直接编辑,或从本地 JSON 导入";
elements.publishResult.textContent = "等待操作";
delete elements.publishResult.dataset.tone;
}
async function runBusy(label, action) {
setStatus(label, "busy");
try {
return await action();
} catch (error) {
showError(error);
return null;
}
}
document.querySelectorAll(".tab").forEach((button) => button.addEventListener("click", () => activateTab(button.dataset.target)));
document.querySelectorAll(".segment").forEach((button) => button.addEventListener("click", () => activateConfigType(button.dataset.type)));
Object.entries(elements.plots).forEach(([mediaType, plot]) => {
plot.showImage.addEventListener("click", () => window.reinloop.showInFolder(state.imagePaths[mediaType]));
plot.openImage.addEventListener("click", () => openLightbox(mediaType));
});
elements.approveReview.addEventListener("click", () => void submitReview(1));
elements.rejectReview.addEventListener("click", () => void submitReview(0));
elements.companySelect.addEventListener("change", renderLineOptions);
elements.deviceId.addEventListener("change", updateSelectedTarget);
elements.connectionForm.addEventListener("submit", (event) => {
event.preventDefault();
void connectWorkspace();
});
document.querySelector("#refresh-organizations").addEventListener("click", refreshOrganizations);
document.querySelector("#company-form").addEventListener("submit", async (event) => {
event.preventDefault();
const result = await runBusy("正在添加公司", () => window.reinloop.createCompany({
name: document.querySelector("#company-name").value,
code: document.querySelector("#company-code").value,
credentials: credentials()
}));
if (!result) return;
event.target.reset();
await refreshOrganizations();
});
document.querySelector("#line-form").addEventListener("submit", async (event) => {
event.preventDefault();
const result = await runBusy("正在添加产线", () => window.reinloop.createProductionLine({
companyId: elements.lineCompany.value,
name: document.querySelector("#line-name").value,
code: document.querySelector("#line-code").value,
credentials: credentials()
}));
if (!result) return;
event.target.reset();
await refreshOrganizations();
});
document.querySelector("#license-form").addEventListener("submit", async (event) => {
event.preventDefault();
const company = selectedCompany();
const line = selectedLine();
if (!company || !line) return showError(new Error("请先选择公司和产线"));
const result = await runBusy("正在签发许可证", () => window.reinloop.issueLicense({
companyId: company.id, companyCode: company.code, customer: company.name,
productionLineId: line.id, lineCode: line.code, deviceId: line.deviceId,
issued: formatLicenseDate(document.querySelector("#license-issued").value),
expiry: formatLicenseDate(document.querySelector("#license-expiry").value),
features: document.querySelector("#license-features").value,
credentials: credentials()
}));
if (!result) return;
setStatus(`许可证已保存: ${result.filePath}`, "success");
await refreshLicenses();
});
document.querySelector("#refresh-licenses").addEventListener("click", refreshLicenses);
elements.licenseList.addEventListener("click", async (event) => {
const detailId = event.target.dataset.licenseDetail;
const revokeId = event.target.dataset.licenseRevoke;
if (detailId) {
const result = await runBusy("正在读取许可证详情", () => window.reinloop.getLicense({ licenseId: detailId, credentials: credentials() }));
if (result) {
elements.licenseDetail.textContent = JSON.stringify(result.license, null, 2);
elements.licenseDetail.hidden = false;
}
}
if (revokeId) {
const reason = window.prompt("请输入撤销原因", "管理员撤销");
if (reason === null) return;
const result = await runBusy("正在撤销许可证", () => window.reinloop.revokeLicense({ licenseId: revokeId, reason, credentials: credentials() }));
if (result) await refreshLicenses();
}
});
document.querySelector("#refresh-models").addEventListener("click", refreshModels);
document.querySelector("#upload-model").addEventListener("click", async () => {
if (!elements.deviceId.value) return showError(new Error("请先选择公司和产线"));
const button = document.querySelector("#upload-model");
button.disabled = true;
try {
const models = await runBusy("正在读取模型", () => window.reinloop.listModels({
deviceId: elements.deviceId.value, credentials: credentials()
}));
if (!models) return;
state.models = models.fileList;
const selected = await runBusy("正在选择模型文件", () => window.reinloop.chooseModelUploadFile());
if (!selected) return;
const existing = state.models.find((model) => model.fileName === selected.fileName);
let overwrite = false;
if (existing) {
if (!window.confirm(`已存在同名模型 ${selected.fileName},覆盖后无法恢复。是否继续?`)) return;
const confirmation = window.prompt(`请输入完整文件名以确认覆盖:${selected.fileName}`);
if (confirmation !== selected.fileName) {
setStatus("文件名不匹配,已取消覆盖", "idle");
return;
}
overwrite = true;
}
const result = await runBusy("正在上传模型", () => window.reinloop.uploadModel({
deviceId: elements.deviceId.value, sourcePath: selected.sourcePath, fileName: selected.fileName,
overwrite, credentials: credentials()
}));
if (result) {
setStatus(overwrite ? "模型已覆盖" : "模型已上传", "success");
await refreshModels();
}
} finally {
button.disabled = false;
}
});
elements.modelList.addEventListener("click", async (event) => {
const fileID = event.target.dataset.modelDownload || event.target.dataset.modelDelete;
if (!fileID) return;
const model = state.models.find((item) => item.fileID === fileID);
if (event.target.dataset.modelDownload) {
const result = await runBusy("正在下载模型", () => window.reinloop.downloadModel({ fileID, fileName: model.fileName, credentials: credentials() }));
if (result) setStatus(`模型已下载: ${result.filePath}`, "success");
} else {
if (!window.confirm(`确认删除模型 ${model.fileName}`)) return;
const confirmation = window.prompt(`删除不可恢复。请输入完整文件名以确认:${model.fileName}`);
if (confirmation !== model.fileName) {
setStatus("文件名不匹配,已取消删除", "idle");
return;
}
event.target.disabled = true;
try {
const result = await runBusy("正在删除模型", () => window.reinloop.deleteModel({ fileID, credentials: credentials() }));
if (result) await refreshModels();
} finally {
event.target.disabled = false;
}
}
});
document.querySelector("#refresh-identification-files").addEventListener("click", refreshIdentificationFiles);
elements.identificationFileList.addEventListener("click", async (event) => {
const fileID = event.target.dataset.identificationPreview || event.target.dataset.identificationDownload || event.target.dataset.identificationDelete;
if (!fileID) return;
const file = state.identificationFiles.find((item) => item.fileID === fileID);
if (!file) return;
if (event.target.dataset.identificationPreview) {
const result = await runBusy("正在下载并生成预览", () => window.reinloop.previewIdentificationFile({
...file, deviceId: elements.deviceId.value, credentials: credentials()
}));
if (result) {
showImage(result);
activateTab("plot-panel");
}
} else if (event.target.dataset.identificationDownload) {
const result = await runBusy("正在保存辨识原始数据", () => window.reinloop.downloadIdentificationFile({
...file, credentials: credentials()
}));
if (result) setStatus(`已保存到: ${result.filePath}`, "success");
} else {
if (!window.confirm(`确认永久删除 ${file.fileName}`)) return;
if (!window.confirm("删除后无法恢复,确认继续?")) return;
event.target.disabled = true;
try {
const result = await runBusy("正在删除辨识数据", () => window.reinloop.deleteIdentificationFile({
fileID, credentials: credentials()
}));
if (result) await refreshIdentificationFiles();
} finally {
event.target.disabled = false;
}
}
});
document.querySelector("#import-config").addEventListener("click", async () => {
const result = await runBusy("正在导入配置", () => window.reinloop.chooseConfig());
if (!result) return;
state.configs[state.configType] = result.parameters;
elements.configEditor.value = JSON.stringify(result.parameters, null, 2);
elements.configPath.textContent = result.filePath;
setStatus("配置已导入", "success");
});
document.querySelector("#load-server").addEventListener("click", async () => {
const parameters = await runBusy("正在读取 Server 配置", () => window.reinloop.getConfig({
configType: state.configType,
credentials: credentials()
}));
if (!parameters) return;
state.configs[state.configType] = parameters;
elements.configEditor.value = JSON.stringify(parameters, null, 2);
elements.publishResult.textContent = "已读取当前 Server 配置";
elements.publishResult.dataset.tone = "success";
setStatus("读取完成", "success");
});
elements.publishButton.addEventListener("click", async () => {
let parameters;
try {
parameters = JSON.parse(elements.configEditor.value);
} catch (error) {
showError(new Error(`JSON 格式错误: ${error.message}`));
return;
}
const result = await runBusy("正在发布配置", () => window.reinloop.publishConfig({
configType: state.configType,
parameters,
credentials: {
...credentials(),
deviceId: state.configType === "identification" && state.retryDeviceId
? state.retryDeviceId
: credentials().deviceId
}
}));
if (!result) return;
state.configs[state.configType] = parameters;
elements.publishResult.textContent = result.storagePath
? `${result.message}: ${result.storagePath}`
: result.message;
elements.publishResult.dataset.tone = "success";
if (state.configType === "identification" && state.retryDeviceId) {
await submitRetryReview();
} else {
setStatus("发布完成", "success");
}
});
window.reinloop.getDefaults().then((defaults) => {
elements.apiUrl.value = defaults.apiUrl;
state.defaultDeviceId = defaults.deviceId;
elements.adminToken.placeholder = defaults.hasAdminToken
? "已使用环境变量中的 Token"
: "请输入 Admin Token";
});
window.reinloop.onCsvUpdated((result) => {
showImage(result);
if (state.connected) void refreshIdentificationFiles();
setStatus(`已接收 ${result.fileName}`, "success");
});
window.reinloop.onCsvWatchError((message) => {
setStatus("数据接收异常", "error");
const pendingPlot = Object.values(elements.plots).find((plot) => plot.image.hidden);
if (pendingPlot) pendingPlot.path.textContent = message;
});
setInterval(() => {
if (state.connected) void refreshOrganizations(true);
}, 10000);
renderConfig();
elements.closeLightbox.addEventListener("click", closeLightbox);
elements.zoomIn.addEventListener("click", () => zoomLightbox(1.25));
elements.zoomOut.addEventListener("click", () => zoomLightbox(0.8));
elements.zoomFit.addEventListener("click", () => {
state.lightbox.fit = true;
updateLightboxImage();
});
elements.zoomReset.addEventListener("click", () => {
state.lightbox.fit = false;
state.lightbox.scale = 1;
updateLightboxImage();
});
elements.lightbox.addEventListener("click", (event) => {
if (event.target === elements.lightbox) closeLightbox();
});
document.addEventListener("keydown", (event) => {
if (event.key === "Escape") closeLightbox();
if (!elements.lightbox.hidden && event.key === "+") zoomLightbox(1.25);
if (!elements.lightbox.hidden && event.key === "-") zoomLightbox(0.8);
});
+258
View File
@@ -0,0 +1,258 @@
:root {
color-scheme: light;
--ink: #15251f;
--muted: #617069;
--line: #cfd7d2;
--paper: #f2f4f1;
--surface: #ffffff;
--green: #146b4a;
--green-dark: #0d4b34;
--amber: #e7a928;
--red: #ad342d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
margin: 0;
min-width: 900px;
color: var(--ink);
background:
linear-gradient(rgba(20, 107, 74, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(20, 107, 74, 0.035) 1px, transparent 1px),
var(--paper);
background-size: 28px 28px;
font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
.topbar {
height: 104px;
padding: 20px 36px;
color: white;
background: var(--ink);
border-bottom: 5px solid var(--amber);
display: flex;
align-items: center;
justify-content: space-between;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, "Microsoft YaHei UI", serif; font-size: 28px; font-weight: 600; letter-spacing: 0; }
h2 { font-family: Georgia, "Microsoft YaHei UI", serif; font-size: 25px; font-weight: 600; letter-spacing: 0; }
h3 { font-size: 15px; }
.eyebrow, .section-kicker { font-size: 11px; letter-spacing: 0; font-weight: 700; }
.eyebrow { color: #a9c1b6; margin-bottom: 5px; }
.section-kicker { color: var(--green); margin-bottom: 5px; }
.status {
min-width: 110px;
max-width: 420px;
padding: 8px 14px;
border: 1px solid #587067;
border-radius: 4px;
color: #d9e4df;
text-align: center;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status[data-tone="busy"] { border-color: var(--amber); color: #ffd985; }
.status[data-tone="success"] { border-color: #62b78f; color: #9fe1bf; }
.status[data-tone="error"] { border-color: #df766e; color: #ffb5ae; }
main { max-width: 1500px; margin: 0 auto; padding: 22px 36px 36px; }
.connection-screen {
min-height: calc(100vh - 104px);
display: grid;
place-items: center;
padding: 36px;
}
.connection-form {
width: min(480px, 100%);
padding: 30px;
display: grid;
gap: 18px;
background: var(--surface);
border: 1px solid var(--line);
border-top: 4px solid var(--green);
box-shadow: 0 18px 45px rgba(21, 37, 31, 0.12);
}
.connection-form h2 { margin-bottom: 6px; }
.connection-form label { display: grid; gap: 7px; }
.connection-form label span { color: var(--muted); font-size: 12px; font-weight: 700; }
.connection-form .button { width: 100%; margin-top: 4px; }
.connection-message { min-height: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.connection-message[data-tone="busy"] { color: #8a6414; }
.connection-message[data-tone="error"] { color: var(--red); }
.connection-band {
display: grid;
grid-template-columns: repeat(2, minmax(260px, 1fr));
gap: 18px;
padding: 15px 18px;
background: #e4e9e5;
border: 1px solid var(--line);
border-left: 4px solid var(--green);
}
.connection-band label { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 10px; }
.connection-band span { font-size: 12px; font-weight: 700; color: var(--muted); }
input, select {
min-width: 0;
height: 36px;
padding: 0 10px;
border: 1px solid #b9c5be;
border-radius: 3px;
background: white;
color: var(--ink);
outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(20, 107, 74, 0.12); }
.tabs { display: flex; gap: 0; margin-top: 22px; border-bottom: 1px solid var(--line); }
.tab {
min-width: 132px;
padding: 12px 20px;
border: 0;
border-bottom: 3px solid transparent;
background: transparent;
color: var(--muted);
font-weight: 700;
}
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
.panel { display: none; padding-top: 22px; }
.panel.active { display: block; animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.panel-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; }
.button {
height: 38px;
padding: 0 16px;
border-radius: 3px;
border: 1px solid transparent;
font-weight: 700;
}
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--ink); background: white; border-color: #aebbb4; }
.button.secondary:hover { border-color: var(--green); color: var(--green); }
.button.danger { color: var(--red); background: white; border-color: #d5a7a3; }
.button.danger:hover { color: white; background: var(--red); border-color: var(--red); }
.button.icon { width: 38px; padding: 0; background: white; border-color: #aebbb4; font-size: 19px; }
.plot-actions { display: flex; gap: 6px; }
.button.full { width: 100%; margin-top: 10px; }
.review-actions { display: flex; align-items: center; gap: 8px; }
.review-actions span { max-width: 320px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.plot-item { min-width: 0; }
.plot-title {
min-height: 54px;
padding: 9px 12px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
background: var(--surface);
border: 1px solid var(--line);
border-bottom: 0;
}
.plot-title div { display: grid; gap: 3px; }
.plot-title span { color: var(--green); font-size: 11px; font-weight: 700; }
.plot-title strong { font-size: 15px; }
.plot-stage {
height: calc(100vh - 405px);
min-height: 300px;
max-height: 620px;
display: grid;
place-items: center;
overflow: auto;
background-color: #dce2de;
background-image: linear-gradient(45deg, #d3dad5 25%, transparent 25%), linear-gradient(-45deg, #d3dad5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d3dad5 75%), linear-gradient(-45deg, transparent 75%, #d3dad5 75%);
background-size: 20px 20px;
background-position: 0 0, 0 10px, 10px -10px, -10px 0;
border: 1px solid #bdc8c1;
}
.plot-stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: white; }
.empty-state { display: grid; gap: 7px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.empty-state span { font-size: 13px; }
.plot-meta { min-height: 29px; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.file-path { min-height: 20px; margin-top: 9px; color: var(--muted); font: 12px Consolas, monospace; overflow-wrap: anywhere; }
.upload-time { flex: 0 0 auto; margin-top: 9px; color: var(--green-dark); font-size: 12px; font-weight: 700; }
.segmented { display: flex; padding: 3px; background: #dfe5e1; border: 1px solid #c6d0ca; border-radius: 4px; }
.segment { height: 34px; padding: 0 16px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-weight: 700; }
.segment.active { background: white; color: var(--green-dark); box-shadow: 0 1px 3px rgba(21, 37, 31, 0.14); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
.editor-column, .publish-aside { background: var(--surface); border: 1px solid var(--line); }
.editor-toolbar { height: 46px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.text-button { border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 700; }
textarea {
display: block;
width: calc(100% - 28px);
height: calc(100vh - 385px);
min-height: 330px;
margin: 14px;
padding: 16px;
resize: vertical;
border: 1px solid #bec9c2;
border-radius: 3px;
background: #f8faf8;
color: #18392d;
font: 14px/1.65 Consolas, "Microsoft YaHei UI", monospace;
tab-size: 2;
outline: none;
}
.editor-column > .file-path { padding: 0 14px 12px; }
.publish-aside { padding: 20px; align-self: start; }
.publish-aside h3 { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
dl { margin: 8px 0 18px; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #e6ebe8; font-size: 12px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-weight: 700; }
.result { min-height: 42px; margin-top: 14px; padding: 10px; background: #eef1ef; color: var(--muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.result[data-tone="success"] { color: var(--green-dark); background: #e2f2e9; }
.result[data-tone="error"] { color: var(--red); background: #f8e7e5; }
.management-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.management-layout.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-surface, .data-surface { background: var(--surface); border: 1px solid var(--line); }
.form-surface { padding: 20px; display: grid; gap: 14px; }
.form-surface h3 { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.form-surface label { display: grid; gap: 6px; }
.form-surface label span { color: var(--muted); font-size: 12px; font-weight: 700; }
.form-note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.data-surface { min-width: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e4e9e6; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #edf1ee; font-size: 11px; }
td:last-child { white-space: nowrap; }
.table-action { border: 0; background: transparent; color: var(--green); font-weight: 700; margin-right: 10px; }
.table-action.danger { color: var(--red); }
.empty-row { padding: 30px; color: var(--muted); text-align: center; font-size: 13px; }
.detail-view { margin: 0; padding: 16px; max-height: 260px; overflow: auto; background: #18251f; color: #d9e9df; font: 12px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.lightbox { position: fixed; inset: 0; z-index: 20; padding: 24px; background: rgba(10, 20, 16, 0.78); }
.lightbox-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--surface); border: 1px solid #9aa9a1; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.lightbox-toolbar { min-height: 58px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.lightbox-actions { display: flex; align-items: center; gap: 7px; }
.lightbox-canvas { min-width: 0; min-height: 0; display: grid; place-items: center; overflow: auto; padding: 22px; background-color: #dce2de; background-image: linear-gradient(45deg, #d3dad5 25%, transparent 25%), linear-gradient(-45deg, #d3dad5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d3dad5 75%), linear-gradient(-45deg, transparent 75%, #d3dad5 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.lightbox-canvas img { display: block; max-width: none; background: white; }
.lightbox-canvas img.fit-image { max-width: 100%; max-height: 100%; object-fit: contain; }
@media (max-width: 1050px) {
main { padding-left: 22px; padding-right: 22px; }
.connection-band { grid-template-columns: 1fr; }
.plot-grid { grid-template-columns: 1fr; }
.plot-stage { height: 360px; }
.editor-layout { grid-template-columns: minmax(0, 1fr) 240px; }
.management-layout, .management-layout.equal { grid-template-columns: 1fr; }
.lightbox { padding: 12px; }
.lightbox-toolbar { align-items: start; flex-direction: column; }
}