Skip to content

Commit

Permalink
Always show counts in span details (#1966)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Feb 5, 2024
1 parent 774d541 commit 6d36161
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
31 changes: 20 additions & 11 deletions src/Aspire.Dashboard/Components/Controls/SpanDetails.razor
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<div class="property-grid-container">
<FluentAccordion>
<FluentAccordionItem Heading="Span" Expanded="true">
<div slot="end">
<FluentBadge Appearance="Appearance.Neutral"
Circular="true">
@FilteredItems.Count()
</FluentBadge>
</div>
<PropertyGrid TItem="SpanPropertyViewModel"
Items="@FilteredItems"
GridTemplateColumns="1fr 2fr"
Expand All @@ -36,7 +42,13 @@
ValueSort="_valueSort"
HighlightText="@_filter" />
</FluentAccordionItem>
<FluentAccordionItem Heading="Application">
<FluentAccordionItem Heading="Application" Expanded="true">
<div slot="end">
<FluentBadge Appearance="Appearance.Neutral"
Circular="true">
@FilteredApplicationItems.Count()
</FluentBadge>
</div>
<PropertyGrid TItem="SpanPropertyViewModel"
Items="@FilteredApplicationItems"
GridTemplateColumns="1fr 2fr"
Expand All @@ -46,16 +58,13 @@
ValueSort="_valueSort"
HighlightText="@_filter" />
</FluentAccordionItem>
<FluentAccordionItem Heading="Events">
@if (FilteredSpanEvents.Count() > 0)
{
<div slot="end">
<FluentBadge Appearance="Appearance.Accent"
Circular="true">
@FilteredSpanEvents.Count()
</FluentBadge>
</div>
}
<FluentAccordionItem Heading="Events" Expanded="true">
<div slot="end">
<FluentBadge Appearance="Appearance.Neutral"
Circular="true">
@FilteredSpanEvents.Count()
</FluentBadge>
</div>
<PropertyGrid TItem="OtlpSpanEvent"
Items="@FilteredSpanEvents"
GridTemplateColumns="1fr 2fr"
Expand Down
8 changes: 4 additions & 4 deletions src/Aspire.Dashboard/Components/Controls/SpanDetails.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ public partial class SpanDetails
[Parameter, EditorRequired]
public required SpanDetailsViewModel ViewModel { get; set; }

private IQueryable<SpanPropertyViewModel>? FilteredItems =>
private IQueryable<SpanPropertyViewModel> FilteredItems =>
ViewModel.Properties.Where(vm =>
vm.Name.Contains(_filter, StringComparison.CurrentCultureIgnoreCase) ||
vm.Value?.Contains(_filter, StringComparison.CurrentCultureIgnoreCase) == true
)?.AsQueryable();
).AsQueryable();

private IQueryable<SpanPropertyViewModel>? FilteredApplicationItems =>
private IQueryable<SpanPropertyViewModel> FilteredApplicationItems =>
ViewModel.Span.Source.AllProperties().Select(p => new SpanPropertyViewModel { Name = p.Key, Value = p.Value })
.Where(vm =>
vm.Name.Contains(_filter, StringComparison.CurrentCultureIgnoreCase) ||
vm.Value?.Contains(_filter, StringComparison.CurrentCultureIgnoreCase) == true
)?.AsQueryable();
).AsQueryable();

private IQueryable<OtlpSpanEvent> FilteredSpanEvents =>
ViewModel.Span.Events.Where(e => e.Name.Contains(_filter, StringComparison.CurrentCultureIgnoreCase)).OrderBy(e => e.Time).AsQueryable();
Expand Down

0 comments on commit 6d36161

Please sign in to comment.