Merge pull request #48 from Moonlight-Panel/RemoveLegacyDatabaseUI

Removed legacy database ui
This commit is contained in:
Marcel Baumgartner 2023-04-06 19:21:12 +02:00 committed by GitHub
commit e483bb7ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 88 deletions

View file

@ -52,14 +52,6 @@ else
<span class="menu-title"><TL>Websites</TL></span>
</a>
</div>
<div class="menu-item">
<a class="menu-link" href="/databases">
<span class="menu-icon">
<i class="bx bx-data"></i>
</span>
<span class="menu-title"><TL>Databases</TL></span>
</a>
</div>
<div class="menu-item">
<a class="menu-link" href="/domains">
<span class="menu-icon">

View file

@ -1,9 +1,12 @@
@page "/admin"
@using Moonlight.App.Repositories.Servers
@using Moonlight.App.Repositories
@using Moonlight.App.Repositories.Domains
@inject ServerRepository ServerRepository
@inject UserRepository UserRepository
@inject WebsiteRepository WebsiteRepository
@inject DomainRepository DomainRepository
<OnlyAdmin>
<LazyLoader Load="Load">
@ -38,7 +41,7 @@
<TL>Websites</TL>
</h6>
<span class="h2 mb-0">
0
@(WebsiteCount)
</span>
</div>
<div class="col-auto">
@ -50,27 +53,6 @@
</div>
</a>
</div>
<div class="col-12 col-lg-6 col-xl">
<div class="mt-4 card" href="/databases">
<div class="card-body">
<div class="row align-items-center gx-0">
<div class="col">
<h6 class="text-uppercase text-muted mb-2">
<TL>Databases</TL>
</h6>
<span class="h2 mb-0">
@(DatabaseCount)
</span>
</div>
<div class="col-auto">
<span class="h2 text-muted mb-0">
<i class="text-primary bx bx-data bx-lg"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 col-xl">
<a class="mt-4 card" href="/domains">
<div class="card-body">
@ -80,7 +62,7 @@
<TL>Domains</TL>
</h6>
<span class="h2 mb-0">
0
@(DomainCount)
</span>
</div>
<div class="col-auto">
@ -119,15 +101,17 @@
@code
{
private int DatabaseCount = 0;
private int ServerCount = 0;
private int UserCount = 0;
private int DomainCount = 0;
private int WebsiteCount = 0;
private Task Load(LazyLoader lazyLoader)
{
DatabaseCount = 0;
ServerCount = ServerRepository.Get().Count();
UserCount = UserRepository.Get().Count();
DomainCount = DomainRepository.Get().Count();
WebsiteCount = WebsiteRepository.Get().Count();
return Task.CompletedTask;
}

View file

@ -3,8 +3,12 @@
@using Moonlight.App.Repositories.Servers
@using Microsoft.EntityFrameworkCore
@using Moonlight.App.Database.Entities
@using Moonlight.App.Repositories
@using Moonlight.App.Repositories.Domains
@inject ServerRepository ServerRepository
@inject WebsiteRepository WebsiteRepository
@inject DomainRepository DomainRepository
<LazyLoader Load="Load">
<div class="row mb-5">
@ -38,7 +42,7 @@
<TL>Websites</TL>
</h6>
<span class="h2 mb-0">
0
@(WebsiteCount)
</span>
</div>
<div class="col-auto">
@ -50,27 +54,6 @@
</div>
</a>
</div>
<div class="col-12 col-lg-6 col-xl">
<div class="mt-4 card" href="/databases">
<div class="card-body">
<div class="row align-items-center gx-0">
<div class="col">
<h6 class="text-uppercase text-muted mb-2">
<TL>Databases</TL>
</h6>
<span class="h2 mb-0">
@(DatabaseCount)
</span>
</div>
<div class="col-auto">
<span class="h2 text-muted mb-0">
<i class="text-primary bx bx-data bx-lg"></i>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 col-xl">
<a class="mt-4 card" href="/domains">
<div class="card-body">
@ -80,7 +63,7 @@
<TL>Domains</TL>
</h6>
<span class="h2 mb-0">
0
@(DomainCount)
</span>
</div>
<div class="col-auto">
@ -119,20 +102,6 @@
</div>
</div>
<div class="separator mb-2 mt-2"></div>
<div class="d-flex align-items-center">
<div class="symbol symbol-50px me-3">
<i class="bx bx-md bx-data"></i>
</div>
<div class="d-flex justify-content-start flex-column">
<a href="/databases/create" class="text-gray-800 text-hover-primary mb-1 fs-5">
<TL>Create a database</TL>
</a>
<span class="text-gray-400 fw-semibold d-block fs-6">
<TL>A quick way to store your data and manage it from all around the world</TL>
</span>
</div>
</div>
<div class="separator mb-2 mt-2"></div>
<div class="d-flex align-items-center">
<div class="symbol symbol-50px me-3">
<i class="bx bx-md bx-globe"></i>
@ -188,20 +157,6 @@
</div>
</div>
<div class="separator mb-2 mt-2"></div>
<div class="d-flex align-items-center">
<div class="symbol symbol-50px me-3">
<i class="bx bx-md bx-data"></i>
</div>
<div class="d-flex justify-content-start flex-column">
<a href="/databases" class="text-gray-800 text-hover-primary mb-1 fs-5">
<TL>Manage your databases</TL>
</a>
<span class="text-gray-400 fw-semibold d-block fs-6">
<TL>Insert, delete and update the data in your databases</TL>
</span>
</div>
</div>
<div class="separator mb-2 mt-2"></div>
<div class="d-flex align-items-center">
<div class="symbol symbol-50px me-3">
<i class="bx bx-md bx-globe"></i>
@ -239,16 +194,27 @@
[CascadingParameter]
public User User { get; set; }
private int DatabaseCount = 0;
private int ServerCount = 0;
private int DomainCount = 0;
private int WebsiteCount = 0;
private async Task Load(LazyLoader lazyLoader)
private Task Load(LazyLoader lazyLoader)
{
DatabaseCount = 0;
ServerCount = ServerRepository
.Get()
.Include(x => x.Owner)
.Count(x => x.Owner.Id == User.Id);
DomainCount = DomainRepository
.Get()
.Include(x => x.Owner)
.Count(x => x.Owner.Id == User.Id);
WebsiteCount = WebsiteRepository
.Get()
.Include(x => x.Owner)
.Count(x => x.Owner.Id == User.Id);
return Task.CompletedTask;
}
}