Docker deployment improvements: fixed backup/restore, sticky headers, quality code display
This commit is contained in:
@@ -253,4 +253,55 @@ body.dark-mode .floating-back-btn {
|
||||
|
||||
body.dark-mode .floating-back-btn:hover {
|
||||
background: linear-gradient(135deg, #343a40, #212529);
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
STICKY TABLE HEADERS - Keep first row fixed when scrolling
|
||||
========================================================================== */
|
||||
|
||||
.report-table-container {
|
||||
max-height: 600px;
|
||||
overflow-y: auto;
|
||||
overflow-x: auto;
|
||||
position: relative;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.report-table-container table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.report-table-container thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background-color: #f8f9fa;
|
||||
z-index: 10;
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
padding: 12px 8px;
|
||||
font-weight: 600;
|
||||
text-align: left;
|
||||
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.report-table-container tbody td {
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid #dee2e6;
|
||||
}
|
||||
|
||||
/* Dark mode support for sticky headers */
|
||||
body.dark-mode .report-table-container {
|
||||
border-color: #495057;
|
||||
}
|
||||
|
||||
body.dark-mode .report-table-container thead th {
|
||||
background-color: #343a40;
|
||||
border-bottom-color: #495057;
|
||||
color: #f8f9fa;
|
||||
}
|
||||
|
||||
body.dark-mode .report-table-container tbody td {
|
||||
border-bottom-color: #495057;
|
||||
}
|
||||
@@ -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, '""') + '"';
|
||||
|
||||
@@ -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