diff --git a/lib/common/static/instance_settings_prefs.js b/lib/common/static/instance_settings_prefs.js index f1acfb7..7aabd12 100644 --- a/lib/common/static/instance_settings_prefs.js +++ b/lib/common/static/instance_settings_prefs.js @@ -295,6 +295,10 @@ input.dataset.envKey = field.key; input.className = "env-field-input"; row.appendChild(input); + if (field.hidden) { + row.hidden = true; + row.style.display = "none"; + } return row; } @@ -367,6 +371,7 @@ if (!budgetRow) return; const compoundOn = !compoundSel || String(compoundSel.value || "").toLowerCase() === "true"; budgetRow.hidden = compoundOn; + budgetRow.style.display = compoundOn ? "none" : ""; } function bindCompoundBudgetVisibility(body) { diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index d8554c5..49a1fc4 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -2494,6 +2494,11 @@ html[data-theme="light"] .journal-detail-img-thumb { min-width: 0; } +/* display:flex 会盖掉 UA [hidden];全仓复利开时隐藏单笔预算等依赖此规则 */ +.env-field-row[hidden] { + display: none !important; +} + .env-field-row--restart .env-field-label { color: #d4c4a0; } diff --git a/lib/env/env_ui_manifest.py b/lib/env/env_ui_manifest.py index 29c29b6..8418ff9 100644 --- a/lib/env/env_ui_manifest.py +++ b/lib/env/env_ui_manifest.py @@ -472,6 +472,7 @@ def build_env_ui_payload( _build_field(key, label, note, schema, values) for key, label, note in sec["fields"] ] + fields = _mark_compound_budget_hidden(fields) groups.append({ "title": sec["title"], "fields": fields, @@ -480,6 +481,26 @@ def build_env_ui_payload( return groups +def _mark_compound_budget_hidden(fields: list[dict[str, Any]]) -> list[dict[str, Any]]: + """全仓复利开启时标记单笔预算为 hidden(供 SSR/前端隐藏;切换开关仍可再显示).""" + compound_on = True + for f in fields: + if f.get("key") == "OKX_OPTIONS_COMPOUND_FULL_ENABLED": + compound_on = _env_truthy(str(f.get("current") or f.get("default") or "true")) + break + if not compound_on: + return fields + out: list[dict[str, Any]] = [] + for f in fields: + if f.get("key") == "OKX_OPTIONS_TRADE_BUDGET_USDC": + item = dict(f) + item["hidden"] = True + out.append(item) + else: + out.append(f) + return out + + def filter_updates_for_ui(exchange_key: str, updates: dict[str, str]) -> dict[str, str]: allowed = ui_allowed_keys(exchange_key) return {k: v for k, v in (updates or {}).items() if k in allowed} diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index 7bd884b..21724db 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -8,7 +8,7 @@ - + @@ -170,7 +170,7 @@ const ORDER_ENTRY_MODEL_CODE_TO_CATEGORY = {{ entry_model_code_to_category | toj - + diff --git a/lib/instance/templates/env_config_panel.html b/lib/instance/templates/env_config_panel.html index 1df3d1e..6568d47 100644 --- a/lib/instance/templates/env_config_panel.html +++ b/lib/instance/templates/env_config_panel.html @@ -37,7 +37,7 @@ {% endif %}