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 IMessageService MessageService
<Row>
<Col Span="8">
<Statistic Title="Available" Value="Keys.Count - AllocatedKeys" Style="text-align: center;" />
</Col>
<Col Span="8">
<Statistic Title="Allocated" Value="AllocatedKeys" Style="text-align: center;" />
</Col>
<Col Span="8">
<Statistic Title="Total" Value="Keys.Count" Style="text-align: center;" />
</Col>
</Row>
@if (Keys != null)
{
<GridRow>
<GridCol Span="8">
<Statistic Title="Available" Value="Keys.Count - AllocatedKeys" Style="text-align: center;" />
</GridCol>
<GridCol Span="8">
<Statistic Title="Allocated" Value="AllocatedKeys" Style="text-align: center;" />
</GridCol>
<GridCol Span="8">
<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">
<Table TItem="Key" DataSource="@Keys" Bordered>
<PropertyColumn Property="k => k.Value">
<InputPassword @bind-Value="@context.Value" />
</PropertyColumn>
<PropertyColumn Property="k => k.AllocationMethod" />
<Column TData="string">
@switch (context.AllocationMethod)
{
case KeyAllocationMethod.MacAddress:
<text>@context.ClaimedByMacAddress</text>
break;
<Modal Title="View Keys" Visible="ViewModalVisible" Maximizable="false" DefaultMaximized="true" OnCancel="() => ViewModalVisible = false" OnOk="() => ViewModalVisible = false">
<Table TItem="Key" DataSource="@Keys" Bordered>
<PropertyColumn Property="k => k.Value">
<InputPassword @bind-Value="@context.Value" />
</PropertyColumn>
<PropertyColumn Property="k => k.AllocationMethod" />
<Column TData="string">
@switch (context.AllocationMethod)
{
case KeyAllocationMethod.MacAddress:
<text>@context.ClaimedByMacAddress</text>
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>
.monaco-editor-container {

View file

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