Docker deployment improvements: fixed backup/restore, sticky headers, quality code display
This commit is contained in:
@@ -42,13 +42,21 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Clear existing table content
|
||||
tableHead.innerHTML = '';
|
||||
tableBody.innerHTML = '';
|
||||
|
||||
// Find the index of the "Defect Code" column
|
||||
let defectCodeIndex = -1;
|
||||
|
||||
if (data.headers && data.rows && data.rows.length > 0) {
|
||||
// Populate table headers
|
||||
data.headers.forEach((header) => {
|
||||
data.headers.forEach((header, index) => {
|
||||
const th = document.createElement('th');
|
||||
th.textContent = header;
|
||||
tableHead.appendChild(th);
|
||||
|
||||
// Track the defect code column (quality_code)
|
||||
if (header === 'Defect Code' || header === 'Quality Code') {
|
||||
defectCodeIndex = index;
|
||||
}
|
||||
});
|
||||
|
||||
// Populate table rows
|
||||
@@ -57,8 +65,17 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
row.forEach((cell, index) => {
|
||||
const td = document.createElement('td');
|
||||
|
||||
// Use the cell data as-is since backend now handles formatting
|
||||
td.textContent = cell;
|
||||
// Special handling for defect code column
|
||||
if (index === defectCodeIndex && (cell === 0 || cell === '0' || cell === '' || cell === null)) {
|
||||
td.textContent = 'OK';
|
||||
td.style.color = '#28a745'; // Green color for OK
|
||||
td.style.fontWeight = '600';
|
||||
td.setAttribute('data-csv-value', '0'); // Store original value for CSV
|
||||
} else {
|
||||
// Use the cell data as-is since backend now handles formatting
|
||||
td.textContent = cell;
|
||||
td.setAttribute('data-csv-value', cell || ''); // Store original value
|
||||
}
|
||||
|
||||
tr.appendChild(td);
|
||||
});
|
||||
@@ -96,7 +113,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Loop through each row in the table
|
||||
rows.forEach((row) => {
|
||||
const cells = row.querySelectorAll('th, td');
|
||||
const rowData = Array.from(cells).map((cell) => `"${cell.textContent.trim()}"`);
|
||||
const rowData = Array.from(cells).map((cell) => {
|
||||
// Use data-csv-value attribute if available (for defect codes), otherwise use text content
|
||||
const value = cell.hasAttribute('data-csv-value') ? cell.getAttribute('data-csv-value') : cell.textContent.trim();
|
||||
return `"${value}"`;
|
||||
});
|
||||
csv.push(rowData.join(','));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user