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