Merge branch 'main' into NewsPage

This commit is contained in:
Daniel Balk
2023-04-12 20:09:30 +02:00
committed by GitHub
7 changed files with 150 additions and 43 deletions

View File

@@ -21,6 +21,8 @@ public class SmartTranslateHelper
foreach (var line in lines) foreach (var line in lines)
{ {
var parts = line.Split(";"); var parts = line.Split(";");
if(!content.ContainsKey(parts[0]))
content.Add(parts[0], parts[1]); content.Add(parts[0], parts[1]);
} }

View File

@@ -52,10 +52,7 @@ else
{ {
receivedExceptions.Add(exception); receivedExceptions.Add(exception);
var user = await IdentityService.Get(); Logger.Error($"An unhanded exception occured:");
var id = user == null ? -1 : user.Id;
Logger.Error($"[{id}] An unhanded exception occured:");
Logger.Error(exception); Logger.Error(exception);
await base.OnErrorAsync(exception); await base.OnErrorAsync(exception);

View File

@@ -100,6 +100,8 @@
{ {
await lazyLoader.SetText(node.Name); await lazyLoader.SetText(node.Name);
try
{
var containerStats = await NodeService.GetContainerStats(node); var containerStats = await NodeService.GetContainerStats(node);
foreach (var container in containerStats.Containers) foreach (var container in containerStats.Containers)
@@ -118,6 +120,11 @@
} }
} }
} }
catch (Exception)
{
// ignored
}
}
} }
private async Task StopAll() private async Task StopAll()

View File

@@ -3,19 +3,16 @@
@using Moonlight.App.Repositories.Domains @using Moonlight.App.Repositories.Domains
@using Moonlight.App.Database.Entities @using Moonlight.App.Database.Entities
@using Microsoft.EntityFrameworkCore @using Microsoft.EntityFrameworkCore
@using BlazorTable
@using Moonlight.App.Services
@using domain = Moonlight.App.Database.Entities.Domain
@inject DomainRepository DomainRepository @inject DomainRepository DomainRepository
@inject DomainService DomainService
@inject SmartTranslateService SmartTranslateService
<LazyLoader Load="Load"> <LazyLoader Load="Load">
@foreach (var domain in domains) @if (Domains.Any())
{
foreach (var domain in Domains)
{ {
<div class="row px-5 mb-5"> <div class="row px-5 mb-5">
<div class="card card-body"> <a href="/domain/@(domain.Id)" class="card card-body">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
@@ -23,29 +20,52 @@
<i class="bx bx-md bx-purchase-tag"></i> <i class="bx bx-md bx-purchase-tag"></i>
</div> </div>
<div class="d-flex justify-content-start flex-column"> <div class="d-flex justify-content-start flex-column">
<a href="/domain/@domain.Id" class="text-gray-800 text-hover-primary mb-1 fs-5">@domain.Name.@domain.SharedDomain.Name</a> <span class="text-gray-800 text-hover-primary mb-1 fs-5">
@(domain.Name)
</span>
<span class="text-gray-400 fw-semibold d-block fs-6">
<span class="text-gray-700">@(domain.SharedDomain.Name)</span>
</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</a>
</div>
}
}
else
{
<div class="alert bg-info d-flex flex-column flex-sm-row w-100 p-5">
<div class="d-flex flex-column pe-0 pe-sm-10">
<h4 class="fw-semibold">
<TL>You have no domains</TL>
</h4>
<span>
<TL>We were not able to find any domains associated with your account</TL>
</span>
</div> </div>
</div> </div>
} }
</LazyLoader> </LazyLoader>
@code { @code {
[CascadingParameter] [CascadingParameter]
public User? User { get; set; } public User? User { get; set; }
private domain[] domains { get; set; } private Domain[] Domains { get; set; }
public async Task Load(LazyLoader loader) private Task Load(LazyLoader loader)
{ {
domains = DomainRepository Domains = DomainRepository
.Get() .Get()
.Include(x => x.SharedDomain) .Include(x => x.SharedDomain)
.Include(x => x.Owner) .Include(x => x.Owner)
.Where(x => x.Owner == User) .Where(x => x.Owner == User)
.ToArray(); .ToArray();
return Task.CompletedTask;
} }
} }

View File

@@ -73,8 +73,15 @@
} }
else else
{ {
<div class="alert alert-info"> <div class="alert bg-info d-flex flex-column flex-sm-row w-100 p-5">
No servers found <div class="d-flex flex-column pe-0 pe-sm-10">
<h4 class="fw-semibold">
<TL>You have no servers</TL>
</h4>
<span>
<TL>We were not able to find any servers associated with your account</TL>
</span>
</div>
</div> </div>
} }
</LazyLoader> </LazyLoader>
@@ -84,8 +91,8 @@
[CascadingParameter] [CascadingParameter]
public User User { get; set; } public User User { get; set; }
private App.Database.Entities.Server[] AllServers; private Server[] AllServers;
private readonly Dictionary<App.Database.Entities.Server, string> StatusCache = new(); private readonly Dictionary<Server, string> StatusCache = new();
private Task Load(LazyLoader arg) private Task Load(LazyLoader arg)
{ {

View File

@@ -1 +1,69 @@
@page "/websites" @page "/websites"
@using Moonlight.App.Database.Entities
@using Moonlight.App.Repositories
@using Microsoft.EntityFrameworkCore
@inject WebsiteRepository WebsiteRepository
<LazyLoader Load="Load">
@if (Websites.Any())
{
foreach (var website in Websites)
{
<div class="row px-5 mb-5">
<a class="card card-body" href="/website/@(website.Id)">
<div class="row">
<div class="col">
<div class="d-flex align-items-center">
<div class="symbol symbol-50px me-3">
<i class="bx bx-md bx-globe"></i>
</div>
<div class="d-flex justify-content-start flex-column">
<span class="text-gray-800 text-hover-primary mb-1 fs-5">
@(website.BaseDomain)
</span>
<span class="text-gray-400 fw-semibold d-block fs-6">
<span class="text-gray-700">@(website.PleskServer.Name)</span>
</span>
</div>
</div>
</div>
</div>
</a>
</div>
}
}
else
{
<div class="alert bg-info d-flex flex-column flex-sm-row w-100 p-5">
<div class="d-flex flex-column pe-0 pe-sm-10">
<h4 class="fw-semibold">
<TL>You have no websites</TL>
</h4>
<span>
<TL>We were not able to find any websites associated with your account</TL>
</span>
</div>
</div>
}
</LazyLoader>
@code
{
[CascadingParameter]
public User User { get; set; }
private Website[] Websites;
private Task Load(LazyLoader lazyLoader)
{
Websites = WebsiteRepository
.Get()
.Include(x => x.Owner)
.Include(x => x.PleskServer)
.Where(x => x.Owner.Id == User.Id)
.ToArray();
return Task.CompletedTask;
}
}

View File

@@ -557,3 +557,9 @@ Saving...;Saving...
Deleting...;Deleting... Deleting...;Deleting...
Delete post;Delete post Delete post;Delete post
Do you really want to delete the post ";Do you really want to delete the post " Do you really want to delete the post ";Do you really want to delete the post "
You have no domains;You have no domains
We were not able to find any domains associated with your account;We were not able to find any domains associated with your account
You have no websites;You have no websites
We were not able to find any websites associated with your account;We were not able to find any websites associated with your account
Guest;Guest
You need a domain;You need a domain