added some informations
This commit is contained in:
parent
3270039a6a
commit
7225db0bf1
3 changed files with 9 additions and 1 deletions
|
@ -208,8 +208,13 @@ public class CoreFeature : MoonlightFeature
|
||||||
context.AddSidebarItem("Users", "bxs-group", "/admin/users", needsExactMatch: false, isAdmin: true);
|
context.AddSidebarItem("Users", "bxs-group", "/admin/users", needsExactMatch: false, isAdmin: true);
|
||||||
context.AddSidebarItem("System", "bxs-component", "/admin/sys", needsExactMatch: false, isAdmin: true);
|
context.AddSidebarItem("System", "bxs-component", "/admin/sys", needsExactMatch: false, isAdmin: true);
|
||||||
|
|
||||||
|
// With this function, you can add an Admin Card to the Admin Page
|
||||||
|
// It references the Admin Card, which is a Razor component.
|
||||||
context.AddAdminCard<AdminUserCard>(index: int.MinValue);
|
context.AddAdminCard<AdminUserCard>(index: int.MinValue);
|
||||||
|
|
||||||
|
// Same Thing could be used with the context.AddAdminComponent Function, which then renders the component
|
||||||
|
// under the cards, for fast informations
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class UiInitContext
|
||||||
|
|
||||||
public void AddAdminComponent<T>(int index = 0, int requiredPermissionLevel = 0) where T : IComponent
|
public void AddAdminComponent<T>(int index = 0, int requiredPermissionLevel = 0) where T : IComponent
|
||||||
{
|
{
|
||||||
|
// Loads the Component into a List of AdminComponents, with lots of more information for the Admin Page to render
|
||||||
AdminPageComponents.Add(
|
AdminPageComponents.Add(
|
||||||
new AdminComponent()
|
new AdminComponent()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,7 @@ public class UiInitContext
|
||||||
|
|
||||||
public void AddAdminCard<T>(int index = 0, int requiredPermissionLevel = 0) where T : IComponent
|
public void AddAdminCard<T>(int index = 0, int requiredPermissionLevel = 0) where T : IComponent
|
||||||
{
|
{
|
||||||
|
// Loads the Card into a List of AdminComponents, with lots of more information for the Admin Page to render
|
||||||
AdminPageCards.Add(
|
AdminPageCards.Add(
|
||||||
new AdminComponent()
|
new AdminComponent()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
<div class="row mb-4">
|
<div class="row mb-4">
|
||||||
@foreach (var adminCard in FeatureService.UiContext.AdminPageCards.OrderBy(x => x.Index).ToArray())
|
@foreach (var adminCard in FeatureService.UiContext.AdminPageCards.OrderBy(x => x.Index).ToArray())
|
||||||
{
|
{
|
||||||
|
// basically renders the component if the permissions of the viewed item is lower or equal
|
||||||
|
// to the users permission, -> better developer experience for feature devs
|
||||||
if (IdentityService.CurrentUser.Permissions >= adminCard.RequiredPermissionLevel)
|
if (IdentityService.CurrentUser.Permissions >= adminCard.RequiredPermissionLevel)
|
||||||
{
|
{
|
||||||
<div class="col-12 col-lg-6 col-xl">
|
<div class="col-12 col-lg-6 col-xl">
|
||||||
|
@ -41,6 +43,5 @@
|
||||||
private async Task Load(LazyLoader arg)
|
private async Task Load(LazyLoader arg)
|
||||||
{
|
{
|
||||||
await arg.SetText("Loading Information...");
|
await arg.SetText("Loading Information...");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue