feat (ui): Light/Dark Theme added Complete
This commit is contained in:
@@ -159,7 +159,19 @@ async function filesRefresh() {
|
||||
const treeEl = document.getElementById('filesTree');
|
||||
treeEl.textContent = 'Laden...';
|
||||
|
||||
const data = await api('/files/tree', 'GET');
|
||||
let data;
|
||||
try {
|
||||
data = await api('/files/tree', 'GET');
|
||||
} catch (e) {
|
||||
if (typeof window.updateNavCount === 'function') {
|
||||
window.updateNavCount('countNavFiles', 0);
|
||||
}
|
||||
treeEl.innerHTML = (typeof window.renderStateBox === 'function')
|
||||
? window.renderStateBox('error', 'Files laden mislukt', e.message || String(e))
|
||||
: 'Files laden mislukt.';
|
||||
filesUpdateEditorStatus();
|
||||
return;
|
||||
}
|
||||
|
||||
// Filter alleen systemd subtree
|
||||
const scoped = (data || []).filter(folder => {
|
||||
@@ -168,10 +180,24 @@ async function filesRefresh() {
|
||||
});
|
||||
|
||||
if (!scoped.length) {
|
||||
treeEl.textContent = 'Geen bestanden gevonden onder systemd.';
|
||||
if (typeof window.updateNavCount === 'function') {
|
||||
window.updateNavCount('countNavFiles', 0);
|
||||
}
|
||||
treeEl.innerHTML = (typeof window.renderStateBox === 'function')
|
||||
? window.renderStateBox('empty', 'Geen bestanden', 'Er zijn geen bestanden gevonden onder systemd.')
|
||||
: 'Geen bestanden gevonden onder systemd.';
|
||||
filesUpdateEditorStatus();
|
||||
return;
|
||||
}
|
||||
|
||||
let totalFiles = 0;
|
||||
for (const folder of scoped) {
|
||||
totalFiles += Array.isArray(folder?.files) ? folder.files.length : 0;
|
||||
}
|
||||
if (typeof window.updateNavCount === 'function') {
|
||||
window.updateNavCount('countNavFiles', totalFiles);
|
||||
}
|
||||
|
||||
// Bouw een geneste folder-tree uit de "platte" API response.
|
||||
const folderByPath = new Map();
|
||||
for (const f of scoped) {
|
||||
|
||||
Reference in New Issue
Block a user