[CHANGE] Reworked ExtendedBackgroundService.cs with State logic and actions
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
<PageTitle>Services</PageTitle>
|
||||
|
||||
<MudDataGrid T="ExtendedBackgroundService" Items="@_backgroundServices" Filterable QuickFilter="@QuickFilter">
|
||||
<MudDataGrid T="ExtendedBackgroundService" Items="@_backgroundServices" Filterable QuickFilter="@QuickFilter" Dense>
|
||||
<ToolBarContent>
|
||||
<MudText Typo="Typo.h6">Services</MudText>
|
||||
<MudSpacer/>
|
||||
@@ -20,16 +20,19 @@
|
||||
<PropertyColumn Property="x => x.Description" Title="Description"/>
|
||||
<PropertyColumn Property="x => x.State" Title="Status"/>
|
||||
<PropertyColumn Property="x => x.ExecuteInterval" Title="Execute interval"/>
|
||||
<TemplateColumn>
|
||||
<TemplateColumn Title="Actions">
|
||||
<CellTemplate>
|
||||
<MudStack Row Spacing="2">
|
||||
<MudButton Disabled="@(context.Item?.State == ServiceState.Paused)"
|
||||
OnClick="@(() => { context.Item?.Pause(); })" Variant="Variant.Outlined">Pause
|
||||
</MudButton>
|
||||
<MudButton Disabled="@(context.Item?.State == ServiceState.Running)"
|
||||
OnClick="@(() => { context.Item?.Resume(); })" Variant="Variant.Outlined">Resume
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
<MudMenu Icon="@Icons.Material.Filled.MoreVert"
|
||||
AriaLabel="Actions">
|
||||
@foreach (var action in context.Item?.Actions ?? [])
|
||||
{
|
||||
<MudMenuItem OnClick="@action.Action" Disabled="@(!action.IsEnabled())">
|
||||
<MudTooltip Text="@action.Description">
|
||||
<span>@action.Id</span>
|
||||
</MudTooltip>
|
||||
</MudMenuItem>
|
||||
}
|
||||
</MudMenu>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
|
||||
Reference in New Issue
Block a user