Added custom views

This commit is contained in:
2025-02-01 16:15:28 +01:00
parent bfea4e9cff
commit 2256a59f9a
9 changed files with 246 additions and 47 deletions

View File

@@ -1,28 +1,31 @@
@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>Tables</h2>
<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)) {
<FluentCard Width="350px" Height="200px" Style="display: flex; flex-direction: column; background-color: var(--neutral-layer-1)">
<h3 style="margin-bottom: 0;">@table.DisplayName</h3>
<FluentLabel Typo="Typography.Body" Color="Color.Info" Style="margin-bottom: 0.5rem">@table.ViewPolicy</FluentLabel>
<span>@table.Description</span>
<FluentSpacer />
<div style="display: flex">
<FluentSpacer/>
<a href="@("/admin/" + table.DisplayName.ToLower())" style="display: inline-block">
<FluentButton>Open</FluentButton>
</a>
</div>
</FluentCard>
<HopFrameCard
Title="@table.DisplayName"
Subtitle="@table.ViewPolicy"
Description="@table.Description"
Href="@("/admin/" + table.DisplayName.ToLower())"
Icon="new Icons.Regular.Size24.Database()"/>
}
</FluentStack>
</div>
@@ -33,6 +36,7 @@
@code {
private readonly List<TableConfig> _tables = [];
private readonly List<CustomView> _views = [];
protected override async Task OnInitializedAsync() {
foreach (var table in Explorer.GetTables()) {
@@ -40,6 +44,11 @@
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);
}
}
}