From 52392eedec492d97e691aca3d63b6f4e534806dc Mon Sep 17 00:00:00 2001
From: Pigbibi <20649888+Pigbibi@users.noreply.github.com>
Date: Tue, 9 Jun 2026 17:14:25 +0800
Subject: [PATCH] Hide public config state panel
---
tests/strategy_switch_worker_validation.mjs | 5 ++++-
web/strategy-switch-console/index.html | 24 ++++++++++++++-------
web/strategy-switch-console/page_asset.js | 2 +-
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/tests/strategy_switch_worker_validation.mjs b/tests/strategy_switch_worker_validation.mjs
index 680114e..cb8e865 100644
--- a/tests/strategy_switch_worker_validation.mjs
+++ b/tests/strategy_switch_worker_validation.mjs
@@ -13,7 +13,10 @@ assert.equal(indexHtml.includes(".innerHTML"), false);
assert.ok(indexHtml.includes('
'));
assert.ok(indexHtml.includes('id="boot-screen"'));
assert.ok(indexHtml.includes('id="app-shell"'));
-assert.ok(indexHtml.includes('publicSummary: "公开预览"'));
+assert.ok(indexHtml.includes(".switch-surface.summary-hidden"));
+assert.ok(indexHtml.includes('summaryPanel.hidden = !showSummary'));
+assert.ok(indexHtml.includes('switchSurface.classList.toggle("summary-hidden", !showSummary)'));
+assert.equal(indexHtml.includes("publicSummary"), false);
assert.match(indexHtml, /body\.app-loading \.shell\s*\{\s*display: none;/);
const headers = __test.responseHeaders({ "Content-Type": "text/html; charset=utf-8" });
diff --git a/web/strategy-switch-console/index.html b/web/strategy-switch-console/index.html
index 04e007b..545b6fa 100644
--- a/web/strategy-switch-console/index.html
+++ b/web/strategy-switch-console/index.html
@@ -363,6 +363,10 @@
align-items: stretch;
}
+ .switch-surface.summary-hidden {
+ grid-template-columns: minmax(0, 1fr);
+ }
+
.switch-panel,
.summary-panel {
min-width: 0;
@@ -845,7 +849,6 @@ 切换摘要
live: "实盘",
paper: "Dry run",
summary: "当前配置状态",
- publicSummary: "公开预览",
copySummary: "复制状态",
loginToRun: "登录后切换",
loadingConfig: "读取配置中",
@@ -872,8 +875,6 @@ 切换摘要
currentStrategy: "当前策略",
nextStrategy: "选择策略",
notRead: "未读取",
- publicPreview: "公开示例",
- accountConfigLoaded: "账号配置已加载",
},
en: {
appTitle: "Strategy Switch",
@@ -895,7 +896,6 @@ 切换摘要
live: "Live",
paper: "Dry run",
summary: "Current Config",
- publicSummary: "Public Preview",
copySummary: "Copy state",
loginToRun: "Sign in to switch",
loadingConfig: "Loading config",
@@ -922,8 +922,6 @@ 切换摘要
currentStrategy: "Current strategy",
nextStrategy: "Selected strategy",
notRead: "Not read",
- publicPreview: "Public preview",
- accountConfigLoaded: "Account config loaded",
},
};
@@ -1294,10 +1292,17 @@ 切换摘要
}
function renderSummary() {
+ const showSummary = Boolean(state.auth.allowed);
+ const summaryPanel = document.querySelector(".summary-panel");
+ const switchSurface = document.querySelector(".switch-surface");
+ summaryPanel.hidden = !showSummary;
+ switchSurface.classList.toggle("summary-hidden", !showSummary);
+ if (!showSummary) return;
+
const inputs = buildInputs();
const list = el("summary-list");
list.replaceChildren();
- document.querySelector(".summary-head h2").textContent = state.auth.allowed ? t("summary") : t("publicSummary");
+ document.querySelector(".summary-head h2").textContent = t("summary");
for (const [label, value] of summaryRows(inputs)) {
const row = document.createElement("div");
row.className = "summary-row";
@@ -1309,7 +1314,10 @@ 切换摘要
list.appendChild(row);
}
- el("mode-pill").textContent = modeLabel(inputs.execution_mode);
+ const account = selectedAccount();
+ const currentEntry = currentEntryForAccount(state.selected, account);
+ const currentMode = normalizeExecutionMode(currentEntry?.execution_mode, currentEntry?.dry_run_only);
+ el("mode-pill").textContent = currentMode ? modeLabel(currentMode) : t("notRead");
}
function renderAuth() {
diff --git a/web/strategy-switch-console/page_asset.js b/web/strategy-switch-console/page_asset.js
index 6ddf0ef..a988d32 100644
--- a/web/strategy-switch-console/page_asset.js
+++ b/web/strategy-switch-console/page_asset.js
@@ -1,2 +1,2 @@
// Generated by scripts/sync_strategy_switch_page_asset.py; do not edit by hand.
-export const PAGE_HTML = "\n\n\n \n \n \n QuantRuntimeSettings Strategy Switch\n \n\n\n \n \n
策略切换
\n
选平台、目标账号和策略,一次执行完成切换。
\n
\n \n \n\n \n \n
初始化控制台\n
读取策略配置
\n
正在读取登录状态、账号配置和当前状态。
\n
\n
\n \n\n \n \n\n \n \n
\n 当前平台\n \n
\n\n
\n\n
\n
\n
登录后才可执行切换。
\n
\n
\n
\n\n \n \n \n\n \n\n\n";
+export const PAGE_HTML = "\n\n\n \n \n \n QuantRuntimeSettings Strategy Switch\n \n\n\n \n \n
策略切换
\n
选平台、目标账号和策略,一次执行完成切换。
\n
\n \n \n\n \n \n
初始化控制台\n
读取策略配置
\n
正在读取登录状态、账号配置和当前状态。
\n
\n
\n \n\n \n \n\n \n \n
\n 当前平台\n \n
\n\n
\n\n
\n
\n
登录后才可执行切换。
\n
\n
\n
\n\n \n \n \n\n \n\n\n";