Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ else
<div class="metrics-chart-header">
<h3>@_instrument.Summary.Name</h3>
<p>@_instrument.Summary.Description</p>

@if (_instrument.HasOverflow)
{
<div class="block-warning">
Expand All @@ -29,6 +30,12 @@ else
</div>
</div>
}

@if (PauseText is not null)
{
<PauseWarning PauseText="@PauseText" />
}

</div>
<FluentTabs ActiveTabId="@($"tab-{ActiveView}")" OnTabChange="@OnTabChangeAsync" Size="null">
<FluentTab LabelClass="tab-label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public partial class ChartContainer : ComponentBase, IAsyncDisposable
[Parameter, EditorRequired]
public required List<OtlpApplication> Applications { get; set; }

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

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

Expand Down
19 changes: 19 additions & 0 deletions src/Aspire.Dashboard/Components/Controls/PauseWarning.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@using Aspire.Dashboard.Resources

@inject IStringLocalizer<ControlsStrings> Loc

<div class="block-warning">
<div class="block-warning-icon">
<FluentIcon Value="new Icons.Filled.Size16.Warning()" Color="Color.Warning" />
</div>

<div class="block-warning-message">
<span class="title">@Loc[nameof(ControlsStrings.TotalItemsFooterCapturePaused)]</span>
@PauseText
</div>
</div>

@code {
[Parameter, EditorRequired]
public required string PauseText { get; set; }
}
11 changes: 1 addition & 10 deletions src/Aspire.Dashboard/Components/Controls/TotalItemsFooter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@

@if (PauseText is not null)
{
<div class="block-warning">
<div class="block-warning-icon">
<FluentIcon Value="new Icons.Filled.Size16.Warning()" Color="Color.Warning" />
</div>

<div class="block-warning-message">
<span class="title">@Loc[nameof(ControlsStrings.TotalItemsFooterCapturePaused)]</span>
@PauseText
</div>
</div>
<PauseWarning PauseText="@PauseText" />
}
</div>

Expand Down
3 changes: 2 additions & 1 deletion src/Aspire.Dashboard/Components/Pages/Metrics.razor
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
Duration="PageViewModel.SelectedDuration.Id"
ActiveView="@(PageViewModel.SelectedViewKind ?? Metrics.MetricViewKind.Graph)"
OnViewChangedAsync="@OnViewChangedAsync"
Applications="@_applications" />
Applications="@_applications"
PauseText="@PauseText" />
}
else if (PageViewModel.SelectedMeter != null)
{
Expand Down
10 changes: 10 additions & 0 deletions src/Aspire.Dashboard/Components/Pages/Metrics.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public partial class Metrics : IDisposable, IComponentWithTelemetry, IPageWithSe
[Inject]
public required PauseManager PauseManager { get; init; }

[Inject]
public required BrowserTimeProvider TimeProvider { get; init; }

[CascadingParameter]
public required ViewportInformation ViewportInformation { get; init; }

Expand Down Expand Up @@ -218,6 +221,13 @@ private Task HandleSelectedDurationChangedAsync()
return this.AfterViewModelChangedAsync(_contentLayout, waitToApplyMobileChange: true);
}

private string? PauseText => PauseManager.AreMetricsPaused(out var startTime)
? string.Format(
CultureInfo.CurrentCulture,
Loc[nameof(Dashboard.Resources.Metrics.PauseInProgressText)],
FormatHelpers.FormatTimeWithOptionalDate(TimeProvider, startTime.Value, MillisecondsDisplay.Truncated))
: null;

public sealed class MetricsViewModel
{
public FluentTreeItem? SelectedTreeItem { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Dashboard/Components/Pages/Traces.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private void OnBrowserResize(object? o, EventArgs args)
private string? PauseText => PauseManager.AreTracesPaused(out var startTime)
? string.Format(
CultureInfo.CurrentCulture,
Loc[nameof(Dashboard.Resources.StructuredLogs.PauseInProgressText)],
Loc[nameof(Dashboard.Resources.Traces.PauseInProgressText)],
Copy link
Member

Choose a reason for hiding this comment

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

did you check for any other similar mistakes

FormatHelpers.FormatTimeWithOptionalDate(TimeProvider, startTime.Value, MillisecondsDisplay.Truncated))
: null;

Expand Down
163 changes: 50 additions & 113 deletions src/Aspire.Dashboard/Resources/Metrics.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading