insight/src/Web/Insight.Web/Pages/Management/Agents/AgentHostDialog.razor

49 lines
2 KiB
Text
Raw Normal View History

2023-09-21 18:58:32 +02:00
@using MongoDB.Bson;
<MudDrawer @bind-Open="_visible" Anchor="Anchor.End" Elevation="0" Variant="@DrawerVariant.Temporary" ClipMode="DrawerClipMode.Always" Width="400px" Style="max-width:auto;">
<MudDrawerHeader>
<MudText Typo="Typo.h6">
Host
</MudText>
</MudDrawerHeader>
<MudStack Class="px-6">
@if (Agent is not null)
{
@if (Agent.Hosts is not null && Agent.Hosts.Any())
{
<MudStack Justify="Justify.Center">
<MudButton Href="@Navigation.Management.Hosts.DetailsHref(Agent?.Hosts?.FirstOrDefault()?.Id?.ToString())" Variant="Variant.Filled" Size="Size.Large" Color="Color.Info" DisableElevation="true">
Select
</MudButton>
<MudButton OnClick="UnassignAsync" Variant="Variant.Filled" DisableElevation Size="Size.Large" Color="Color.Error">
Unassign
</MudButton>
<MudButton OnClick="()=>_visible = false" Variant="Variant.Outlined" DisableElevation Size="Size.Large" Color="Color.Surface">
Cancel
</MudButton>
</MudStack>
}
else
{
<MudStack Justify="Justify.Center">
<MudButton Href="@Navigation.Management.Agents.HostAssingHref(Agent.Id?.ToString())" Variant="Variant.Filled" DisableElevation Size="Size.Large" Color="Color.Error">
Assign
</MudButton>
<MudButton OnClick="()=>_visible = false" Variant="Variant.Outlined" DisableElevation Size="Size.Large" Color="Color.Surface">
Cancel
</MudButton>
</MudStack>
}
}
</MudStack>
</MudDrawer>
@code {
private bool _visible;
public void Toggle()
{
_visible = !_visible;
StateHasChanged();
}
}