Refine remote config and path browsing
This commit is contained in:
+30
-2
@@ -357,6 +357,18 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
gap: 8px;
|
||||
min-height: 220px;
|
||||
}
|
||||
.browser-roots {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.browser-roots .ghost.active {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-color: var(--line-strong);
|
||||
color: var(--text);
|
||||
}
|
||||
.browser-entry {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -724,7 +736,8 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
mode: "dir",
|
||||
path: "",
|
||||
parent_path: "",
|
||||
home_path: ""
|
||||
home_path: "",
|
||||
root_paths: []
|
||||
};
|
||||
pathBrowserOverlay.hidden = true;
|
||||
pathBrowserList.innerHTML = "";
|
||||
@@ -739,6 +752,20 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
pathBrowserCurrentPath.textContent = data.path || "";
|
||||
pathBrowserStatus.textContent = "";
|
||||
pathBrowserList.innerHTML = "";
|
||||
const roots = Array.isArray(data.root_paths) ? data.root_paths : [];
|
||||
if (roots.length > 1) {
|
||||
const rootGroup = document.createElement("div");
|
||||
rootGroup.className = "browser-roots";
|
||||
for (const rootPath of roots) {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = `ghost${rootPath === data.path ? " active" : ""}`;
|
||||
button.textContent = rootPath;
|
||||
button.addEventListener("click", () => loadPathBrowser(rootPath));
|
||||
rootGroup.appendChild(button);
|
||||
}
|
||||
pathBrowserList.appendChild(rootGroup);
|
||||
}
|
||||
if (!Array.isArray(data.entries) || !data.entries.length) {
|
||||
const empty = document.createElement("div");
|
||||
empty.className = "muted";
|
||||
@@ -784,7 +811,8 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
mode,
|
||||
path: $(targetId).value.trim() || "",
|
||||
parent_path: "",
|
||||
home_path: ""
|
||||
home_path: "",
|
||||
root_paths: []
|
||||
};
|
||||
pathBrowserOverlay.hidden = false;
|
||||
await loadPathBrowser(state.pathBrowser.path);
|
||||
|
||||
Reference in New Issue
Block a user