insight/src/Web/Insight.Web/Pages/Management/Agents/Index.razor
2023-09-21 18:58:32 +02:00

88 lines
No EOL
2.6 KiB
Text

@inherits ComponentBase
<TableContainer T="ViewModel"
@ref="Container"
@bind-Search="Search"
Title="@Title"
Breadcrumbs="@Breadcrumbs"
Data="LoadDataAsync"
OnFilter="()=>Filter = true"
Filtered="Filtered">
<Header>
<MudTh>
<MudTableSortLabel SortLabel="Serial" T="ViewModel">
Serial
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="Hostname" T="ViewModel">
Hostname
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="Version" T="ViewModel">
Version
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="Assigned" T="ViewModel">
Assigned
</MudTableSortLabel>
</MudTh>
<MudTh>
<MudTableSortLabel SortLabel="Online" T="ViewModel">
Online
</MudTableSortLabel>
</MudTh>
</Header>
<RowTemplate>
<MudTd DataLabel="Serial">
<MudLink Href="@Navigation.Management.Agents.DetailsHref(context?.Id.ToString())" Typo="Typo.inherit" Underline="Underline.None">
@context?.Serial
</MudLink>
</MudTd>
<MudTd DataLabel="Hostname">
@context?.Hostname
</MudTd>
<MudTd DataLabel="Version">
@context?.Version
</MudTd>
<MudTd DataLabel="Assigned">
<MudCheckBox Checked="@(context.Hosts is not null && context.Hosts.Any())" Disabled DisableRipple />
</MudTd>
<MudTd DataLabel="Online">
<MudText Color="(context.Online ? Color.Success : Color.Error)" Typo="Typo.inherit">
@(context.Online ? "Online" : "Offline")
</MudText>
</MudTd>
</RowTemplate>
<ActionTemplate>
<MudMenuItem OnClick="@(()=>OnDelete(context))">
Delete
</MudMenuItem>
</ActionTemplate>
</TableContainer>
<ActionDialog @bind-Visible="Filter">
<Content>
<MudSwitch @bind-Checked="FilterUnassignedHost" Color="Color.Primary">
Unassigned
</MudSwitch>
</Content>
<Actions>
<MudButton OnClick="OnFilterReset">
Reset
</MudButton>
<MudButton OnClick="() => Filter = false" Color="Color.Secondary">
Done
</MudButton>
</Actions>
</ActionDialog>
<CascadingValue Name="Agent" Value="@Model">
<AgentDeleteDialog @ref="_deleteDialog" OnChanges="OnRefreshAsync" />
</CascadingValue>
@code {
private AgentDeleteDialog? _deleteDialog;
}