LANCommander/LANCommander.Server/UI/Pages/Settings/Library.razor

54 lines
1.7 KiB
Text

@page "/Settings/Library"
@inject IMessageService MessageService
@inject ILogger<Servers> Logger
@attribute [Authorize(Roles = RoleService.AdministratorRoleName)]
<PageHeader Title="Library" />
<PageContent>
<Form Model="Settings" Layout="@FormLayout.Vertical">
<FormItem Label="Enable User Libraries">
<HelpButton>
<Description>
Allows users to manage the games they see in their library. This also enables the Depot!
</Description>
<ChildContent>
<Switch @bind-Checked="Settings.Library.EnableUserLibraries"/>
</ChildContent>
</HelpButton>
</FormItem>
<FormItem Label="Restrict Games By Collection">
<HelpButton>
<Description>
Restricts the games that users can see in their library and the depot based on their role. Visit Settings / Roles to assign collections to roles.
</Description>
<ChildContent>
<Switch @bind-Checked="Settings.Roles.RestrictGamesByCollection"/>
</ChildContent>
</HelpButton>
</FormItem>
<FormItem>
<Button OnClick="Save" Type="@ButtonType.Primary">Save</Button>
</FormItem>
</Form>
</PageContent>
@code {
Settings Settings = SettingService.GetSettings();
void Save()
{
try
{
SettingService.SaveSettings(Settings);
MessageService.Success("Settings saved!");
}
catch (Exception ex)
{
MessageService.Error("An unknown error occurred.");
Logger.LogError(ex, "An unknown error occurred.");
}
}
}