Skip to content

Commit 9c578ea

Browse files
committed
Show current config state in switch console
1 parent 477abf8 commit 9c578ea

3 files changed

Lines changed: 45 additions & 13 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ __pycache__/
22
.pytest_cache/
33
.ruff_cache/
44
.venv/
5+
.wrangler/
56
local/

web/strategy-switch-console/index.html

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@
362362
outline: none;
363363
font-size: 14px;
364364
font-weight: 680;
365+
overflow: hidden;
366+
padding-right: 42px;
367+
text-overflow: ellipsis;
365368
transition: border-color 150ms ease, box-shadow 150ms ease;
366369
}
367370

@@ -551,6 +554,10 @@
551554
grid-template-columns: 1fr;
552555
gap: 3px;
553556
}
557+
558+
select {
559+
font-size: 13px;
560+
}
554561
}
555562

556563
@media (prefers-reduced-motion: no-preference) {
@@ -736,8 +743,8 @@ <h2 data-i18n="summary">切换摘要</h2>
736743
mode: "模式",
737744
live: "实盘",
738745
paper: "Dry run",
739-
summary: "切换摘要",
740-
copySummary: "复制摘要",
746+
summary: "当前配置状态",
747+
copySummary: "复制状态",
741748
loginToRun: "登录后切换",
742749
configureAccounts: "配置账号后切换",
743750
runSwitch: "一键切换",
@@ -758,14 +765,22 @@ <h2 data-i18n="summary">切换摘要</h2>
758765
action: "动作",
759766
actionValue: "切换并同步",
760767
confirm: "确认词",
761-
copied: "已复制摘要",
768+
copied: "已复制状态",
762769
dispatching: "正在触发 workflow...",
763770
dispatched: "已触发 workflow",
764771
dispatchFailed: "触发失败",
765772
targetMeta: "target {target} · service {service} · 市场 {domains}",
766773
strategyMeta: "该账号仅显示 {domains} 策略",
767774
usEquity: "美股",
768775
hkEquity: "港股",
776+
currentStrategy: "当前策略",
777+
currentMode: "当前模式",
778+
readSource: "读取来源",
779+
nextStrategy: "选择策略",
780+
nextMode: "选择模式",
781+
notRead: "未读取",
782+
publicPreview: "公开示例",
783+
accountConfigLoaded: "账号配置已加载",
769784
},
770785
en: {
771786
appTitle: "Strategy Switch",
@@ -779,8 +794,8 @@ <h2 data-i18n="summary">切换摘要</h2>
779794
mode: "Mode",
780795
live: "Live",
781796
paper: "Dry run",
782-
summary: "Switch Summary",
783-
copySummary: "Copy summary",
797+
summary: "Current Config",
798+
copySummary: "Copy state",
784799
loginToRun: "Sign in to switch",
785800
configureAccounts: "Configure accounts",
786801
runSwitch: "Switch now",
@@ -801,14 +816,22 @@ <h2 data-i18n="summary">切换摘要</h2>
801816
action: "Action",
802817
actionValue: "Switch and sync",
803818
confirm: "Confirm",
804-
copied: "Summary copied",
819+
copied: "State copied",
805820
dispatching: "Dispatching workflow...",
806821
dispatched: "Workflow dispatched",
807822
dispatchFailed: "Dispatch failed",
808823
targetMeta: "target {target} · service {service} · market {domains}",
809824
strategyMeta: "This account only shows {domains} strategies",
810825
usEquity: "US equity",
811826
hkEquity: "HK equity",
827+
currentStrategy: "Current strategy",
828+
currentMode: "Current mode",
829+
readSource: "Read source",
830+
nextStrategy: "Selected strategy",
831+
nextMode: "Selected mode",
832+
notRead: "Not read",
833+
publicPreview: "Public preview",
834+
accountConfigLoaded: "Account config loaded",
812835
},
813836
};
814837

@@ -1081,15 +1104,20 @@ <h2 data-i18n="summary">切换摘要</h2>
10811104

10821105
function summaryRows(inputs) {
10831106
const account = selectedAccount();
1107+
const currentEntry = currentEntryForAccount(state.selected, account);
1108+
const currentProfile = currentStrategyForAccount(state.selected, account);
1109+
const currentMode = normalizeExecutionMode(currentEntry?.execution_mode, currentEntry?.dry_run_only);
1110+
const source = currentEntry?.source
1111+
|| (state.configSource === "private" ? t("accountConfigLoaded") : t("publicPreview"));
10841112
return [
10851113
[t("repository"), repositories[state.selected]],
10861114
[t("selectedAccount"), account.label],
1087-
[t("selectedStrategy"), strategyLabel(inputs.strategy_profile)],
1088-
[t("selectedMode"), modeLabel(inputs.execution_mode)],
1115+
[t("currentStrategy"), currentProfile ? strategyLabel(currentProfile) : t("notRead")],
1116+
[t("currentMode"), currentMode ? modeLabel(currentMode) : t("notRead")],
1117+
[t("readSource"), source],
10891118
[t("selectedMarket"), supportedDomainLabel(state.selected, account)],
1090-
[t("target"), inputs.target_name],
1091-
[t("accountSelector"), inputs.account_selector || "auto"],
1092-
[t("service"), inputs.service_name || derivedService(state.selected, inputs.target_name)],
1119+
[t("nextStrategy"), strategyLabel(inputs.strategy_profile)],
1120+
[t("nextMode"), modeLabel(inputs.execution_mode)],
10931121
[t("action"), t("actionValue")],
10941122
[t("confirm"), inputs.confirm_apply],
10951123
];
@@ -1192,7 +1220,10 @@ <h2 data-i18n="summary">切换摘要</h2>
11921220
list.appendChild(row);
11931221
}
11941222

1195-
el("mode-pill").textContent = modeLabel(inputs.execution_mode);
1223+
const account = selectedAccount();
1224+
const currentEntry = currentEntryForAccount(state.selected, account);
1225+
const currentMode = normalizeExecutionMode(currentEntry?.execution_mode, currentEntry?.dry_run_only);
1226+
el("mode-pill").textContent = currentMode ? modeLabel(currentMode) : t("notRead");
11961227
}
11971228

11981229
function renderAuth() {

web/strategy-switch-console/page_asset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)