diff options
| author | chrislu <chris.lu@gmail.com> | 2025-07-02 22:06:06 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-07-02 22:06:06 -0700 |
| commit | 2268d2f55e46a0264fd9bf4fb6d449cc7fda53c3 (patch) | |
| tree | 7b6b9cd17b50c6b86b48eac6005fac87960687f0 /weed/admin/static/js/admin.js | |
| parent | 1cac3e73f98356d038a80b894943272cb1fec3af (diff) | |
| download | seaweedfs-2268d2f55e46a0264fd9bf4fb6d449cc7fda53c3.tar.xz seaweedfs-2268d2f55e46a0264fd9bf4fb6d449cc7fda53c3.zip | |
add back dynamic columns
Diffstat (limited to 'weed/admin/static/js/admin.js')
| -rw-r--r-- | weed/admin/static/js/admin.js | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/weed/admin/static/js/admin.js b/weed/admin/static/js/admin.js index 93ae40786..00faf4e37 100644 --- a/weed/admin/static/js/admin.js +++ b/weed/admin/static/js/admin.js @@ -320,6 +320,12 @@ function formatNumber(num) { return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } +// Helper function to format disk types for CSV export +function formatDiskTypes(diskTypesText) { + // Remove any HTML tags and clean up the text + return diskTypesText.replace(/<[^>]*>/g, '').replace(/\s+/g, ' ').trim(); +} + // Confirm action dialogs function confirmAction(message, callback) { if (confirm(message)) { @@ -666,25 +672,27 @@ function exportVolumes() { return; } - let csv = 'Volume ID,Server,Data Center,Rack,Collection,Size,File Count,Replication,Status\n'; + // Get headers from the table (dynamically handles conditional columns) + const headerCells = table.querySelectorAll('thead th'); + const headers = []; + headerCells.forEach((cell, index) => { + // Skip the Actions column (last column) + if (index < headerCells.length - 1) { + headers.push(cell.textContent.trim()); + } + }); + + let csv = headers.join(',') + '\n'; const rows = table.querySelectorAll('tbody tr'); rows.forEach(row => { const cells = row.querySelectorAll('td'); - if (cells.length >= 9) { - const rowData = [ - cells[0].textContent.trim(), - cells[1].textContent.trim(), - cells[2].textContent.trim(), - cells[3].textContent.trim(), - cells[4].textContent.trim(), - cells[5].textContent.trim(), - cells[6].textContent.trim(), - cells[7].textContent.trim(), - cells[8].textContent.trim() - ]; - csv += rowData.join(',') + '\n'; + const rowData = []; + // Export all cells except the Actions column (last column) + for (let i = 0; i < cells.length - 1; i++) { + rowData.push(`"${cells[i].textContent.trim().replace(/"/g, '""')}"`); } + csv += rowData.join(',') + '\n'; }); downloadCSV(csv, 'seaweedfs-volumes.csv'); |
