feat: default users to safe virtual CAN execution
This commit is contained in:
@@ -346,7 +346,7 @@
|
|||||||
configStack.append(gestureModelField);
|
configStack.append(gestureModelField);
|
||||||
|
|
||||||
const userHardwareState = make("div", "v2-user-target-status", `
|
const userHardwareState = make("div", "v2-user-target-status", `
|
||||||
<i></i><span id="v2UserTargetText">正在检查真实台架</span>`);
|
<i></i><span id="v2UserTargetText">正在准备虚拟 CAN</span>`);
|
||||||
configStack.append(userHardwareState);
|
configStack.append(userHardwareState);
|
||||||
|
|
||||||
if (providerField) {
|
if (providerField) {
|
||||||
@@ -946,7 +946,7 @@
|
|||||||
setModule("self-orchestration");
|
setModule("self-orchestration");
|
||||||
}
|
}
|
||||||
setPage(0);
|
setPage(0);
|
||||||
requestUserHardwareMode();
|
requestUserSafeExecutionMode();
|
||||||
} else {
|
} else {
|
||||||
const note = $("#v2ExecutionNote");
|
const note = $("#v2ExecutionNote");
|
||||||
if (note) note.textContent = "管理员可切换虚拟 CAN、模拟台架与真实台架";
|
if (note) note.textContent = "管理员可切换虚拟 CAN、模拟台架与真实台架";
|
||||||
@@ -976,25 +976,19 @@
|
|||||||
window.setTimeout(() => window.dispatchEvent(new Event("resize")), 180);
|
window.setTimeout(() => window.dispatchEvent(new Event("resize")), 180);
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestUserHardwareMode() {
|
function requestUserSafeExecutionMode() {
|
||||||
const hardwareButton = $("#hardwareMode");
|
const dryRunButton = $('[data-execution-mode="dry_run"]');
|
||||||
const note = $("#v2ExecutionNote");
|
const note = $("#v2ExecutionNote");
|
||||||
const userTarget = $(".v2-user-target-status");
|
const userTarget = $(".v2-user-target-status");
|
||||||
const userTargetText = $("#v2UserTargetText");
|
const userTargetText = $("#v2UserTargetText");
|
||||||
const runButton = $("#runButton");
|
const runButton = $("#runButton");
|
||||||
if (!hardwareButton) return;
|
if (!dryRunButton) return;
|
||||||
if (!hardwareButton.disabled) {
|
if (!dryRunButton.classList.contains("active")) dryRunButton.click();
|
||||||
if (!hardwareButton.classList.contains("active")) hardwareButton.click();
|
if (note) note.textContent = "测试用户使用虚拟 CAN;真实台架仅由管理员显式启用";
|
||||||
if (note) note.textContent = "user 演示固定使用真实台架";
|
if (userTarget) userTarget.dataset.state = "ready";
|
||||||
if (userTarget) userTarget.dataset.state = "ready";
|
if (userTargetText) userTargetText.textContent = "执行目标:虚拟 CAN";
|
||||||
if (userTargetText) userTargetText.textContent = "执行目标:真实台架";
|
if (runButton && !runButton.classList.contains("loading")) runButton.disabled = false;
|
||||||
if (runButton && !runButton.classList.contains("loading")) runButton.disabled = false;
|
syncExecutionSelector();
|
||||||
} else if (note) {
|
|
||||||
note.textContent = "真实台架尚未就绪,服务端安全门禁保持锁定";
|
|
||||||
if (userTarget) userTarget.dataset.state = "locked";
|
|
||||||
if (userTargetText) userTargetText.textContent = "真实台架尚未就绪";
|
|
||||||
if (runButton) runButton.disabled = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncExecutionSelector() {
|
function syncExecutionSelector() {
|
||||||
@@ -1033,7 +1027,7 @@
|
|||||||
$(".v2-sidebar-footer")?.classList.toggle("offline", !online);
|
$(".v2-sidebar-footer")?.classList.toggle("offline", !online);
|
||||||
}
|
}
|
||||||
syncExecutionSelector();
|
syncExecutionSelector();
|
||||||
if (ui.role === "user") requestUserHardwareMode();
|
if (ui.role === "user") requestUserSafeExecutionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVehicleLinkState(connected) {
|
function setVehicleLinkState(connected) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<script src="/app.js?v=dual-seat-80" defer></script>
|
<script src="/app.js?v=dual-seat-80" defer></script>
|
||||||
<script type="module" src="/gesture-control.js?v=android-pad-7"></script>
|
<script type="module" src="/gesture-control.js?v=android-pad-7"></script>
|
||||||
<script src="/pwa.js?v=android-pad-1" defer></script>
|
<script src="/pwa.js?v=android-pad-1" defer></script>
|
||||||
<script src="/console-v2.js?v=desktop-refactor-34" defer></script>
|
<script src="/console-v2.js?v=desktop-refactor-35" defer></script>
|
||||||
<script src="/self-extension.js?v=extension-20" defer></script>
|
<script src="/self-extension.js?v=extension-20" defer></script>
|
||||||
<script src="/self-calibration.js?v=calibration-6" defer></script>
|
<script src="/self-calibration.js?v=calibration-6" defer></script>
|
||||||
<script src="/self-repair.js?v=repair-20" defer></script>
|
<script src="/self-repair.js?v=repair-20" defer></script>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const CACHE_VERSION = "cognitive-agent-pad-v115";
|
const CACHE_VERSION = "cognitive-agent-pad-v116";
|
||||||
const SHELL_CACHE = `${CACHE_VERSION}-shell`;
|
const SHELL_CACHE = `${CACHE_VERSION}-shell`;
|
||||||
const RUNTIME_CACHE = `${CACHE_VERSION}-runtime`;
|
const RUNTIME_CACHE = `${CACHE_VERSION}-runtime`;
|
||||||
const APP_SHELL = [
|
const APP_SHELL = [
|
||||||
@@ -10,7 +10,7 @@ const APP_SHELL = [
|
|||||||
"/gesture-control.js?v=android-pad-7",
|
"/gesture-control.js?v=android-pad-7",
|
||||||
"/pwa.js?v=android-pad-1",
|
"/pwa.js?v=android-pad-1",
|
||||||
"/console-v2.css?v=desktop-refactor-106",
|
"/console-v2.css?v=desktop-refactor-106",
|
||||||
"/console-v2.js?v=desktop-refactor-34",
|
"/console-v2.js?v=desktop-refactor-35",
|
||||||
"/self-extension.css?v=extension-18",
|
"/self-extension.css?v=extension-18",
|
||||||
"/self-extension.js?v=extension-20",
|
"/self-extension.js?v=extension-20",
|
||||||
"/self-calibration.css?v=calibration-10",
|
"/self-calibration.css?v=calibration-10",
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ operations:
|
|||||||
) as response:
|
) as response:
|
||||||
gesture_script = response.read().decode("utf-8")
|
gesture_script = response.read().decode("utf-8")
|
||||||
with self.opener.open(
|
with self.opener.open(
|
||||||
f"{self.base_url}/console-v2.js?v=desktop-refactor-34", timeout=3
|
f"{self.base_url}/console-v2.js?v=desktop-refactor-35", timeout=3
|
||||||
) as response:
|
) as response:
|
||||||
console_script = response.read().decode("utf-8")
|
console_script = response.read().decode("utf-8")
|
||||||
with self.opener.open(
|
with self.opener.open(
|
||||||
@@ -223,7 +223,7 @@ operations:
|
|||||||
self.assertIn('href="/styles.css?v=dual-seat-9"', html)
|
self.assertIn('href="/styles.css?v=dual-seat-9"', html)
|
||||||
self.assertIn('src="/gesture-control.js?v=android-pad-7"', html)
|
self.assertIn('src="/gesture-control.js?v=android-pad-7"', html)
|
||||||
self.assertNotIn('class="vehicle-system-hud"', html)
|
self.assertNotIn('class="vehicle-system-hud"', html)
|
||||||
self.assertIn('src="/console-v2.js?v=desktop-refactor-34"', html)
|
self.assertIn('src="/console-v2.js?v=desktop-refactor-35"', html)
|
||||||
self.assertIn('href="/console-v2.css?v=desktop-refactor-106"', html)
|
self.assertIn('href="/console-v2.css?v=desktop-refactor-106"', html)
|
||||||
self.assertIn('src="/self-extension.js?v=extension-20"', html)
|
self.assertIn('src="/self-extension.js?v=extension-20"', html)
|
||||||
self.assertIn('href="/self-extension.css?v=extension-18"', html)
|
self.assertIn('href="/self-extension.css?v=extension-18"', html)
|
||||||
@@ -285,7 +285,12 @@ operations:
|
|||||||
self.assertIn("function updateModeEdgeHints()", console_script)
|
self.assertIn("function updateModeEdgeHints()", console_script)
|
||||||
self.assertIn('classList.toggle("v2-twin-active", definition.index === 0)', console_script)
|
self.assertIn('classList.toggle("v2-twin-active", definition.index === 0)', console_script)
|
||||||
self.assertIn('label: "执行结果与硬件回读"', console_script)
|
self.assertIn('label: "执行结果与硬件回读"', console_script)
|
||||||
self.assertIn('userTargetText.textContent = "真实台架尚未就绪"', console_script)
|
self.assertIn("function requestUserSafeExecutionMode()", console_script)
|
||||||
|
self.assertIn('const dryRunButton = $(\'[data-execution-mode="dry_run"]\')', console_script)
|
||||||
|
self.assertIn('if (!dryRunButton.classList.contains("active")) dryRunButton.click()', console_script)
|
||||||
|
self.assertIn('userTargetText.textContent = "执行目标:虚拟 CAN"', console_script)
|
||||||
|
self.assertIn("真实台架仅由管理员显式启用", console_script)
|
||||||
|
self.assertNotIn("user 演示固定使用真实台架", console_script)
|
||||||
self.assertIn('grid-template-columns: clamp(245px, 18.5vw, 310px)', console_styles)
|
self.assertIn('grid-template-columns: clamp(245px, 18.5vw, 310px)', console_styles)
|
||||||
self.assertIn('.v2-control-switch {', console_styles)
|
self.assertIn('.v2-control-switch {', console_styles)
|
||||||
self.assertIn('.v2-module-switcher {', console_styles)
|
self.assertIn('.v2-module-switcher {', console_styles)
|
||||||
|
|||||||
Reference in New Issue
Block a user