feat: notify vehicle of published firmware
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<script src="/firmware-workbench-theme.js?v=1"></script>
|
||||
<link rel="stylesheet" href="/firmware-workbench.css?v=6" />
|
||||
<script src="/vendor/lucide/0.468.0/lucide.min.js" defer></script>
|
||||
<script src="/firmware-workbench.js?v=3" defer></script>
|
||||
<script src="/firmware-workbench.js?v=4" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="shell">
|
||||
|
||||
@@ -271,6 +271,7 @@
|
||||
<button type="button" title="查看验证记录" data-artifact-action="validation" data-artifact-id="${artifact.id}">验证</button>
|
||||
<a href="${escapeHtml(artifact.download_url)}" title="下载固件" aria-label="下载固件" download><i data-lucide="download"></i></a>
|
||||
<button class="publish-action" type="button" title="发布到服务器" data-artifact-action="publish" data-artifact-id="${artifact.id}"><i data-lucide="cloud-upload"></i></button>
|
||||
${artifact.status === "published" ? `<button class="notify-action" type="button" title="通知车端" aria-label="通知车端" data-artifact-action="notify" data-artifact-id="${artifact.id}"><i data-lucide="bell"></i></button>` : ""}
|
||||
${artifact.is_baseline ? `<span class="baseline-protection" title="时间控制基线固件受保护"><i data-lucide="shield-check"></i>受保护</span>` : `<button class="delete-action" type="button" title="删除固件产物" data-artifact-action="delete" data-artifact-id="${artifact.id}"><i data-lucide="trash-2"></i></button>`}
|
||||
</div></td>
|
||||
</tr>`).join("");
|
||||
@@ -400,6 +401,16 @@
|
||||
finally { button.disabled = false; }
|
||||
return;
|
||||
}
|
||||
if (action === "notify") {
|
||||
button.disabled = true;
|
||||
try {
|
||||
const result = await api(`/api/firmware-workbench/artifacts/${artifact.id}/notify`, { method: "POST", body: "{}" });
|
||||
toast(`已向车端发送 ${result.published_count || result.burst_count || 3} 帧通知。`, "success");
|
||||
await refreshState({ quiet: true });
|
||||
} catch (error) { toast(error.message, "error"); }
|
||||
finally { button.disabled = false; }
|
||||
return;
|
||||
}
|
||||
if (action === "detail") {
|
||||
showModal("固件产物详情", `<div class="detail-grid">
|
||||
<div class="detail-field"><span>软件名称</span><strong>${escapeHtml(artifact.software_name)}</strong></div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const CACHE_VERSION = "cognitive-agent-pad-v323-dialog-theme";
|
||||
const CACHE_VERSION = "cognitive-agent-pad-v324-firmware-notification";
|
||||
const SHELL_CACHE = `${CACHE_VERSION}-shell`;
|
||||
const RUNTIME_CACHE = `${CACHE_VERSION}-runtime`;
|
||||
const APP_SHELL = [
|
||||
@@ -28,7 +28,7 @@ const APP_SHELL = [
|
||||
"/firmware-workbench.html",
|
||||
"/firmware-workbench-theme.js?v=1",
|
||||
"/firmware-workbench.css?v=6",
|
||||
"/firmware-workbench.js?v=3",
|
||||
"/firmware-workbench.js?v=4",
|
||||
"/assets/pets/self-extension-cat.png?v=3",
|
||||
"/assets/pets/self-extension-cat-entrance.png?v=3",
|
||||
"/manifest.webmanifest",
|
||||
|
||||
Reference in New Issue
Block a user