From 9c578ea44b52c04ea56faecc3187cc2a3be22124 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Tue, 9 Jun 2026 15:31:26 +0800 Subject: [PATCH] Show current config state in switch console --- .gitignore | 1 + web/strategy-switch-console/index.html | 55 ++++++++++++++++++----- web/strategy-switch-console/page_asset.js | 2 +- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 3e24f18..d61d069 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ __pycache__/ .pytest_cache/ .ruff_cache/ .venv/ +.wrangler/ local/ diff --git a/web/strategy-switch-console/index.html b/web/strategy-switch-console/index.html index e165d8d..e209ba8 100644 --- a/web/strategy-switch-console/index.html +++ b/web/strategy-switch-console/index.html @@ -362,6 +362,9 @@ outline: none; font-size: 14px; font-weight: 680; + overflow: hidden; + padding-right: 42px; + text-overflow: ellipsis; transition: border-color 150ms ease, box-shadow 150ms ease; } @@ -551,6 +554,10 @@ grid-template-columns: 1fr; gap: 3px; } + + select { + font-size: 13px; + } } @media (prefers-reduced-motion: no-preference) { @@ -736,8 +743,8 @@

切换摘要

mode: "模式", live: "实盘", paper: "Dry run", - summary: "切换摘要", - copySummary: "复制摘要", + summary: "当前配置状态", + copySummary: "复制状态", loginToRun: "登录后切换", configureAccounts: "配置账号后切换", runSwitch: "一键切换", @@ -758,7 +765,7 @@

切换摘要

action: "动作", actionValue: "切换并同步", confirm: "确认词", - copied: "已复制摘要", + copied: "已复制状态", dispatching: "正在触发 workflow...", dispatched: "已触发 workflow", dispatchFailed: "触发失败", @@ -766,6 +773,14 @@

切换摘要

strategyMeta: "该账号仅显示 {domains} 策略", usEquity: "美股", hkEquity: "港股", + currentStrategy: "当前策略", + currentMode: "当前模式", + readSource: "读取来源", + nextStrategy: "选择策略", + nextMode: "选择模式", + notRead: "未读取", + publicPreview: "公开示例", + accountConfigLoaded: "账号配置已加载", }, en: { appTitle: "Strategy Switch", @@ -779,8 +794,8 @@

切换摘要

mode: "Mode", live: "Live", paper: "Dry run", - summary: "Switch Summary", - copySummary: "Copy summary", + summary: "Current Config", + copySummary: "Copy state", loginToRun: "Sign in to switch", configureAccounts: "Configure accounts", runSwitch: "Switch now", @@ -801,7 +816,7 @@

切换摘要

action: "Action", actionValue: "Switch and sync", confirm: "Confirm", - copied: "Summary copied", + copied: "State copied", dispatching: "Dispatching workflow...", dispatched: "Workflow dispatched", dispatchFailed: "Dispatch failed", @@ -809,6 +824,14 @@

切换摘要

strategyMeta: "This account only shows {domains} strategies", usEquity: "US equity", hkEquity: "HK equity", + currentStrategy: "Current strategy", + currentMode: "Current mode", + readSource: "Read source", + nextStrategy: "Selected strategy", + nextMode: "Selected mode", + notRead: "Not read", + publicPreview: "Public preview", + accountConfigLoaded: "Account config loaded", }, }; @@ -1081,15 +1104,20 @@

切换摘要

function summaryRows(inputs) { const account = selectedAccount(); + const currentEntry = currentEntryForAccount(state.selected, account); + const currentProfile = currentStrategyForAccount(state.selected, account); + const currentMode = normalizeExecutionMode(currentEntry?.execution_mode, currentEntry?.dry_run_only); + const source = currentEntry?.source + || (state.configSource === "private" ? t("accountConfigLoaded") : t("publicPreview")); return [ [t("repository"), repositories[state.selected]], [t("selectedAccount"), account.label], - [t("selectedStrategy"), strategyLabel(inputs.strategy_profile)], - [t("selectedMode"), modeLabel(inputs.execution_mode)], + [t("currentStrategy"), currentProfile ? strategyLabel(currentProfile) : t("notRead")], + [t("currentMode"), currentMode ? modeLabel(currentMode) : t("notRead")], + [t("readSource"), source], [t("selectedMarket"), supportedDomainLabel(state.selected, account)], - [t("target"), inputs.target_name], - [t("accountSelector"), inputs.account_selector || "auto"], - [t("service"), inputs.service_name || derivedService(state.selected, inputs.target_name)], + [t("nextStrategy"), strategyLabel(inputs.strategy_profile)], + [t("nextMode"), modeLabel(inputs.execution_mode)], [t("action"), t("actionValue")], [t("confirm"), inputs.confirm_apply], ]; @@ -1192,7 +1220,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 b698d8c..58773ce 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

LongBridge

\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

LongBridge

\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";