Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
736 changes: 12 additions & 724 deletions monitoring/benchmarker/artifacts/timeline/templates/scenario.html

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions monitoring/monitorlib/html/templates/timeline/canvas.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div id="timeline-container">
<canvas id="timeline-canvas"></canvas>
<div id="tooltip"></div>
<div class="help-hint">
<strong>Controls:</strong> Left-drag or Mouse wheel to scroll &bull; Shift + Left-drag or Shift + Wheel to zoom time &bull;
{% if timeline_horizontal %}
Ctrl/Alt + Wheel or pinch to zoom lanes &bull; Horizontal wheel or bottom bar to scroll lanes &bull;
{% endif %}
{{ timeline_hover_hint|default("Hover Time column to inspect active operations") }}
</div>
</div>
11 changes: 11 additions & 0 deletions monitoring/monitorlib/html/templates/timeline/controls.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="btn-group">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but indent seems all over the place (in previous file as well)

<button id="btn-zoom-in" class="btn-sm" title="Zoom In (or Shift + Wheel Up)">Zoom In (+)</button>
<button id="btn-zoom-out" class="btn-sm" title="Zoom Out (or Shift + Wheel Down)">Zoom Out (-)</button>
<button id="btn-reset-view" class="btn-sm" title="Reset to Full Scenario View">Reset View</button>
</div>
{% if timeline_horizontal %}
<div class="btn-group">
<button id="btn-hzoom-in" class="btn-sm" title="Widen lanes (or Ctrl/Alt + Wheel Up)">Lanes (+)</button>
<button id="btn-hzoom-out" class="btn-sm" title="Narrow lanes (or Ctrl/Alt + Wheel Down)">Lanes (-)</button>
</div>
{% endif %}
98 changes: 98 additions & 0 deletions monitoring/monitorlib/html/templates/timeline/horizontal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{# Optional horizontal lane viewport; the caller supplies X_OPS_START and data.total_operation_lanes. #}
// Visible lane window [viewL0, viewL1], in lane units across all origins
const totalLanes = Math.max(1, data.total_operation_lanes);
const minLaneSpan = Math.min(1, totalLanes);
let viewL0 = 0;
let viewL1 = totalLanes;

let isDraggingHScrollbar = false;
let dragAnchorX = 0;
let dragStartL0 = 0;
let dragStartL1 = 0;

function clampLanes() {
let span = viewL1 - viewL0;
if (span >= totalLanes) {
viewL0 = 0;
viewL1 = totalLanes;
return;
}
if (span < minLaneSpan) {
const center = (viewL0 + viewL1) / 2;
span = minLaneSpan;
viewL0 = center - span / 2;
viewL1 = center + span / 2;
}
if (viewL0 < 0) {
viewL0 = 0;
viewL1 = span;
}
if (viewL1 > totalLanes) {
viewL1 = totalLanes;
viewL0 = totalLanes - span;
}
}

function zoomLanesAround(lane, factor) {
const span = viewL1 - viewL0;
const newSpan = span * factor;
const ratio = (lane - viewL0) / span;
viewL0 = lane - newSpan * ratio;
viewL1 = lane + newSpan * (1 - ratio);
clampLanes();
}

function opsWidth() {
return Math.max(10, width - X_OPS_START - W_SCROLLBAR);
}

function laneWidth() {
return opsWidth() / (viewL1 - viewL0);
}

function laneToX(lane) {
return X_OPS_START + (lane - viewL0) * laneWidth();
}

function xToLane(x) {
return viewL0 + (x - X_OPS_START) / laneWidth();
}

function hScrollbarXToLane(x) {
return ((x - X_OPS_START) / opsWidth()) * totalLanes;
}

function inHScrollbar(x, y) {
return y >= H_HEADER + timelineHeight() && x >= X_OPS_START && x < width - W_SCROLLBAR;
}

function centerLanesOn(lane) {
const span = viewL1 - viewL0;
viewL0 = lane - span / 2;
viewL1 = lane + span / 2;
clampLanes();
}

function drawHorizontalScrollbar() {
const xOpsStart = X_OPS_START;
const xOpsEnd = width - W_SCROLLBAR;
const wOpsAvailable = opsWidth();
const yBottom = H_HEADER + timelineHeight();
// 8. Horizontal Scroll Bar (Bottom of the operations area)
ctx.fillStyle = '#f1f5f9';
ctx.fillRect(xOpsStart, yBottom, wOpsAvailable, H_HSCROLLBAR);
ctx.strokeStyle = '#e2e8f0';
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(xOpsStart, yBottom);
ctx.lineTo(xOpsEnd, yBottom);
ctx.stroke();

const thumbX0 = xOpsStart + (viewL0 / totalLanes) * wOpsAvailable;
const thumbW = Math.max(8, ((viewL1 - viewL0) / totalLanes) * wOpsAvailable);
ctx.fillStyle = 'rgba(59, 130, 246, 0.35)';
ctx.fillRect(thumbX0, yBottom + 2, thumbW, H_HSCROLLBAR - 4);
ctx.strokeStyle = '#2563eb';
ctx.lineWidth = 1.5;
ctx.strokeRect(thumbX0, yBottom + 2, thumbW, H_HSCROLLBAR - 4);
}
207 changes: 207 additions & 0 deletions monitoring/monitorlib/html/templates/timeline/style.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
<style>
:root {
--primary: #1976d2;
--primary-hover: #1565c0;
--bg: #f8fafc;
--surface: #ffffff;
--border: #e2e8f0;
--text: #1e293b;
--text-muted: #64748b;
--success: #10b981;
--danger: #ef4444;
--warning: #f59e0b;
}

* {
box-sizing: border-box;
}

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 0;
padding: 0;
background-color: var(--bg);
color: var(--text);
overflow-x: hidden;
height: 100vh;
display: flex;
flex-direction: column;
}

