Docker deployment improvements: fixed backup/restore, sticky headers, quality code display
This commit is contained in:
@@ -171,12 +171,20 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
thead.innerHTML = '';
|
||||
tbody.innerHTML = '';
|
||||
|
||||
// Find the index of the "Defect Code" column
|
||||
let defectCodeIndex = -1;
|
||||
|
||||
// Add headers
|
||||
if (data.headers && data.headers.length > 0) {
|
||||
data.headers.forEach(header => {
|
||||
data.headers.forEach((header, index) => {
|
||||
const th = document.createElement('th');
|
||||
th.textContent = header;
|
||||
thead.appendChild(th);
|
||||
|
||||
// Track the defect code column (quality_code)
|
||||
if (header === 'Defect Code' || header === 'Quality Code') {
|
||||
defectCodeIndex = index;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -184,9 +192,20 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
if (data.rows && data.rows.length > 0) {
|
||||
data.rows.forEach(row => {
|
||||
const tr = document.createElement('tr');
|
||||
row.forEach(cell => {
|
||||
row.forEach((cell, index) => {
|
||||
const td = document.createElement('td');
|
||||
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 {
|
||||
td.textContent = cell || '';
|
||||
td.setAttribute('data-csv-value', cell || ''); // Store original value
|
||||
}
|
||||
|
||||
tr.appendChild(td);
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
@@ -488,7 +507,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const csvContent = rows.map(row => {
|
||||
const cells = Array.from(row.querySelectorAll('th, td'));
|
||||
return cells.map(cell => {
|
||||
let text = cell.textContent.trim();
|
||||
// Use data-csv-value attribute if available (for defect codes), otherwise use text content
|
||||
let text = cell.hasAttribute('data-csv-value') ? cell.getAttribute('data-csv-value') : cell.textContent.trim();
|
||||
// Escape quotes and wrap in quotes if necessary
|
||||
if (text.includes(',') || text.includes('"') || text.includes('\n')) {
|
||||
text = '"' + text.replace(/"/g, '""') + '"';
|
||||
|
||||
Reference in New Issue
Block a user