fix[frontend]: Reset upload UI elements, don't expand tree view

- Make sure the upload progess bar and file choser are reset when
  loading the file browser screen.
- Don't expand the directories in the tree view by default.

Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
This commit is contained in:
2026-01-06 12:37:31 +01:00
parent 6d18437863
commit 763305c659

View File

@@ -796,6 +796,10 @@
async function onShow(intent) {
document.getElementById('playlist-filebrowser-addtrack').disabled = true;
if (intent !== 'refresh') {
document.getElementById('playlist-filebrowser-upload-progress').value = 0;
document.getElementById("playlist-filebrowser-upload-files").value = "";
}
tree = document.getElementById("playlist-filebrowser-tree");
tree.innerHTML = "Loading...";
fetch('/api/v1/audiofiles')
@@ -830,7 +834,6 @@
if (type === 'directory') {
const nested = document.createElement('ul');
node.appendChild(nested);
node.classList.add('expanded');
parent.appendChild(node);
return nested;
}
@@ -917,7 +920,7 @@
}
if (donecount + 1 === totalcount) {
// Reload file list from device
onShow();
onShow('refresh');
} else {
uploadFileHelper(totalcount, donecount + 1, destdir, files.slice(1));
}
@@ -944,7 +947,7 @@
const saveRes = await fetch(`/api/v1/audiofiles?type=directory&location=${location}`,
{method: 'POST'});
// Reload file list from device
onShow();
onShow('refresh');
}
async function deleteItems() {
@@ -965,7 +968,7 @@
}
}
// Reload file list from device
onShow();
onShow('refresh');
}
let tree = (() => {