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
5 changes: 4 additions & 1 deletion tests/strategy_switch_worker_validation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ 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.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" });
Expand Down
24 changes: 16 additions & 8 deletions web/strategy-switch-console/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@
align-items: stretch;
}

.switch-surface.summary-hidden {
grid-template-columns: minmax(0, 1fr);
}

.switch-panel,
.summary-panel {
min-width: 0;
Expand Down Expand Up @@ -845,7 +849,6 @@ <h2 data-i18n="summary">切换摘要</h2>
live: "实盘",
paper: "Dry run",
summary: "当前配置状态",
publicSummary: "公开预览",
copySummary: "复制状态",
loginToRun: "登录后切换",
loadingConfig: "读取配置中",
Expand All @@ -872,8 +875,6 @@ <h2 data-i18n="summary">切换摘要</h2>
currentStrategy: "当前策略",
nextStrategy: "选择策略",
notRead: "未读取",
publicPreview: "公开示例",
accountConfigLoaded: "账号配置已加载",
},
en: {
appTitle: "Strategy Switch",
Expand All @@ -895,7 +896,6 @@ <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 All @@ -922,8 +922,6 @@ <h2 data-i18n="summary">切换摘要</h2>
currentStrategy: "Current strategy",
nextStrategy: "Selected strategy",
notRead: "Not read",
publicPreview: "Public preview",
accountConfigLoaded: "Account config loaded",
},
};

Expand Down Expand Up @@ -1294,10 +1292,17 @@ <h2 data-i18n="summary">切换摘要</h2>
}

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";
Expand All @@ -1309,7 +1314,10 @@ <h2 data-i18n="summary">切换摘要</h2>
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() {
Expand Down
2 changes: 1 addition & 1 deletion web/strategy-switch-console/page_asset.js

Large diffs are not rendered by default.