Files
Web-Page-Performance-Test/waterfall.html

405 lines
12 KiB
HTML

<!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: var(--color-bg-tertiary);
border-radius: 8px;
padding: 1rem;
position: relative;
}
.waterfall-timescale {
height: 25px;
position: relative;
margin-bottom: 10px;
margin-left: 370px;
border-bottom: 2px solid var(--color-border);
}
.time-marker {
position: absolute;
top: 0;
font-size: 11px;
color: var(--color-text-secondary);
transform: translateX(-50%);
}
.grid-line {
position: absolute;
top: 25px;
bottom: 0;
width: 1px;
background: rgba(119, 119, 119, 0.15);
pointer-events: none;
}
.waterfall-row {
display: flex;
align-items: center;
height: 28px;
margin-bottom: 1px;
cursor: pointer;
transition: background 0.2s ease;
gap: 8px;
}
.waterfall-row:hover {
background: rgba(114, 9, 183, 0.2);
}
.request-number {
width: 35px;
text-align: right;
font-size: 11px;
color: var(--color-text-secondary);
font-weight: 600;
}
.status-badge {
width: 40px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
font-size: 10px;
font-weight: 700;
color: white;
}
.type-badge {
width: 48px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 3px;
font-size: 9px;
font-weight: 700;
background: var(--color-bg-secondary);
color: var(--color-text-secondary);
border: 1px solid var(--color-border);
}
.request-label {
width: 220px;
padding: 0 8px;
font-size: 11px;
color: var(--color-text-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.request-size {
width: 65px;
font-size: 10px;
color: var(--color-text-secondary);
text-align: right;
}
.request-time {
width: 60px;
font-size: 10px;
color: var(--color-text-secondary);
text-align: right;
font-weight: 600;
}
.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: var(--color-bg-secondary);
padding: 2rem;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0,0,0,0.5);
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.7);
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);
}
.request-details-table {
margin-top: 1rem;
overflow-x: auto;
}
.details-table {
width: 100%;
border-collapse: collapse;
background: var(--color-bg-secondary);
border-radius: 8px;
overflow: hidden;
}
.details-table th,
.details-table td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid var(--color-border);
font-size: 0.9rem;
}
.details-table th {
background: var(--color-bg-tertiary);
font-weight: 600;
color: var(--color-text-secondary);
cursor: pointer;
user-select: none;
}
.details-table th:hover {
background: rgba(114, 9, 183, 0.1);
}
.details-table tbody tr:hover {
background: rgba(114, 9, 183, 0.05);
}
.details-table .sort-icon {
font-size: 0.7rem;
margin-left: 0.3rem;
opacity: 0.5;
}
.details-table th.sorted {
color: var(--color-accent);
}
.details-table th.sorted .sort-icon {
opacity: 1;
}
/* Connection View Styles */
.connection-group {
margin-bottom: 2rem;
border: 2px solid var(--color-border);
border-radius: 8px;
overflow: hidden;
}
.connection-header {
background: var(--color-bg-secondary);
padding: 0.75rem 1rem;
display: flex;
align-items: center;
gap: 1rem;
border-bottom: 2px solid var(--color-border);
}
.connection-label {
font-weight: 600;
color: var(--color-text-primary);
flex: 1;
}
.connection-badge {
padding: 0.25rem 0.5rem;
background: var(--color-bg-tertiary);
border-radius: 4px;
font-size: 0.85rem;
color: var(--color-text-secondary);
}
.connection-count {
font-size: 0.9rem;
color: var(--color-text-secondary);
}
.connection-requests {
background: var(--color-bg-tertiary);
}
.connection-row {
border-bottom: 1px solid var(--color-border);
}
.connection-row:last-child {
border-bottom: none;
}
</style>
</head>
<body>
<div class="waterfall-container">
<h1>Request Waterfall</h1>
<div style="display: flex; gap: 2rem; margin-bottom: 1.5rem; align-items: center; flex-wrap: wrap;">
<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 style="display: flex; align-items: center; gap: 0.5rem;">
<label for="viewMode" style="color: var(--color-text-secondary); font-size: 0.9rem;">View:</label>
<select id="viewMode" style="padding: 0.5rem; border-radius: 6px; background: var(--color-bg-secondary); color: var(--color-text-primary); border: 2px solid var(--color-border); cursor: pointer;">
<option value="waterfall">Waterfall</option>
<option value="connection">Connection</option>
</select>
</div>
<div style="display: flex; align-items: center; gap: 0.5rem;">
<label for="sortSelect" style="color: var(--color-text-secondary); font-size: 0.9rem;">Sort:</label>
<select id="sortSelect" style="padding: 0.5rem; border-radius: 6px; background: var(--color-bg-secondary); color: var(--color-text-primary); border: 2px solid var(--color-border); cursor: pointer;">
<option value="time-desc">Slowest → Fastest</option>
<option value="time-asc">Fastest → Slowest</option>
<option value="size-desc">Largest → Smallest</option>
<option value="size-asc">Smallest → Largest</option>
<option value="name-asc">Name (A → Z)</option>
<option value="name-desc">Name (Z → A)</option>
<option value="sequence">Original Sequence</option>
</select>
</div>
</div>
<div class="waterfall-canvas" id="waterfallCanvas"></div>
<h2 style="margin-top: 3rem;">Request Details</h2>
<div class="request-details-table" id="requestDetailsTable"></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>