feat (ui): breadcrumbs werken nu
This commit is contained in:
+11
-2
@@ -130,16 +130,19 @@ function renderBreadcrumbs(pane, path) {
|
||||
let aggregate = "";
|
||||
for (let i = 0; i < parts.length; i += 1) {
|
||||
aggregate = i === 0 ? parts[i] : `${aggregate}/${parts[i]}`;
|
||||
const crumbPath = aggregate;
|
||||
const crumb = createButton(parts[i], () => {
|
||||
setActivePane(pane);
|
||||
navigateTo(pane, aggregate);
|
||||
console.debug("[breadcrumbs] click", { pane, crumbPath });
|
||||
navigateTo(pane, crumbPath);
|
||||
});
|
||||
crumb.type = "button";
|
||||
crumb.onclick = (ev) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
setActivePane(pane);
|
||||
navigateTo(pane, aggregate);
|
||||
console.debug("[breadcrumbs] click", { pane, crumbPath });
|
||||
navigateTo(pane, crumbPath);
|
||||
};
|
||||
nav.append(crumb);
|
||||
if (i < parts.length - 1) {
|
||||
@@ -236,6 +239,11 @@ async function loadBrowsePane(pane) {
|
||||
path: model.currentPath,
|
||||
show_hidden: String(model.showHidden),
|
||||
});
|
||||
console.debug("[browse] request", {
|
||||
pane,
|
||||
path: model.currentPath,
|
||||
show_hidden: model.showHidden,
|
||||
});
|
||||
const data = await apiRequest("GET", `/api/browse?${query.toString()}`);
|
||||
model.currentPath = data.path;
|
||||
document.getElementById(`${pane}-current-path`).textContent = data.path;
|
||||
@@ -291,6 +299,7 @@ async function loadBrowsePane(pane) {
|
||||
}
|
||||
|
||||
function navigateTo(pane, path) {
|
||||
console.debug("[navigate] pane-path", { pane, path });
|
||||
paneState(pane).currentPath = path;
|
||||
setSelectedItem(pane, null);
|
||||
loadBrowsePane(pane);
|
||||
|
||||
Reference in New Issue
Block a user