18 lines
740 B
Text
18 lines
740 B
Text
@page "/Games/{id:guid}/Scripts"
|
|
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
|
|
|
|
<GameEditView Id="Id" Title="Scripts">
|
|
<ScriptEditor GameId="context.Id" ArchiveId="@GetLatestArchiveId(context)" AllowedTypes="new[] { ScriptType.Install, ScriptType.Uninstall, ScriptType.NameChange, ScriptType.KeyChange, ScriptType.BeforeStart, ScriptType.AfterStop }" />
|
|
</GameEditView>
|
|
|
|
@code {
|
|
[Parameter] public Guid Id { get; set; }
|
|
|
|
private Guid GetLatestArchiveId(Game game)
|
|
{
|
|
if (game != null && game.Archives != null && game.Archives.Count > 0)
|
|
return game.Archives.OrderByDescending(a => a.CreatedOn).FirstOrDefault()?.Id ?? Guid.Empty;
|
|
else
|
|
return Guid.Empty;
|
|
}
|
|
}
|