This repository has been archived on 2025-05-14. You can view files and clone it, but cannot push or open issues or pull requests.

50 lines
1.4 KiB
Plaintext

@namespace Oqtane.Modules.Admin.Sites
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IAliasService AliasService
@inject ISiteService SiteService
@if (sites == null)
{
<p><em>Loading...</em></p>
}
else
{
<ActionLink Action="Add" Text="Add Site" />
<Pager Items="@sites">
<Header>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>Name</th>
</Header>
<Row>
<td><NavLink class="btn btn-primary" href="@(scheme + context.Name + "/admin/site")">Edit</NavLink></td>
<td><NavLink class="btn btn-danger" href="@(scheme + context.Name + "/admin/site")">Delete</NavLink></td>
<td><a href="@(scheme + context.Name)">@context.Name</a></td>
</Row>
</Pager>
}
@code {
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
List<Alias> sites;
string scheme;
protected override async Task OnParametersSetAsync()
{
Uri uri = new Uri(NavigationManager.Uri);
scheme = uri.Scheme + "://";
List<Alias> aliases = await AliasService.GetAliasesAsync();
sites = new List<Alias>();
foreach (Alias alias in aliases)
{
if (!sites.Exists(item => item.TenantId == alias.TenantId && item.SiteId == alias.SiteId))
{
sites.Add(alias);
}
}
}
}