Add Waterfall Chart & Request Inspector

Features Added:
- Interactive waterfall timeline visualization
- Color-coded timing bars (DNS, Connect, SSL, TTFB, Download)
- Request filtering by resource type (HTML, JS, CSS, Images, Fonts)
- Detailed request inspector dialog with timing breakdown
- HAR data extraction from Lighthouse results
- Size/compression metrics display
- Third-party resource identification
- Render-blocking resource detection

Technical Implementation:
- Created lib/har-parser.js for network data extraction
- Built waterfall.html with SVG-based timeline renderer
- Added waterfall.js with interactive controls
- Integrated HAR generation into test runner workflow
- Updated main UI with View Waterfall link
This commit is contained in:
2025-12-28 01:32:27 +11:00
parent 541f451f15
commit 4aa890da6f
12 changed files with 891 additions and 1 deletions

203
waterfall.html Normal file
View File

@@ -0,0 +1,203 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Waterfall View - Web Page Performance Test</title>
<link rel="icon" type="image/png" href="Logo.png">
<link rel="stylesheet" href="styles.css?v=3.0">
<style>
.waterfall-container {
margin: 2rem auto;
max-width: 1400px;
background: var(--color-bg-secondary);
padding: 2rem;
border-radius: 12px;
}
.waterfall-canvas {
width: 100%;
overflow-x: auto;
background: white;
border-radius: 8px;
padding: 1rem;
}
.waterfall-row {
display: flex;
align-items: center;
height: 25px;
margin-bottom: 2px;
cursor: pointer;
transition: background 0.2s ease;
}
.waterfall-row:hover {
background: rgba(114, 9, 183, 0.1);
}
.request-label {
width: 300px;
padding: 0 10px;
font-size: 12px;
color: var(--color-text-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.timeline {
flex: 1;
position: relative;
height: 20px;
}
.timing-bar {
position: absolute;
height: 18px;
border-radius: 2px;
opacity: 0.8;
transition: opacity 0.2s ease;
}
.timing-bar:hover {
opacity: 1;
}
.bar-dns { background: #4CAF50; }
.bar-connect { background: #2196F3; }
.bar-ssl { background: #FFC107; }
.bar-wait { background: #9C27B0; }
.bar-receive { background: #00BCD4; }
.request-dialog {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
max-width: 800px;
max-height: 80vh;
overflow-y: auto;
z-index: 1000;
}
.dialog-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
z-index: 999;
}
.dialog-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 2px solid var(--color-border);
}
.close-btn {
background: none;
border: none;
font-size: 24px;
cursor: pointer;
color: var(--color-text-secondary);
}
.close-btn:hover {
color: var(--color-accent);
}
.detail-section {
margin-bottom: 1.5rem;
}
.detail-section h3 {
color: var(--color-accent);
margin-bottom: 0.5rem;
font-size: 1.1rem;
}
.detail-row {
padding: 0.5rem 0;
border-bottom: 1px solid var(--color-border-light);
}
.detail-label {
font-weight: 600;
color: var(--color-text-secondary);
display: inline-block;
width: 200px;
}
.detail-value {
color: var(--color-text-primary);
}
.filter-controls {
margin-bottom: 1.5rem;
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
.filter-btn {
padding: 0.5rem 1rem;
background: var(--color-bg-tertiary);
border: 2px solid var(--color-border);
border-radius: 8px;
cursor: pointer;
transition: all 0.2s ease;
}
.filter-btn:hover {
background: var(--color-accent);
color: white;
border-color: var(--color-accent);
}
.filter-btn.active {
background: var(--color-accent);
color: white;
border-color: var(--color-accent);
}
</style>
</head>
<body>
<div class="waterfall-container">
<h1>Request Waterfall</h1>
<div class="filter-controls" id="filterControls">
<button class="filter-btn active" data-type="all">All</button>
<button class="filter-btn" data-type="Document">HTML</button>
<button class="filter-btn" data-type="Script">JS</button>
<button class="filter-btn" data-type="Stylesheet">CSS</button>
<button class="filter-btn" data-type="Image">Images</button>
<button class="filter-btn" data-type="Font">Fonts</button>
</div>
<div class="waterfall-canvas" id="waterfallCanvas"></div>
</div>
<div class="dialog-overlay" id="dialogOverlay"></div>
<div class="request-dialog" id="requestDialog">
<div class="dialog-header">
<h2 id="dialogTitle">Request Details</h2>
<button class="close-btn" id="closeDialog">&times;</button>
</div>
<div id="dialogContent"></div>
</div>
<script src="waterfall.js"></script>
</body>
</html>