54 lines
1.6 KiB
Plaintext
54 lines
1.6 KiB
Plaintext
@page "/admin"
|
|
@using HopFrame.Core.Config
|
|
@using HopFrame.Core.Services
|
|
@using HopFrame.Web.Models
|
|
@layout HopFrameLayout
|
|
|
|
<PageTitle>HopFrame</PageTitle>
|
|
|
|
<div style="padding: 1.5rem 1.5rem;">
|
|
<h2>Pages</h2>
|
|
|
|
<FluentStack Orientation="Orientation.Horizontal" Wrap="true" Style="margin-top: 1.5rem">
|
|
@foreach (var view in _views) {
|
|
<HopFrameCard
|
|
Title="@view.Name"
|
|
Subtitle="@view.Policy"
|
|
Description="@view.Description"
|
|
Href="@view.Url"
|
|
Icon="HopFrameSideMenu.GetLinkIcon(view, IconVariant.Regular)"/>
|
|
}
|
|
|
|
@foreach (var table in _tables.OrderBy(t => t.Order)) {
|
|
<HopFrameCard
|
|
Title="@table.DisplayName"
|
|
Subtitle="@table.ViewPolicy"
|
|
Description="@table.Description"
|
|
Href="@("/admin/" + table.DisplayName.ToLower())"
|
|
Icon="new Icons.Regular.Size24.Database()"/>
|
|
}
|
|
</FluentStack>
|
|
</div>
|
|
|
|
@inject IContextExplorer Explorer
|
|
@inject IHopFrameAuthHandler Handler
|
|
|
|
@code {
|
|
|
|
private readonly List<TableConfig> _tables = [];
|
|
private readonly List<CustomView> _views = [];
|
|
|
|
protected override async Task OnInitializedAsync() {
|
|
foreach (var table in Explorer.GetTables()) {
|
|
if (table.Ignored) continue;
|
|
if (!await Handler.IsAuthenticatedAsync(table.ViewPolicy)) continue;
|
|
_tables.Add(table);
|
|
}
|
|
|
|
foreach (var view in HopFrameLayout.CustomViews) {
|
|
if (!await Handler.IsAuthenticatedAsync(view.Policy)) continue;
|
|
_views.Add(view);
|
|
}
|
|
}
|
|
|
|
} |