Fix keys editor blocking render after save of new game. Do full page redirect after adding game. Fixes #13

This commit is contained in:
Pat Hartl 2023-04-02 13:37:05 -05:00
parent 44644b7ac9
commit b28f4f78b1
2 changed files with 50 additions and 45 deletions

View file

@ -1,53 +1,58 @@
@inject KeyService KeyService @inject KeyService KeyService
@inject IMessageService MessageService @inject IMessageService MessageService
<Row> @if (Keys != null)
<Col Span="8"> {
<Statistic Title="Available" Value="Keys.Count - AllocatedKeys" Style="text-align: center;" /> <GridRow>
</Col> <GridCol Span="8">
<Col Span="8"> <Statistic Title="Available" Value="Keys.Count - AllocatedKeys" Style="text-align: center;" />
<Statistic Title="Allocated" Value="AllocatedKeys" Style="text-align: center;" /> </GridCol>
</Col> <GridCol Span="8">
<Col Span="8"> <Statistic Title="Allocated" Value="AllocatedKeys" Style="text-align: center;" />
<Statistic Title="Total" Value="Keys.Count" Style="text-align: center;" /> </GridCol>
</Col> <GridCol Span="8">
</Row> <Statistic Title="Total" Value="Keys.Count" Style="text-align: center;" />
</GridCol>
</GridRow>
<Modal Title="View Keys" Visible="ViewModalVisible" Maximizable="false" DefaultMaximized="true" OnCancel="() => ViewModalVisible = false" OnOk="() => ViewModalVisible = false"> <Modal Title="View Keys" Visible="ViewModalVisible" Maximizable="false" DefaultMaximized="true" OnCancel="() => ViewModalVisible = false" OnOk="() => ViewModalVisible = false">
<Table TItem="Key" DataSource="@Keys" Bordered> <Table TItem="Key" DataSource="@Keys" Bordered>
<PropertyColumn Property="k => k.Value"> <PropertyColumn Property="k => k.Value">
<InputPassword @bind-Value="@context.Value" /> <InputPassword @bind-Value="@context.Value" />
</PropertyColumn> </PropertyColumn>
<PropertyColumn Property="k => k.AllocationMethod" /> <PropertyColumn Property="k => k.AllocationMethod" />
<Column TData="string"> <Column TData="string">
@switch (context.AllocationMethod) @switch (context.AllocationMethod)
{ {
case KeyAllocationMethod.MacAddress: case KeyAllocationMethod.MacAddress:
<text>@context.ClaimedByMacAddress</text> <text>@context.ClaimedByMacAddress</text>
break; break;
case KeyAllocationMethod.UserAccount:
<text>@context.ClaimedByUser?.UserName</text>
break;
}
</Column>
<PropertyColumn Property="g => g.ClaimedOn" Format="MM/dd/yyyy hh:mm tt" Sortable />
<ActionColumn Title="">
<Space>
<SpaceItem>
@if (context.IsAllocated())
{
<Button OnClick="() => Release(context)">Release</Button>
}
</SpaceItem>
</Space>
</ActionColumn>
</Table>
</Modal>
<Modal Title="Edit Keys" Visible="EditModalVisible" Maximizable="false" DefaultMaximized="true" OnCancel="() => EditModalVisible = false" OnOk="Save">
<StandaloneCodeEditor @ref="Editor" Id="editor" ConstructionOptions="EditorConstructionOptions" />
</Modal>
}
case KeyAllocationMethod.UserAccount:
<text>@context.ClaimedByUser?.UserName</text>
break;
}
</Column>
<PropertyColumn Property="g => g.ClaimedOn" Format="MM/dd/yyyy hh:mm tt" Sortable />
<ActionColumn Title="">
<Space>
<SpaceItem>
@if (context.IsAllocated())
{
<Button OnClick="() => Release(context)">Release</Button>
}
</SpaceItem>
</Space>
</ActionColumn>
</Table>
</Modal>
<Modal Title="Edit Keys" Visible="EditModalVisible" Maximizable="false" DefaultMaximized="true" OnCancel="() => EditModalVisible = false" OnOk="Save">
<StandaloneCodeEditor @ref="Editor" Id="editor" ConstructionOptions="EditorConstructionOptions" />
</Modal>
<style> <style>
.monaco-editor-container { .monaco-editor-container {

View file

@ -197,7 +197,7 @@
await MessageService.Success("Game added!"); await MessageService.Success("Game added!");
NavigationManager.NavigateTo($"/Games/{Game.Id}/Edit"); NavigationManager.NavigateTo($"/Games/{Game.Id}/Edit", true);
} }
} }
catch (Exception ex) catch (Exception ex)