Skip to content

Commit

Permalink
Using ResourceSelect in ConsoleLogs, Matrics, StructuredLogs and Traces
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsM16 committed Mar 6, 2024
1 parent 3b6c664 commit 74df15b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 31 deletions.
6 changes: 5 additions & 1 deletion src/Aspire.Dashboard/Components/Pages/ConsoleLogs.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<div class="resource-logs-layout">
<h1 class="page-header">@Loc[nameof(Dashboard.Resources.ConsoleLogs.ConsoleLogsHeader)]</h1>
<FluentToolbar Orientation="Orientation.Horizontal">
<ResourceSelect @ref="_resourceSelectComponent" Resources="_resources" @bind-SelectedResource="PageViewModel.SelectedOption" @bind-SelectedResource:after="HandleSelectedOptionChangedAsync" />
<ResourceSelect @ref="_resourceSelectComponent"
Resources="_resources"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAResource)]"
@bind-SelectedResource="PageViewModel.SelectedOption"
@bind-SelectedResource:after="HandleSelectedOptionChangedAsync" />
<FluentLabel Typo="Typography.Body" aria-live="polite" aria-label="@Loc[nameof(Dashboard.Resources.ConsoleLogs.LogStatusLabel)]">@PageViewModel.Status</FluentLabel>
</FluentToolbar>
<LogViewer @ref="_logViewer" />
Expand Down
14 changes: 4 additions & 10 deletions src/Aspire.Dashboard/Components/Pages/Metrics.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
<div class="metrics-layout">
<h1 class="page-header">@Loc[nameof(Dashboard.Resources.Metrics.MetricsHeader)]</h1>
<FluentToolbar Orientation="Orientation.Horizontal">
<FluentSelect Items="@_applications"
OptionDisabled="@(c => c.Id?.Type is OtlpApplicationType.ReplicaSet)"
OptionValue="@(c => c.Id?.InstanceId)"
@bind-SelectedOption="PageViewModel.SelectedApplication"
@bind-SelectedOption:after="HandleSelectedApplicationChangedAsync"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAnApplication)]">
<OptionTemplate>
<ResourceSelectOptionTemplate ViewModel="@context" />
</OptionTemplate>
</FluentSelect>
<ResourceSelect Resources="_applications"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAnApplication)]"
@bind-SelectedResource="PageViewModel.SelectedApplication"
@bind-SelectedResource:after="HandleSelectedApplicationChangedAsync" />
<FluentIcon slot="end" Icon="Icons.Regular.Size20.Clock" Style="margin-right:5px;" />
<FluentSelect slot="end" TOption="SelectViewModel<TimeSpan>"
Items="@_durations"
Expand Down
14 changes: 4 additions & 10 deletions src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@
<div class="logs-layout">
<h1 class="page-header">@Loc[nameof(Dashboard.Resources.StructuredLogs.StructuredLogsHeader)]</h1>
<FluentToolbar Orientation="Orientation.Horizontal">
<FluentSelect Items="@_applicationViewModels"
OptionValue="@(c => c.Id?.InstanceId)"
OptionDisabled="@(c => c.Id?.Type is OtlpApplicationType.ReplicaSet)"
@bind-SelectedOption="PageViewModel.SelectedApplication"
@bind-SelectedOption:after="HandleSelectedApplicationChangedAsync"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAnApplication)]">
<OptionTemplate>
<ResourceSelectOptionTemplate ViewModel="@context" />
</OptionTemplate>
</FluentSelect>
<ResourceSelect Resources="_applicationViewModels"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAnApplication)]"
@bind-SelectedResource="PageViewModel.SelectedApplication"
@bind-SelectedResource:after="HandleSelectedApplicationChangedAsync" />
<FluentSearch @bind-Value="PageViewModel.Filter"
@oninput="HandleFilter"
@bind-Value:after="HandleClear"
Expand Down
14 changes: 4 additions & 10 deletions src/Aspire.Dashboard/Components/Pages/Traces.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@
<div class="traces-layout">
<h1 class="page-header">@Loc[nameof(Dashboard.Resources.Traces.TracesHeader)]</h1>
<FluentToolbar Orientation="Orientation.Horizontal">
<FluentSelect Items="@_applicationViewModels"
OptionValue="@(c => c.Id?.InstanceId)"
OptionDisabled="@(c => c.Id?.Type is OtlpApplicationType.ReplicaSet)"
@bind-SelectedOption="_selectedApplication"
@bind-SelectedOption:after="HandleSelectedApplicationChangedAsync"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAnApplication)]">
<OptionTemplate>
<ResourceSelectOptionTemplate ViewModel="@context" />
</OptionTemplate>
</FluentSelect>
<ResourceSelect Resources="_applicationViewModels"
AriaLabel="@ControlsStringsLoc[nameof(ControlsStrings.SelectAnApplication)]"
@bind-SelectedResource="_selectedApplication"
@bind-SelectedResource:after="HandleSelectedApplicationChangedAsync" />
<FluentSearch @bind-Value="_filter"
@oninput="HandleFilter"
@bind-Value:after="HandleClear"
Expand Down

0 comments on commit 74df15b

Please sign in to comment.