This commit is contained in:
@@ -119,15 +119,39 @@
|
||||
|
||||
function renderTable(files) {
|
||||
const tbody = document.getElementById('fileTableBody');
|
||||
|
||||
// tbody is cleared in loadFiles, so we just append.
|
||||
|
||||
// Add "Go Up" link if not at root
|
||||
if (currentPath && currentPath !== '/' && currentPath.length > 1) {
|
||||
let parentPath = currentPath.substring(0, currentPath.lastIndexOf('/'));
|
||||
if (parentPath === '') parentPath = '/';
|
||||
|
||||
const tr = document.createElement('tr');
|
||||
tr.className = 'file-row';
|
||||
tr.onclick = () => enterDir(parentPath);
|
||||
tr.innerHTML = `
|
||||
<td class="icon-col"><i class="fa-solid fa-arrow-turn-up text-secondary"></i></td>
|
||||
<td>..</td>
|
||||
<td></td>
|
||||
<td class="text-end"></td>
|
||||
`;
|
||||
tbody.appendChild(tr);
|
||||
}
|
||||
|
||||
if (files.length === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="4" class="text-center text-muted">No files found.</td></tr>';
|
||||
// If we haven't added the "up" directory, show no files.
|
||||
if (tbody.childElementCount === 0) {
|
||||
tbody.innerHTML = '<tr><td colspan="4" class="text-center text-muted">No files found.</td></tr>';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
files.forEach(file => {
|
||||
const tr = document.createElement('tr');
|
||||
tr.className = 'file-row';
|
||||
if (file.is_dir) {
|
||||
tr.onclick = () => enterDir(file.path);
|
||||
}
|
||||
|
||||
// Icon logic
|
||||
let icon = 'fa-file';
|
||||
@@ -141,9 +165,7 @@
|
||||
|
||||
tr.innerHTML = `
|
||||
<td class="icon-col"><i class="fa-solid ${icon} ${color}"></i></td>
|
||||
<td onclick="${file.is_dir ? `enterDir('${file.path.replace(/\\/g, '\\\\')}')` : ''}">
|
||||
${file.name}
|
||||
</td>
|
||||
<td>${file.name}</td>
|
||||
<td>${size}</td>
|
||||
<td class="text-end">
|
||||
${getActions(file)}
|
||||
|
||||
Reference in New Issue
Block a user