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
61 changes: 55 additions & 6 deletions src/app/agentic-traces/agentic-traces.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,53 @@
box-sizing: border-box;
}

:host.no-header {
height: 100vh;
}

:host.no-header app-analysis-toolbar {
top: 0;
}

:host.no-toolbar .vis-page-container {
padding-top: 0;
}

:host.embed-mode .loading-container {
min-height: 0;
}

.embed-open-btn {
position: absolute;
top: 8px;
right: 12px;
z-index: 35;
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px 10px;
border-radius: 999px;
border: 1px solid #cbd5e1;
background: rgba(255, 255, 255, 0.92);
backdrop-filter: blur(6px);
color: #1e40af;
font-size: 0.72rem;
font-weight: 600;
text-decoration: none;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
transition: border-color 0.15s ease, background 0.15s ease;
}

.embed-open-btn:hover {
border-color: #3b82f6;
background: #fff;
}

.embed-open-btn.inline {
position: static;
margin-top: 4px;
}

.selector-bar {
position: fixed;
top: 0;
Expand All @@ -22,7 +69,8 @@
color: white;
}

.selector-group, .conv-selector-group {
.selector-group,
.conv-selector-group {
display: flex;
align-items: center;
gap: 8px;
Expand Down Expand Up @@ -87,7 +135,7 @@ app-analysis-toolbar {
flex: 1;
display: flex;
flex-direction: column;
background: #ffffff;
background: #fff;
position: relative;
min-width: 200px;
overflow: hidden;
Expand Down Expand Up @@ -159,7 +207,7 @@ app-analysis-toolbar {
}

.trace-legend.collapsed:hover {
background: #ffffff;
background: #fff;
border-color: #cbd5e1;
box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
Expand Down Expand Up @@ -295,15 +343,15 @@ app-analysis-toolbar {
.loading-spinner {
width: 40px;
height: 40px;
border: 3.5px solid rgba(255, 255, 255, 0.1);
border: 3.5px solid #e2e8f0;
border-top-color: #6366f1; /* beautiful premium indigo */
border-radius: 50%;
animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loading-text {
font-size: 1.1rem;
color: rgba(255, 255, 255, 0.6);
color: #475569;
font-weight: 400;
}

Expand Down Expand Up @@ -556,7 +604,8 @@ app-analysis-toolbar {
.search-report-name { font-weight: 600; color: #1e293b; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-report-verdict { font-size: 0.68rem; color: #64748b; white-space: nowrap; }
.search-report-text { margin-top: 4px; font-size: 0.78rem; line-height: 1.45; color: #334155; white-space: pre-wrap; }
.search-report-sub, .search-report-hint { margin-top: 4px; font-size: 0.68rem; color: #94a3b8; }
.search-report-sub,
.search-report-hint { margin-top: 4px; font-size: 0.68rem; color: #94a3b8; }
.step-link { color: #2563eb; text-decoration: underline; text-decoration-color: #93c5fd; cursor: pointer; }
.search-dot-inline {
width: 8px; height: 8px; border-radius: 50%; box-sizing: border-box; flex-shrink: 0;
Expand Down
28 changes: 22 additions & 6 deletions src/app/agentic-traces/agentic-traces.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="selector-bar">
<div class="selector-bar" *ngIf="embedState.headerVisible()">
<!-- X Axis Toggle. Time is disabled when no selected trace has timestamps; the choice is remembered. -->
<div class="selector-group">
<label class="selector-label">X Axis</label>
Expand Down Expand Up @@ -125,17 +125,25 @@
</div>

<!-- Analysis Toolbar (separate row below header) -->
<app-analysis-toolbar [marks]="searchMarks()"></app-analysis-toolbar>
<app-analysis-toolbar *ngIf="embedState.toolbarVisible()" [marks]="searchMarks()"></app-analysis-toolbar>
<!-- Opened by the toolbar's download button; outside the toolbar so it overlays the whole page. -->
<app-export-dialog [marks]="searchMarks()"></app-export-dialog>

<div class="vis-page-container" (click)="onBackgroundClick($event)">
<div class="main-layout">
<!-- Left: datasets and examples to pick traces from -->
<app-examples-sidebar></app-examples-sidebar>
<app-examples-sidebar *ngIf="!embedState.sidebarHidden()"></app-examples-sidebar>

<ng-container *ngIf="!isLoading() && activeTrace(); else loading">
<div class="vis-container">
<a class="embed-open-btn"
*ngIf="embedState.embed()"
[href]="embedState.fullAppUrl()"
target="_blank"
rel="noopener noreferrer"
title="Open in full Agent Trace Vis">
Open in Agent Trace Vis &#8599;
</a>
<!-- No results banner -->
<div class="no-results-banner" *ngIf="layersService.noResultsLayers().length > 0">
No matches found for:
Expand All @@ -146,7 +154,7 @@

<!-- Legend -->
<div class="legend-bar trace-legend"
*ngIf="legendEntries().length > 0"
*ngIf="legendEntries().length > 0 && !embedState.legendHidden()"
[class.collapsed]="isLegendCollapsed()"
(click)="$event.stopPropagation()">
<div class="legend-header" (click)="toggleLegend($event)" [title]="isLegendCollapsed() ? 'Expand legend' : 'Minimize legend'">
Expand Down Expand Up @@ -272,11 +280,12 @@
</div>

<!-- Right: Conversation Panel. Drag the splitter to resize; click it to minimize / reopen (same as the examples sidebar). -->
<app-panel-splitter side="right" [collapsed]="panelCollapsed()" [width]="sidebarWidth()"
<app-panel-splitter *ngIf="embedState.panelVisible()"
side="right" [collapsed]="panelCollapsed()" [width]="sidebarWidth()"
[minWidth]="260" [maxWidth]="1200"
(collapsedChange)="panelCollapsed.set($event)"
(widthChange)="sidebarWidth.set($event)"></app-panel-splitter>
<div class="panel-wrapper" *ngIf="!panelCollapsed()"
<div class="panel-wrapper" *ngIf="embedState.panelVisible() && !panelCollapsed()"
[style.width.px]="sidebarWidth()" [style.flex]="'0 0 ' + sidebarWidth() + 'px'">
<app-conversation-viewer
[messages]="threadMessages()"
Expand Down Expand Up @@ -342,6 +351,13 @@
<div class="loading-text">Use “+ Add dataset” on the left to open a demo trace or your own trace files.</div>
</ng-template>
</ng-template>
<a class="embed-open-btn inline"
*ngIf="embedState.embed()"
[href]="embedState.fullAppUrl()"
target="_blank"
rel="noopener noreferrer">
Open in Agent Trace Vis &#8599;
</a>
</div>
</ng-template>

Expand Down
48 changes: 42 additions & 6 deletions src/app/agentic-traces/agentic-traces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ import {
} from "@angular/core";
import { CommonModule } from "@angular/common";
import { FormsModule } from "@angular/forms";
import { ActivatedRoute } from "@angular/router";
import { ActivatedRoute, NavigationEnd, Router } from "@angular/router";
import { Subscription } from "rxjs";
import { filter } from "rxjs/operators";
import { EmbedStateService } from "../shared/embed-state.service";
import { EXTRA_MANAGED_URL_PARAMS, UrlParamService } from "../shared/url-param.service";
import { getParamFromMap, getParamValuesFromMap } from "../shared/url-params";
import { TELEMETRY_TRACKER } from "../shared/telemetry.service";
Expand All @@ -45,6 +48,7 @@ import { INITIAL_DATASET_REFS } from "../data/initial-refs";
import { DatasetRef, parseDatasetRef, parseIndices } from "../data/dataset-refs";
import {
CustomSearchSpec,
isEmbedLocation,
LEGACY_CONFIG_PARAM_ALIASES,
MANAGED_URL_PARAM_KEYS,
parseUrlUiConfig,
Expand Down Expand Up @@ -106,9 +110,15 @@ interface LegendEntry {
providers: [AnalysisLayersService],
templateUrl: './agentic-traces.html',
styleUrls: ['./agentic-traces.css'],
host: {
'[class.embed-mode]': 'embedState.embed()',
'[class.no-header]': '!embedState.headerVisible()',
'[class.no-toolbar]': '!embedState.toolbarVisible()',
},
})
export class AgenticTracesComponent implements OnInit, OnDestroy {
readonly workspace = inject(WorkspaceService);
readonly embedState = inject(EmbedStateService);
private readonly initialRefs = inject(INITIAL_DATASET_REFS, { optional: true });
private readonly extraManagedParams = inject(EXTRA_MANAGED_URL_PARAMS, { optional: true }) ?? [];
private readonly telemetry = inject(TELEMETRY_TRACKER, { optional: true });
Expand Down Expand Up @@ -302,6 +312,7 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
/** Re-lays out the rows when the timeline area changes width. */
private resizeObserver = new ResizeObserver(([entry]) => this.onScrollAreaResize(entry.contentRect.width));
private scrollArea?: HTMLElement;
private routerEventsSub?: Subscription;

/** The scroll area comes and goes with the loading screen; observe whichever is current. */
@ViewChild('visScrollArea', { static: false })
Expand Down Expand Up @@ -457,8 +468,17 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
public layersService: AnalysisLayersService,
public chaptersService: ChaptersService,
private route: ActivatedRoute,
private router: Router,
private urlParamService: UrlParamService,
) {
this.routerEventsSub = this.router.events
.pipe(filter((e): e is NavigationEnd => e instanceof NavigationEnd))
.subscribe(() => {
if (typeof window !== 'undefined') {
this.embedState.updateFullAppUrl(window.location.href);
}
});

this.currentUrlConfigParams = computed(() => {
const presetByName = new Map(ANALYSIS_PRESETS.map(p => [p.name, p]));
const presets: string[] = [];
Expand All @@ -478,6 +498,12 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
const activeIdx = activeId ? traces.findIndex(t => t.id === activeId) : -1;

return serializeUrlUiConfig({
embed: this.embedState.embed(),
headerVisible: this.embedState.headerVisible(),
toolbarVisible: this.embedState.toolbarVisible(),
panelVisible: this.embedState.panelVisible(),
sidebarHidden: this.embedState.sidebarHidden(),
legendHidden: this.embedState.legendHidden(),
axis: this.yAxisMode(),
wait: this.showUserWait(),
fill: this.stretch(),
Expand All @@ -497,7 +523,7 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
sidebarCollapsed: this.workspace.sidebarCollapsed(),
panelCollapsed: this.panelCollapsed(),
sidebarFilter: this.workspace.sidebarFilter(),
});
}, this.embedState.isEmbedRoute());
});
// Show the workspace's selected traces, keeping any row order the user dragged.
effect(() => {
Expand Down Expand Up @@ -550,15 +576,24 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
ngOnInit() {
const w = window as DevWindow;
w.clearCache = w.clearcache = this.clearCacheFn;
this.telemetry?.trackPageView?.('/');
const href = typeof window !== 'undefined' ? window.location.href : '';
const onEmbedRoute = isEmbedLocation(href, this.route.snapshot?.routeConfig?.path);
const initialConfig = this.embedState.syncFromLocation(
href,
this.route.snapshot?.routeConfig?.path,
this.route.snapshot?.queryParams,
);
this.telemetry?.trackPageView?.(initialConfig.embed ? '/embed' : '/');

void this.initWorkspace();
void this.initWorkspace(onEmbedRoute);
}

/** Restores the workspace and UI configuration from the URL, then loads defaults if empty. */
private async initWorkspace() {
private async initWorkspace(onEmbedRoute = false) {
const allParams = this.urlParamService.readAllQueryParams(this.route);
const uiConfig = parseUrlUiConfig(allParams);
const uiConfig = parseUrlUiConfig(allParams, onEmbedRoute);
const href = typeof window !== 'undefined' ? window.location.href : '';
this.embedState.applyUiConfig(uiConfig, href, onEmbedRoute);

this.yAxisMode.set(uiConfig.axis);
this.showUserWait.set(uiConfig.wait);
Expand Down Expand Up @@ -665,6 +700,7 @@ export class AgenticTracesComponent implements OnInit, OnDestroy {
}

ngOnDestroy() {
this.routerEventsSub?.unsubscribe();
this.resizeObserver.disconnect();
const w = window as DevWindow;
if (w.clearCache === this.clearCacheFn) {
Expand Down
Loading
Loading