Files
gh-openshift-eng-ai-helpers…/skills/prow-job-analyze-resource/report_template.html
2025-11-30 08:46:16 +08:00

435 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>Prow Job Resource Lifecycle - {{build_id}}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.6;
color: #333;
background: #f5f5f5;
padding: 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 {
color: #2c3e50;
margin-bottom: 20px;
font-size: 28px;
}
.metadata {
background: #f8f9fa;
padding: 20px;
border-radius: 6px;
margin-bottom: 30px;
border-left: 4px solid #3498db;
}
.metadata p {
margin: 8px 0;
font-size: 14px;
}
.metadata strong {
color: #2c3e50;
display: inline-block;
min-width: 120px;
}
.metadata a {
color: #3498db;
text-decoration: none;
}
.metadata a:hover {
text-decoration: underline;
}
.timeline-section {
margin: 30px 0;
}
.timeline-section h2 {
color: #2c3e50;
margin-bottom: 15px;
font-size: 20px;
}
.timeline-container {
background: #fff;
border: 1px solid #ddd;
border-radius: 6px;
padding: 20px;
margin-bottom: 30px;
cursor: pointer;
}
#timeline {
width: 100%;
height: 100px;
display: block;
}
.timeline-labels {
display: flex;
justify-content: space-between;
margin-top: 10px;
font-size: 12px;
color: #666;
}
.filters {
margin: 20px 0;
padding: 15px;
background: #f8f9fa;
border-radius: 6px;
display: flex;
gap: 15px;
flex-wrap: wrap;
align-items: center;
}
.filter-group {
display: flex;
align-items: center;
gap: 8px;
}
.filter-group label {
font-size: 14px;
font-weight: 500;
color: #555;
}
.filter-group select,
.filter-group input {
padding: 6px 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.entries-section h2 {
color: #2c3e50;
margin-bottom: 15px;
font-size: 20px;
}
.entry {
background: white;
border: 1px solid #e0e0e0;
border-radius: 6px;
padding: 15px;
margin-bottom: 12px;
transition: box-shadow 0.2s;
}
.entry:hover {
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.entry-header {
display: flex;
gap: 12px;
align-items: center;
margin-bottom: 8px;
flex-wrap: wrap;
}
.timestamp {
font-family: 'Monaco', 'Courier New', monospace;
font-size: 13px;
color: #555;
font-weight: 500;
}
.level {
padding: 3px 10px;
border-radius: 12px;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
}
.level.info {
background: #e8f4f8;
color: #2980b9;
}
.level.warn {
background: #fff3cd;
color: #856404;
}
.level.error {
background: #f8d7da;
color: #721c24;
}
.source {
font-size: 12px;
color: #7f8c8d;
font-family: 'Monaco', 'Courier New', monospace;
}
.entry-summary {
font-size: 14px;
color: #2c3e50;
margin: 8px 0;
line-height: 1.5;
}
.entry-details {
margin-top: 10px;
}
.entry-details summary {
cursor: pointer;
font-size: 13px;
color: #3498db;
user-select: none;
padding: 5px 0;
}
.entry-details summary:hover {
text-decoration: underline;
}
.entry-details pre {
margin-top: 10px;
padding: 12px;
background: #f8f9fa;
border-radius: 4px;
overflow-x: auto;
font-size: 12px;
line-height: 1.4;
}
.entry-details code {
font-family: 'Monaco', 'Courier New', monospace;
color: #333;
}
.stats {
display: flex;
gap: 20px;
margin: 20px 0;
flex-wrap: wrap;
}
.stat-box {
flex: 1;
min-width: 150px;
padding: 15px;
background: #f8f9fa;
border-radius: 6px;
text-align: center;
}
.stat-box .number {
font-size: 32px;
font-weight: 700;
color: #2c3e50;
}
.stat-box .label {
font-size: 13px;
color: #7f8c8d;
margin-top: 5px;
}
.legend {
display: flex;
gap: 20px;
margin-top: 10px;
font-size: 12px;
}
.legend-item {
display: flex;
align-items: center;
gap: 6px;
}
.legend-color {
width: 16px;
height: 16px;
border-radius: 2px;
}
.timeline-event {
cursor: pointer;
transition: opacity 0.2s;
}
.timeline-event:hover {
opacity: 0.7;
}
@media (max-width: 768px) {
.container {
padding: 15px;
}
.entry-header {
flex-direction: column;
align-items: flex-start;
}
.filters {
flex-direction: column;
align-items: stretch;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Prow Job Resource Lifecycle Analysis</h1>
<div class="metadata">
<p><strong>Prow Job:</strong> {{prowjob_name}}</p>
<p><strong>Build ID:</strong> {{build_id}}</p>
<p><strong>gcsweb URL:</strong> <a href="{{original_url}}" target="_blank">{{original_url}}</a></p>
<p><strong>Target:</strong> {{target}}</p>
<p><strong>Resources:</strong> {{resources}}</p>
<p><strong>Time Range:</strong> {{time_range}}</p>
</div>
</div>
<div class="stats">
<div class="stat-box">
<div class="number">{{total_entries}}</div>
<div class="label">Total Entries</div>
</div>
<div class="stat-box">
<div class="number">{{audit_entries}}</div>
<div class="label">Audit Logs</div>
</div>
<div class="stat-box">
<div class="number">{{pod_entries}}</div>
<div class="label">Pod Logs</div>
</div>
<div class="stat-box">
<div class="number">{{error_count}}</div>
<div class="label">Errors</div>
</div>
</div>
<div class="timeline-section">
<h2>Interactive Timeline</h2>
<div class="timeline-container">
<svg id="timeline">
{{timeline_events}}
</svg>
<div class="timeline-labels">
<span>{{min_time}}</span>
<span>{{max_time}}</span>
</div>
</div>
<div class="legend">
<div class="legend-item">
<div class="legend-color" style="background: #e8f4f8;"></div>
<span>Info</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background: #fff3cd;"></div>
<span>Warning</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background: #f8d7da;"></div>
<span>Error</span>
</div>
</div>
</div>
<div class="entries-section">
<h2>Log Entries</h2>
<div class="filters">
<div class="filter-group">
<label>Filter by Level:</label>
<select id="level-filter">
<option value="all">All</option>
<option value="info">Info</option>
<option value="warn">Warning</option>
<option value="error">Error</option>
</select>
</div>
<div class="filter-group">
<label>Search:</label>
<input type="text" id="search-input" placeholder="Search in entries...">
</div>
</div>
<div id="entries-container">
{{entries}}
</div>
</div>
</div>
<script>
// Timeline click handler
document.querySelectorAll('.timeline-event').forEach(el => {
el.addEventListener('click', (e) => {
e.stopPropagation();
const entryId = el.getAttribute('data-entry-id');
const entryElement = document.getElementById(entryId);
if (entryElement) {
entryElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
entryElement.style.background = '#e3f2fd';
setTimeout(() => {
entryElement.style.background = 'white';
}, 2000);
}
});
});
// Level filter
const levelFilter = document.getElementById('level-filter');
levelFilter.addEventListener('change', () => {
const selectedLevel = levelFilter.value;
const entries = document.querySelectorAll('.entry');
entries.forEach(entry => {
if (selectedLevel === 'all') {
entry.style.display = 'block';
} else {
const level = entry.getAttribute('data-level');
entry.style.display = level === selectedLevel ? 'block' : 'none';
}
});
});
// Search filter
const searchInput = document.getElementById('search-input');
searchInput.addEventListener('input', () => {
const searchTerm = searchInput.value.toLowerCase();
const entries = document.querySelectorAll('.entry');
entries.forEach(entry => {
const text = entry.textContent.toLowerCase();
entry.style.display = text.includes(searchTerm) ? 'block' : 'none';
});
});
</script>
</body>
</html>