Skip to content

Commit

Permalink
Span Id formatting in details title (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlmii committed Nov 20, 2023
1 parent 49bb056 commit 3b84d57
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
<Panel2>
<div class="details-container">
<FluentHeader Style="height: auto;">
@DetailsTitle
@if (DetailsTitle is not null)
{
@DetailsTitle
}
else if (DetailsTitleTemplate is not null)
{
@DetailsTitleTemplate
}
<div class="header-right">
<FluentButton Appearance="Appearance.Stealth"
IconEnd="@(Orientation == Orientation.Horizontal ? _splitHorizontalIcon : _splitVerticalIcon)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public partial class SummaryDetailsView
[Parameter]
public bool ShowDetails { get; set; }

[Parameter, EditorRequired]
public required string DetailsTitle { get; set; }
[Parameter]
public string? DetailsTitle { get; set; }

[Parameter]
public Orientation Orientation { get; set; } = Orientation.Vertical;
Expand All @@ -42,6 +42,9 @@ public partial class SummaryDetailsView
[Parameter]
public string? ViewKey { get; set; }

[Parameter]
public RenderFragment? DetailsTitleTemplate { get; set; }

[Inject]
public required ProtectedLocalStorage ProtectedLocalStore { get; set; }

Expand Down
8 changes: 7 additions & 1 deletion src/Aspire.Dashboard/Components/Pages/TraceDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
<FluentAnchor slot="end" Appearance="Appearance.Lightweight" Href="@($"/Traces")">Back</FluentAnchor>
</FluentToolbar>

<SummaryDetailsView DetailsTitle="@(SelectedSpan?.Title)" ShowDetails="SelectedSpan is not null" OnDismiss="() => ClearSelectedSpan()" ViewKey="TraceDetail">
<SummaryDetailsView ShowDetails="SelectedSpan is not null" OnDismiss="() => ClearSelectedSpan()" ViewKey="TraceDetail">
<DetailsTitleTemplate>
<div>
@SelectedSpan!.Title
<span class="span-id">@OtlpHelpers.ToShortenedId(SelectedSpan!.Span.SpanId)</span>
</div>
</DetailsTitleTemplate>
<Summary>
<FluentDataGrid Class="trace-view-grid" ResizableColumns="true" ItemsProvider="@GetData" TGridItem="SpanWaterfallViewModel" RowClass="@GetRowClass" GridTemplateColumns="2fr 6fr">
<TemplateColumn Title="Name">
Expand Down
5 changes: 1 addition & 4 deletions src/Aspire.Dashboard/Components/Pages/TraceDetail.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public partial class TraceDetail
[Parameter]
public string? SpanId { get; set; }

[Inject]
public required IDialogService DialogService { get; set; }

[Inject]
public required TelemetryRepository TelemetryRepository { get; set; }

Expand Down Expand Up @@ -158,7 +155,7 @@ private void OnShowProperties(SpanWaterfallViewModel viewModel)
{
Span = viewModel.Span,
Properties = entryProperties,
Title = $"{viewModel.Span.Source.ApplicationName}: {viewModel.GetDisplaySummary()} {OtlpHelpers.ToShortenedId(viewModel.Span.SpanId)}"
Title = $"{viewModel.Span.Source.ApplicationName}: {viewModel.GetDisplaySummary()}"
};

SelectedSpan = spanDetailsViewModel;
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Dashboard/wwwroot/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fluent-dialog fluent-data-grid-cell[cell-type=columnheader] fluent-button[appear
}

.span-id {
color: rgb(136, 136, 136);
color: var(--foreground-subtext-rest);
padding-left: 0.5rem;
font-size: 12px;
}
Expand Down

0 comments on commit 3b84d57

Please sign in to comment.