修复全仓复利开启时单笔预算仍显示:flex 覆盖了 hidden,改为强制隐藏。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vendored
+21
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user