372 lines
20 KiB
HTML
372 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>QC Dashboard - Job {{ job_number }}</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
|
<!-- MSAL Browser Library -->
|
|
<script src="https://alcdn.msauth.net/browser/2.35.0/js/msal-browser.min.js"
|
|
crossorigin="anonymous"></script>
|
|
<style>
|
|
.status-badge { font-size: 0.85rem; padding: 0.4em 0.7em; }
|
|
.check-card { margin-bottom: 0.75rem; border-left: 4px solid #dee2e6; }
|
|
.check-card.status-error { border-left-color: #dc3545; }
|
|
.check-card.status-passed { border-left-color: #198754; }
|
|
.check-card.status-warning { border-left-color: #ffc107; }
|
|
.summary-card { border-radius: 8px; }
|
|
.summary-stat { font-size: 2rem; font-weight: bold; }
|
|
.file-accordion .accordion-button:not(.collapsed) { background-color: #f8f9fa; }
|
|
.iframe-container { border: 1px solid #dee2e6; border-radius: 4px; overflow: hidden; }
|
|
.iframe-container iframe { width: 100%; min-height: 600px; border: none; }
|
|
.filter-btn.active { background-color: #0d6efd; color: white; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-dark bg-dark">
|
|
<div class="container-fluid">
|
|
<a href="/" class="navbar-brand">
|
|
<i class="bi bi-arrow-left me-2"></i>QC Report Dashboard
|
|
</a>
|
|
<div class="d-flex align-items-center">
|
|
<span class="navbar-text me-3">
|
|
Job: <strong>{{ job_number }}</strong>
|
|
</span>
|
|
<div id="userInfo" class="d-flex align-items-center" style="display: none !important;">
|
|
<span id="userName" class="text-white me-3"></span>
|
|
<button id="logoutBtn" class="btn btn-sm btn-outline-light">Logout</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container-fluid py-4">
|
|
{% if error %}
|
|
<div class="alert alert-danger" role="alert">
|
|
<i class="bi bi-exclamation-triangle"></i> {{ error }}
|
|
</div>
|
|
<a href="/" class="btn btn-primary">Back to Search</a>
|
|
{% else %}
|
|
|
|
<!-- Summary Section -->
|
|
<div class="row mb-4">
|
|
<div class="col-12">
|
|
<div class="card summary-card shadow-sm">
|
|
<div class="card-body">
|
|
<h3 class="card-title mb-4">
|
|
<i class="bi bi-clipboard-data"></i> Job Summary: {{ job_number }}
|
|
</h3>
|
|
<div class="row text-center">
|
|
<div class="col-md-2">
|
|
<div class="mb-2">
|
|
<span class="summary-stat text-primary">{{ aggregated.total_files }}</span>
|
|
</div>
|
|
<div class="text-muted">Files Checked</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="mb-2">
|
|
<span class="summary-stat text-secondary">{{ aggregated.total_checks }}</span>
|
|
</div>
|
|
<div class="text-muted">Total Checks</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="mb-2">
|
|
<span class="summary-stat text-success">{{ aggregated.summary.passed }}</span>
|
|
</div>
|
|
<div class="text-muted">Passed</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="mb-2">
|
|
<span class="summary-stat text-danger">{{ aggregated.summary.error }}</span>
|
|
</div>
|
|
<div class="text-muted">Errors</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="mb-2">
|
|
<span class="summary-stat text-warning">{{ aggregated.summary.warning }}</span>
|
|
</div>
|
|
<div class="text-muted">Warnings</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="mb-2">
|
|
<span class="summary-stat text-secondary">{{ aggregated.summary.skipped }}</span>
|
|
</div>
|
|
<div class="text-muted">Skipped</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if aggregated.files_with_errors %}
|
|
<div class="mt-4">
|
|
<h5 class="text-danger">
|
|
<i class="bi bi-exclamation-circle"></i> Files with Errors ({{ aggregated.files_with_errors|length }})
|
|
</h5>
|
|
<ul class="list-group">
|
|
{% for file in aggregated.files_with_errors %}
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
<div class="flex-grow-1">
|
|
{{ file.filename }}
|
|
<a href="#" class="ms-2 text-primary" onclick="scrollToReport('{{ file.filename }}'); return false;" title="View error details">
|
|
<i class="bi bi-box-arrow-down-right"></i> View Details
|
|
</a>
|
|
</div>
|
|
<span class="badge bg-danger rounded-pill">{{ file.error_count }} error(s)</span>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Export Buttons -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<a href="/export/html/{{ job_number }}" class="btn btn-success me-2" download>
|
|
<i class="bi bi-file-earmark-code"></i> Export Combined Report as HTML
|
|
</a>
|
|
{% if aggregated.files_with_errors %}
|
|
<a href="/export/html/{{ job_number }}/errors" class="btn btn-danger" download>
|
|
<i class="bi bi-exclamation-triangle"></i> Export Error Reports Only
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- View Toggle Tabs -->
|
|
<ul class="nav nav-tabs mb-3" id="viewTabs" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link active" id="parsed-tab" data-bs-toggle="tab" data-bs-target="#parsed-view" type="button" role="tab">
|
|
<i class="bi bi-list-check"></i> Parsed Data View
|
|
</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="embedded-tab" data-bs-toggle="tab" data-bs-target="#embedded-view" type="button" role="tab">
|
|
<i class="bi bi-file-earmark-text"></i> Embedded Reports
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
|
|
<!-- Tab Content -->
|
|
<div class="tab-content" id="viewTabContent">
|
|
|
|
<!-- Parsed Data View -->
|
|
<div class="tab-pane fade show active" id="parsed-view" role="tabpanel">
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<div class="btn-group" role="group">
|
|
<button type="button" class="btn btn-outline-secondary filter-btn active" data-filter="all">
|
|
All
|
|
</button>
|
|
<button type="button" class="btn btn-outline-danger filter-btn" data-filter="error">
|
|
Errors Only
|
|
</button>
|
|
<button type="button" class="btn btn-outline-success filter-btn" data-filter="passed">
|
|
Passed Only
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="accordion file-accordion" id="parsedAccordion">
|
|
{% for report in reports %}
|
|
<div class="accordion-item mb-3" id="report-{{ loop.index }}" data-has-errors="{{ 'true' if report.summary.error > 0 else 'false' }}" data-all-passed="{{ 'true' if report.summary.error == 0 and report.summary.warning == 0 else 'false' }}" data-filename="{{ report.filename }}">
|
|
<h2 class="accordion-header" id="heading-{{ loop.index }}">
|
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-{{ loop.index }}">
|
|
<div class="d-flex w-100 align-items-center">
|
|
<div class="flex-grow-1">
|
|
<strong>{{ report.filename }}</strong>
|
|
{% if report.timestamp %}
|
|
<small class="text-muted ms-2">{{ report.timestamp }}</small>
|
|
{% endif %}
|
|
</div>
|
|
<div class="ms-3">
|
|
{% if report.summary.error > 0 %}
|
|
<span class="badge bg-danger me-2">{{ report.summary.error }} Error(s)</span>
|
|
{% endif %}
|
|
{% if report.summary.warning > 0 %}
|
|
<span class="badge bg-warning text-dark me-2">{{ report.summary.warning }} Warning(s)</span>
|
|
{% endif %}
|
|
{% if report.summary.error == 0 and report.summary.warning == 0 %}
|
|
<span class="badge bg-success me-2">All Passed</span>
|
|
{% endif %}
|
|
<span class="badge bg-secondary">{{ report.summary.total }} checks</span>
|
|
</div>
|
|
</div>
|
|
</button>
|
|
</h2>
|
|
<div id="collapse-{{ loop.index }}" class="accordion-collapse collapse" data-bs-parent="#parsedAccordion">
|
|
<div class="accordion-body">
|
|
{% if report.error %}
|
|
<div class="alert alert-danger">
|
|
<strong>Error:</strong> {{ report.error }}
|
|
</div>
|
|
{% else %}
|
|
<!-- Checks List -->
|
|
{% for check in report.checks %}
|
|
<div class="card check-card status-{{ check.status }}">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<div>
|
|
<h6 class="card-title mb-1">
|
|
<span class="badge
|
|
{% if check.status == 'passed' %}bg-success
|
|
{% elif check.status == 'error' %}bg-danger
|
|
{% elif check.status == 'warning' %}bg-warning text-dark
|
|
{% else %}bg-secondary{% endif %}
|
|
status-badge me-2">
|
|
{{ check.status_text }}
|
|
</span>
|
|
{{ check.name }}
|
|
</h6>
|
|
{% if check.description %}
|
|
<p class="text-muted small mb-2">{{ check.description }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% if check.error_message %}
|
|
<div class="alert alert-danger mt-2 mb-2">
|
|
<strong>Error:</strong> {{ check.error_message }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if check.results %}
|
|
<div class="mt-2">
|
|
<small class="text-muted"><strong>Results:</strong></small>
|
|
<ul class="list-unstyled ms-3 mb-0">
|
|
{% for key, value in check.results.items() %}
|
|
<li class="small">
|
|
<strong>{{ key }}:</strong>
|
|
{% if value is mapping %}
|
|
<ul class="list-unstyled ms-3">
|
|
{% for k, v in value.items() %}
|
|
<li>{{ k }}: {{ v }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
{{ value }}
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Embedded Reports View -->
|
|
<div class="tab-pane fade" id="embedded-view" role="tabpanel">
|
|
<div class="accordion" id="embeddedAccordion">
|
|
{% for report in reports %}
|
|
<div class="accordion-item mb-3">
|
|
<h2 class="accordion-header" id="embedded-heading-{{ loop.index }}">
|
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#embedded-collapse-{{ loop.index }}">
|
|
{{ report.filename }}
|
|
</button>
|
|
</h2>
|
|
<div id="embedded-collapse-{{ loop.index }}" class="accordion-collapse collapse" data-bs-parent="#embeddedAccordion">
|
|
<div class="accordion-body">
|
|
<div class="iframe-container">
|
|
<iframe srcdoc="{{ report.html_content|e }}"></iframe>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="{{ url_for('static', filename='js/auth.js') }}"></script>
|
|
<script>
|
|
// Filter functionality
|
|
document.querySelectorAll('.filter-btn').forEach(btn => {
|
|
btn.addEventListener('click', function() {
|
|
const filter = this.getAttribute('data-filter');
|
|
|
|
// Update active button
|
|
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
|
|
this.classList.add('active');
|
|
|
|
// Filter accordion items
|
|
document.querySelectorAll('#parsedAccordion .accordion-item').forEach(item => {
|
|
const hasErrors = item.getAttribute('data-has-errors') === 'true';
|
|
const allPassed = item.getAttribute('data-all-passed') === 'true';
|
|
|
|
if (filter === 'all') {
|
|
item.style.display = '';
|
|
} else if (filter === 'error' && hasErrors) {
|
|
item.style.display = '';
|
|
} else if (filter === 'passed' && allPassed) {
|
|
item.style.display = '';
|
|
} else {
|
|
item.style.display = 'none';
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
// Scroll to report functionality
|
|
function scrollToReport(filename) {
|
|
// First, ensure we're on the Parsed Data View tab
|
|
const parsedTab = document.getElementById('parsed-tab');
|
|
const parsedView = document.getElementById('parsed-view');
|
|
if (!parsedView.classList.contains('show')) {
|
|
parsedTab.click();
|
|
}
|
|
|
|
// Find the accordion item with matching filename
|
|
const accordionItems = document.querySelectorAll('#parsedAccordion .accordion-item');
|
|
let targetItem = null;
|
|
|
|
accordionItems.forEach(item => {
|
|
if (item.getAttribute('data-filename') === filename) {
|
|
targetItem = item;
|
|
}
|
|
});
|
|
|
|
if (targetItem) {
|
|
// Clear any active filters to ensure the item is visible
|
|
const allFilterBtn = document.querySelector('.filter-btn[data-filter="all"]');
|
|
if (allFilterBtn && !allFilterBtn.classList.contains('active')) {
|
|
allFilterBtn.click();
|
|
}
|
|
|
|
// Scroll to the item
|
|
setTimeout(() => {
|
|
targetItem.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
|
|
// Expand the accordion
|
|
const collapseButton = targetItem.querySelector('.accordion-button');
|
|
if (collapseButton && collapseButton.classList.contains('collapsed')) {
|
|
collapseButton.click();
|
|
}
|
|
|
|
// Highlight the item briefly
|
|
targetItem.style.transition = 'background-color 0.5s';
|
|
targetItem.style.backgroundColor = '#fff3cd';
|
|
setTimeout(() => {
|
|
targetItem.style.backgroundColor = '';
|
|
}, 2000);
|
|
}, 300);
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|