header {
background-color: var(--surface);
border-bottom: 1px solid var(--border);
padding: 0.5rem 1.25rem;
flex-shrink: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 0.75rem;
}

.title-nav {
display: flex;
align-items: center;
gap: 1rem;
}

h1 {
margin: 0;
font-size: 1.15rem;
font-weight: 700;
color: var(--text);
display: flex;
align-items: center;
gap: 0.5rem;
}

.nav-link {
display: inline-flex;
align-items: center;
gap: 0.25rem;
color: var(--primary);
text-decoration: none;
font-size: 0.875rem;
font-weight: 500;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
border: 1px solid transparent;
white-space: nowrap;
}

.nav-link:hover {
background-color: #f1f5f9;
border-color: var(--border);
}

.controls-bar {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}

.btn-group {
display: inline-flex;
border-radius: 0.375rem;
border: 1px solid var(--border);
overflow: hidden;
background: var(--surface);
}

.btn-sm {
padding: 0.25rem 0.6rem;
font-size: 0.8125rem;
border: none;
background: transparent;
color: var(--text);
cursor: pointer;
border-right: 1px solid var(--border);
display: inline-flex;
align-items: center;
gap: 0.25rem;
white-space: nowrap;
}

.btn-sm:last-child {
border-right: none;
}

.btn-sm:hover {
background-color: #f1f5f9;
}

.legend-bar {
display: flex;
align-items: center;
gap: 0.75rem;
background-color: #f8fafc;
border: 1px solid var(--border);
border-radius: 0.375rem;
padding: 0.25rem 0.6rem;
font-size: 0.75rem;
flex-wrap: wrap;
}

.legend-chip {
display: inline-flex;
align-items: center;
gap: 0.35rem;
white-space: nowrap;
}

.legend-color-dot {
width: 0.75rem;
height: 0.75rem;
border-radius: 0.15rem;
border: 1px solid rgba(0,0,0,0.2);
}

.badge {
display: inline-flex;
align-items: center;
padding: 0.15rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
background-color: #f1f5f9;
color: var(--text-muted);
border: 1px solid var(--border);
white-space: nowrap;
}

#timeline-container {
flex: 1;
position: relative;
width: 100%;
background-color: #ffffff;
overflow: hidden;
}

#timeline-canvas {
display: block;
width: 100%;
height: 100%;
cursor: default;
}

#tooltip {
position: absolute;
display: none;
background: rgba(15, 23, 42, 0.94);
color: #ffffff;
padding: 0.5rem 0.75rem;
border-radius: 0.375rem;
font-size: 0.75rem;
line-height: 1.45;
pointer-events: none;
z-index: 1000;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
max-width: 420px;
}

#tooltip strong {
color: #93c5fd;
}

.help-hint {
position: absolute;
bottom: {{ "calc(14px + 0.5rem)" if timeline_horizontal else "0.5rem" }};
left: 0.75rem;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(4px);
border: 1px solid var(--border);
border-radius: 0.25rem;
padding: 0.25rem 0.6rem;
font-size: 0.75rem;
color: var(--text-muted);
pointer-events: none;
z-index: 10;
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
</style>
Loading
Loading