From ab9d47aac9ac6c11722a034a2d88c47d0bca5172 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Mon, 20 Apr 2026 10:12:20 +0200 Subject: [PATCH] Review comments --- src/network/CrossPointWebServer.cpp | 8 +++--- src/network/html/FilesPage.html | 40 +++++++++++++++++++---------- src/network/html/SettingsPage.html | 2 +- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/src/network/CrossPointWebServer.cpp b/src/network/CrossPointWebServer.cpp index 0fb9efb7..1d922ce8 100644 --- a/src/network/CrossPointWebServer.cpp +++ b/src/network/CrossPointWebServer.cpp @@ -1267,9 +1267,11 @@ void CrossPointWebServer::handleGetSettings() const { } const size_t written = serializeJson(doc, output, outputSize); + const char* jsonEntry = output; + String dynBuffer; if (written >= outputSize) { - LOG_DBG("WEB", "Skipping oversized setting JSON for: %s", s.key); - continue; + serializeJson(doc, dynBuffer); + jsonEntry = dynBuffer.c_str(); } if (seenFirst) { @@ -1277,7 +1279,7 @@ void CrossPointWebServer::handleGetSettings() const { } else { seenFirst = true; } - result += output; + result += jsonEntry; } result += "]"; diff --git a/src/network/html/FilesPage.html b/src/network/html/FilesPage.html index 4b800d2a..256a86d0 100644 --- a/src/network/html/FilesPage.html +++ b/src/network/html/FilesPage.html @@ -2155,8 +2155,9 @@ document.body.appendChild(notification); } - // Cancel any in-flight hide timer so a new message is not prematurely dismissed + // Cancel any in-flight hide/removal timers so a new message is not prematurely dismissed clearTimeout(notification._hideTimeout); + clearTimeout(notification._removeTimeout); // Set styles based on type const styles = { @@ -2176,7 +2177,7 @@ notification._hideTimeout = setTimeout(() => { notification.style.opacity = '0'; notification.style.transform = 'translateX(100%)'; - setTimeout(() => { + notification._removeTimeout = setTimeout(() => { if (notification.parentNode) { notification.parentNode.removeChild(notification); } @@ -2334,9 +2335,9 @@ fileTableContent += 'Folder'; fileTableContent += '-'; fileTableContent += `
`; - fileTableContent += ``; - fileTableContent += ``; - fileTableContent += ``; + fileTableContent += ``; + fileTableContent += ``; + fileTableContent += ``; fileTableContent += `
`; fileTableContent += ''; } else { @@ -2353,9 +2354,9 @@ fileTableContent += `${file.name.includes('.') ? file.name.split('.').pop().toUpperCase() : '-'}`; fileTableContent += `${formatFileSize(file.size)}`; fileTableContent += `
`; - fileTableContent += ``; - fileTableContent += ``; - fileTableContent += ``; + fileTableContent += ``; + fileTableContent += ``; + fileTableContent += ``; fileTableContent += `
`; fileTableContent += ''; } @@ -2366,6 +2367,17 @@ document.getElementById('file-table').addEventListener('change', function(e) { if (e.target.classList.contains('select-item')) updateToolbarState(); }); + document.getElementById('file-table').addEventListener('click', function(e) { + const btn = e.target.closest('button[data-action]'); + if (!btn) return; + const name = btn.dataset.name; + const path = btn.dataset.path; + const isFolder = btn.dataset.isFolder === 'true'; + const action = btn.dataset.action; + if (action === 'move') openMoveModalForItem(name, path, isFolder); + else if (action === 'rename') openRenameModal(name, path, isFolder); + else if (action === 'delete') openDeleteModal(name, path, isFolder); + }); updateToolbarState(); } @@ -5736,7 +5748,7 @@ function openMoveModal(items) { const label = items.length === 1 - ? '📄 ' + items[0].name + ? (items[0].isFolder ? '📁' : '📄') + ' ' + items[0].name : `📄 ${items.length} files`; document.getElementById('moveItemName').textContent = label; document.getElementById('moveItemPath').value = JSON.stringify(items.map(it => it.path)); @@ -5751,8 +5763,7 @@ } function openMoveModalForItem(name, path, isFolder) { - const icon = isFolder ? '📁' : '📄'; - openMoveModal([{ name: icon + ' ' + name, path: path, isFolder: !!isFolder }]); + openMoveModal([{ name: name, path: path, isFolder: !!isFolder }]); } function closeMoveModal() { @@ -5770,10 +5781,11 @@ closeMoveModal(); let hasErrors = false; + let successfulMoves = 0; function moveNext(index) { if (index >= paths.length) { - if (!hasErrors) window.location.reload(); + if (successfulMoves > 0) window.location.reload(); return; } const formData = new FormData(); @@ -5783,7 +5795,9 @@ const xhr = new XMLHttpRequest(); xhr.open('POST', '/move', true); xhr.onload = function() { - if (xhr.status !== 200) { + if (xhr.status === 200) { + successfulMoves++; + } else { hasErrors = true; showNotification('Failed to move ' + paths[index] + ': ' + xhr.responseText, 'error'); } diff --git a/src/network/html/SettingsPage.html b/src/network/html/SettingsPage.html index cfc47d41..ccf67861 100644 --- a/src/network/html/SettingsPage.html +++ b/src/network/html/SettingsPage.html @@ -85,7 +85,7 @@ border-bottom: 1px solid var(--accent-color); margin-bottom: 4px; } - .section-header:first-child { + .section .section-header:first-of-type { padding-top: 0; } .setting-row {