Fix settings loading and use 2-column card layout.
Merge Flask GET/POST routes, refresh prefs on tab revisit after preload, and reorganize system settings into separate cards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,8 +57,17 @@
|
||||
}
|
||||
|
||||
async function loadDisplayPrefsForm() {
|
||||
const root = document.getElementById("display-prefs-form");
|
||||
if (!root) return;
|
||||
const pane = document.querySelector('.embed-tab-pane.is-active-pane') || document;
|
||||
const root = pane.querySelector ? pane.querySelector("#display-prefs-form") : document.getElementById("display-prefs-form");
|
||||
if (!root) {
|
||||
const fallback = document.getElementById("display-prefs-form");
|
||||
if (!fallback) return;
|
||||
return loadDisplayPrefsFormIn(fallback);
|
||||
}
|
||||
return loadDisplayPrefsFormIn(root);
|
||||
}
|
||||
|
||||
async function loadDisplayPrefsFormIn(root) {
|
||||
try {
|
||||
const data = await fetchJson("/api/settings/display");
|
||||
const display = data.display || {};
|
||||
@@ -157,8 +166,14 @@
|
||||
}
|
||||
|
||||
async function loadEnvConfig() {
|
||||
const grid = document.getElementById("env-config-grid");
|
||||
if (!grid) return;
|
||||
const pane = document.querySelector('.embed-tab-pane.is-active-pane') || document;
|
||||
const grid = pane.querySelector ? pane.querySelector("#env-config-grid") : document.getElementById("env-config-grid");
|
||||
const target = grid || document.getElementById("env-config-grid");
|
||||
if (!target) return;
|
||||
return loadEnvConfigIn(target);
|
||||
}
|
||||
|
||||
async function loadEnvConfigIn(grid) {
|
||||
grid.innerHTML = '<div class="env-config-loading muted">加载配置中…</div>';
|
||||
try {
|
||||
const data = await fetchJson("/api/settings/env");
|
||||
|
||||
Reference in New Issue
Block a user