feat (ui): breadcrumbs werken nu

This commit is contained in:
kodi
2026-03-11 09:53:36 +01:00
parent ce420cbb0e
commit a2de6b6d70
3 changed files with 13 additions and 2 deletions
@@ -30,6 +30,8 @@ class UiSmokeGoldenTest(unittest.TestCase):
self.assertIn('id="footer-bar"', body) self.assertIn('id="footer-bar"', body)
self.assertIn('id="left-pane"', body) self.assertIn('id="left-pane"', body)
self.assertIn('id="right-pane"', body) self.assertIn('id="right-pane"', body)
self.assertIn('id="left-breadcrumbs"', body)
self.assertIn('id="right-breadcrumbs"', body)
self.assertNotIn('id="bookmarks-panel"', body) self.assertNotIn('id="bookmarks-panel"', body)
self.assertNotIn('id="tasks-panel"', body) self.assertNotIn('id="tasks-panel"', body)
+11 -2
View File
@@ -130,16 +130,19 @@ function renderBreadcrumbs(pane, path) {
let aggregate = ""; let aggregate = "";
for (let i = 0; i < parts.length; i += 1) { for (let i = 0; i < parts.length; i += 1) {
aggregate = i === 0 ? parts[i] : `${aggregate}/${parts[i]}`; aggregate = i === 0 ? parts[i] : `${aggregate}/${parts[i]}`;
const crumbPath = aggregate;
const crumb = createButton(parts[i], () => { const crumb = createButton(parts[i], () => {
setActivePane(pane); setActivePane(pane);
navigateTo(pane, aggregate); console.debug("[breadcrumbs] click", { pane, crumbPath });
navigateTo(pane, crumbPath);
}); });
crumb.type = "button"; crumb.type = "button";
crumb.onclick = (ev) => { crumb.onclick = (ev) => {
ev.preventDefault(); ev.preventDefault();
ev.stopPropagation(); ev.stopPropagation();
setActivePane(pane); setActivePane(pane);
navigateTo(pane, aggregate); console.debug("[breadcrumbs] click", { pane, crumbPath });
navigateTo(pane, crumbPath);
}; };
nav.append(crumb); nav.append(crumb);
if (i < parts.length - 1) { if (i < parts.length - 1) {
@@ -236,6 +239,11 @@ async function loadBrowsePane(pane) {
path: model.currentPath, path: model.currentPath,
show_hidden: String(model.showHidden), 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()}`); const data = await apiRequest("GET", `/api/browse?${query.toString()}`);
model.currentPath = data.path; model.currentPath = data.path;
document.getElementById(`${pane}-current-path`).textContent = data.path; document.getElementById(`${pane}-current-path`).textContent = data.path;
@@ -291,6 +299,7 @@ async function loadBrowsePane(pane) {
} }
function navigateTo(pane, path) { function navigateTo(pane, path) {
console.debug("[navigate] pane-path", { pane, path });
paneState(pane).currentPath = path; paneState(pane).currentPath = path;
setSelectedItem(pane, null); setSelectedItem(pane, null);
loadBrowsePane(pane); loadBrowsePane(pane);