Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/strategy_switch_worker_validation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ assert.equal(indexHtml.includes(".innerHTML"), false);
assert.ok(indexHtml.includes('<body class="app-loading">'));
assert.ok(indexHtml.includes('id="boot-screen"'));
assert.ok(indexHtml.includes('id="app-shell"'));
assert.ok(indexHtml.includes('publicSummary: "公开预览"'));
assert.match(indexHtml, /body\.app-loading \.shell\s*\{\s*display: none;/);

const headers = __test.responseHeaders({ "Content-Type": "text/html; charset=utf-8" });
Expand Down
15 changes: 9 additions & 6 deletions web/strategy-switch-console/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ <h2 data-i18n="summary">切换摘要</h2>
live: "实盘",
paper: "Dry run",
summary: "当前配置状态",
publicSummary: "公开预览",
copySummary: "复制状态",
loginToRun: "登录后切换",
loadingConfig: "读取配置中",
Expand Down Expand Up @@ -894,6 +895,7 @@ <h2 data-i18n="summary">切换摘要</h2>
live: "Live",
paper: "Dry run",
summary: "Current Config",
publicSummary: "Public Preview",
copySummary: "Copy state",
loginToRun: "Sign in to switch",
loadingConfig: "Loading config",
Expand Down Expand Up @@ -1197,13 +1199,16 @@ <h2 data-i18n="summary">切换摘要</h2>
function summaryRows(inputs) {
const account = selectedAccount();
const currentProfile = currentStrategyForAccount(state.selected, account);
return [
const rows = [
[t("repository"), repositories[state.selected]],
[t("selectedAccount"), account.label],
[t("currentStrategy"), currentProfile ? strategyLabel(currentProfile) : t("notRead")],
[t("selectedMarket"), supportedDomainLabel(state.selected, account)],
[t("nextStrategy"), strategyLabel(inputs.strategy_profile)],
];
if (state.auth.allowed) {
rows.splice(2, 0, [t("currentStrategy"), currentProfile ? strategyLabel(currentProfile) : t("notRead")]);
}
return rows;
}

function applyLanguage() {
Expand Down Expand Up @@ -1292,6 +1297,7 @@ <h2 data-i18n="summary">切换摘要</h2>
const inputs = buildInputs();
const list = el("summary-list");
list.replaceChildren();
document.querySelector(".summary-head h2").textContent = state.auth.allowed ? t("summary") : t("publicSummary");
for (const [label, value] of summaryRows(inputs)) {
const row = document.createElement("div");
row.className = "summary-row";
Expand All @@ -1303,10 +1309,7 @@ <h2 data-i18n="summary">切换摘要</h2>
list.appendChild(row);
}

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");
el("mode-pill").textContent = modeLabel(inputs.execution_mode);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the current mode in the signed-in summary

When a signed-in user changes the mode selector before dispatching, this now renders the pill from buildInputs() (the pending selection) while the panel title remains Current Config and the rows still include the current strategy. For an account whose stored mode is paper, clicking Live immediately makes the current-config pill say Live even though /api/config still reports paper, so the UI misstates the active mode until the workflow actually completes.

Useful? React with 👍 / 👎.

}

function renderAuth() {
Expand Down
2 changes: 1 addition & 1 deletion web/strategy-switch-console/page_asset.js

Large diffs are not rendered by default.