Review comments
This commit is contained in:
@@ -1267,9 +1267,11 @@ void CrossPointWebServer::handleGetSettings() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const size_t written = serializeJson(doc, output, outputSize);
|
const size_t written = serializeJson(doc, output, outputSize);
|
||||||
|
const char* jsonEntry = output;
|
||||||
|
String dynBuffer;
|
||||||
if (written >= outputSize) {
|
if (written >= outputSize) {
|
||||||
LOG_DBG("WEB", "Skipping oversized setting JSON for: %s", s.key);
|
serializeJson(doc, dynBuffer);
|
||||||
continue;
|
jsonEntry = dynBuffer.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seenFirst) {
|
if (seenFirst) {
|
||||||
@@ -1277,7 +1279,7 @@ void CrossPointWebServer::handleGetSettings() const {
|
|||||||
} else {
|
} else {
|
||||||
seenFirst = true;
|
seenFirst = true;
|
||||||
}
|
}
|
||||||
result += output;
|
result += jsonEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
result += "]";
|
result += "]";
|
||||||
|
|||||||
@@ -2155,8 +2155,9 @@
|
|||||||
document.body.appendChild(notification);
|
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._hideTimeout);
|
||||||
|
clearTimeout(notification._removeTimeout);
|
||||||
|
|
||||||
// Set styles based on type
|
// Set styles based on type
|
||||||
const styles = {
|
const styles = {
|
||||||
@@ -2176,7 +2177,7 @@
|
|||||||
notification._hideTimeout = setTimeout(() => {
|
notification._hideTimeout = setTimeout(() => {
|
||||||
notification.style.opacity = '0';
|
notification.style.opacity = '0';
|
||||||
notification.style.transform = 'translateX(100%)';
|
notification.style.transform = 'translateX(100%)';
|
||||||
setTimeout(() => {
|
notification._removeTimeout = setTimeout(() => {
|
||||||
if (notification.parentNode) {
|
if (notification.parentNode) {
|
||||||
notification.parentNode.removeChild(notification);
|
notification.parentNode.removeChild(notification);
|
||||||
}
|
}
|
||||||
@@ -2334,9 +2335,9 @@
|
|||||||
fileTableContent += '<td>Folder</td>';
|
fileTableContent += '<td>Folder</td>';
|
||||||
fileTableContent += '<td>-</td>';
|
fileTableContent += '<td>-</td>';
|
||||||
fileTableContent += `<td class="actions-col"><div class="action-icon-group">`;
|
fileTableContent += `<td class="actions-col"><div class="action-icon-group">`;
|
||||||
fileTableContent += `<button class="move-btn" onclick="openMoveModalForItem('${file.name.replaceAll("'", "\\'")}', '${folderPath.replaceAll("'", "\\'")}', true)" title="Move folder">📂</button>`;
|
fileTableContent += `<button class="move-btn" data-action="move" data-name="${escapeHtml(file.name)}" data-path="${escapeHtml(folderPath)}" data-is-folder="true" title="Move folder">📂</button>`;
|
||||||
fileTableContent += `<button class="rename-btn" onclick="openRenameModal('${file.name.replaceAll("'", "\\'")}', '${folderPath.replaceAll("'", "\\'")}', true)" title="Rename folder">✏️</button>`;
|
fileTableContent += `<button class="rename-btn" data-action="rename" data-name="${escapeHtml(file.name)}" data-path="${escapeHtml(folderPath)}" data-is-folder="true" title="Rename folder">✏️</button>`;
|
||||||
fileTableContent += `<button class="delete-btn" onclick="openDeleteModal('${file.name.replaceAll("'", "\\'")}', '${folderPath.replaceAll("'", "\\'")}', true)" title="Delete folder">🗑️</button>`;
|
fileTableContent += `<button class="delete-btn" data-action="delete" data-name="${escapeHtml(file.name)}" data-path="${escapeHtml(folderPath)}" data-is-folder="true" title="Delete folder">🗑️</button>`;
|
||||||
fileTableContent += `</div></td>`;
|
fileTableContent += `</div></td>`;
|
||||||
fileTableContent += '</tr>';
|
fileTableContent += '</tr>';
|
||||||
} else {
|
} else {
|
||||||
@@ -2353,9 +2354,9 @@
|
|||||||
fileTableContent += `<td>${file.name.includes('.') ? file.name.split('.').pop().toUpperCase() : '-'}</td>`;
|
fileTableContent += `<td>${file.name.includes('.') ? file.name.split('.').pop().toUpperCase() : '-'}</td>`;
|
||||||
fileTableContent += `<td>${formatFileSize(file.size)}</td>`;
|
fileTableContent += `<td>${formatFileSize(file.size)}</td>`;
|
||||||
fileTableContent += `<td class="actions-col"><div class="action-icon-group">`;
|
fileTableContent += `<td class="actions-col"><div class="action-icon-group">`;
|
||||||
fileTableContent += `<button class="move-btn" onclick="openMoveModalForItem('${file.name.replaceAll("'", "\\'")}', '${filePath.replaceAll("'", "\\'")}', false)" title="Move file">📂</button>`;
|
fileTableContent += `<button class="move-btn" data-action="move" data-name="${escapeHtml(file.name)}" data-path="${escapeHtml(filePath)}" data-is-folder="false" title="Move file">📂</button>`;
|
||||||
fileTableContent += `<button class="rename-btn" onclick="openRenameModal('${file.name.replaceAll("'", "\\'")}', '${filePath.replaceAll("'", "\\'")}' )" title="Rename file">✏️</button>`;
|
fileTableContent += `<button class="rename-btn" data-action="rename" data-name="${escapeHtml(file.name)}" data-path="${escapeHtml(filePath)}" data-is-folder="false" title="Rename file">✏️</button>`;
|
||||||
fileTableContent += `<button class="delete-btn" onclick="openDeleteModal('${file.name.replaceAll("'", "\\'")}', '${filePath.replaceAll("'", "\\'")}', false)" title="Delete file">🗑️</button>`;
|
fileTableContent += `<button class="delete-btn" data-action="delete" data-name="${escapeHtml(file.name)}" data-path="${escapeHtml(filePath)}" data-is-folder="false" title="Delete file">🗑️</button>`;
|
||||||
fileTableContent += `</div></td>`;
|
fileTableContent += `</div></td>`;
|
||||||
fileTableContent += '</tr>';
|
fileTableContent += '</tr>';
|
||||||
}
|
}
|
||||||
@@ -2366,6 +2367,17 @@
|
|||||||
document.getElementById('file-table').addEventListener('change', function(e) {
|
document.getElementById('file-table').addEventListener('change', function(e) {
|
||||||
if (e.target.classList.contains('select-item')) updateToolbarState();
|
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();
|
updateToolbarState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5736,7 +5748,7 @@
|
|||||||
|
|
||||||
function openMoveModal(items) {
|
function openMoveModal(items) {
|
||||||
const label = items.length === 1
|
const label = items.length === 1
|
||||||
? '📄 ' + items[0].name
|
? (items[0].isFolder ? '📁' : '📄') + ' ' + items[0].name
|
||||||
: `📄 ${items.length} files`;
|
: `📄 ${items.length} files`;
|
||||||
document.getElementById('moveItemName').textContent = label;
|
document.getElementById('moveItemName').textContent = label;
|
||||||
document.getElementById('moveItemPath').value = JSON.stringify(items.map(it => it.path));
|
document.getElementById('moveItemPath').value = JSON.stringify(items.map(it => it.path));
|
||||||
@@ -5751,8 +5763,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openMoveModalForItem(name, path, isFolder) {
|
function openMoveModalForItem(name, path, isFolder) {
|
||||||
const icon = isFolder ? '📁' : '📄';
|
openMoveModal([{ name: name, path: path, isFolder: !!isFolder }]);
|
||||||
openMoveModal([{ name: icon + ' ' + name, path: path, isFolder: !!isFolder }]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeMoveModal() {
|
function closeMoveModal() {
|
||||||
@@ -5770,10 +5781,11 @@
|
|||||||
|
|
||||||
closeMoveModal();
|
closeMoveModal();
|
||||||
let hasErrors = false;
|
let hasErrors = false;
|
||||||
|
let successfulMoves = 0;
|
||||||
|
|
||||||
function moveNext(index) {
|
function moveNext(index) {
|
||||||
if (index >= paths.length) {
|
if (index >= paths.length) {
|
||||||
if (!hasErrors) window.location.reload();
|
if (successfulMoves > 0) window.location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
@@ -5783,7 +5795,9 @@
|
|||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', '/move', true);
|
xhr.open('POST', '/move', true);
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (xhr.status !== 200) {
|
if (xhr.status === 200) {
|
||||||
|
successfulMoves++;
|
||||||
|
} else {
|
||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
showNotification('Failed to move ' + paths[index] + ': ' + xhr.responseText, 'error');
|
showNotification('Failed to move ' + paths[index] + ': ' + xhr.responseText, 'error');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
border-bottom: 1px solid var(--accent-color);
|
border-bottom: 1px solid var(--accent-color);
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
.section-header:first-child {
|
.section .section-header:first-of-type {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
.setting-row {
|
.setting-row {
|
||||||
|
|||||||
Reference in New Issue
Block a user