Added website dash, files, ftp, databases, ssl. added plesk online check, did some renamming and stuff . Fixed some things

This commit is contained in:
Marcel Baumgartner
2023-04-06 00:14:15 +02:00
parent c20d59e29b
commit 46f544b5f8
46 changed files with 3825 additions and 54 deletions

View File

@@ -36,6 +36,13 @@
wingsException.Message
);
}
else if (exception is PleskException pleskException)
{
await AlertService.Error(
SmartTranslateService.Translate("Error from plesk"),
pleskException.Message
);
}
else
{
throw exception;

View File

@@ -35,12 +35,7 @@ else
{
if (Confirm)
{
var b = await AlertService.YesNo(
SmartTranslateService.Translate("Are you sure?"),
SmartTranslateService.Translate("Do you really want to delete it?"),
SmartTranslateService.Translate("Yes"),
SmartTranslateService.Translate("No")
);
var b = await AlertService.ConfirmMath();
if (b)
{

View File

@@ -0,0 +1,22 @@
<div class="card mb-5 mb-xl-10">
<div class="card-body pt-0 pb-0">
<ul class="nav nav-stretch nav-line-tabs nav-line-tabs-2x border-transparent fs-5 fw-bold">
<li class="nav-item mt-2">
<a class="nav-link text-active-primary ms-0 me-10 py-5 @(Index == 0 ? "active" : "")" href="/admin/websites">
<TL>Websites</TL>
</a>
</li>
<li class="nav-item mt-2">
<a class="nav-link text-active-primary ms-0 me-10 py-5 @(Index == 1 ? "active" : "")" href="/admin/websites/servers">
<TL>Plesk servers</TL>
</a>
</li>
</ul>
</div>
</div>
@code
{
[Parameter]
public int Index { get; set; } = 0;
}

View File

@@ -155,32 +155,13 @@ else
</div>
</div>
</div>
<div data-kt-menu-trigger="click" class="menu-item menu-accordion">
<span class="menu-link">
<div class="menu-item">
<a class="menu-link" href="/admin/websites">
<span class="menu-icon">
<i class="bx bx-cube"></i>
<i class="bx bx-globe"></i>
</span>
<span class="menu-title"><TL>aaPanel</TL></span>
<span class="menu-arrow"></span>
</span>
<div class="menu-sub menu-sub-accordion">
<div class="menu-item">
<a class="menu-link" href="/admin/aapanel/">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span class="menu-title"><TL>Overview</TL></span>
</a>
</div>
<div class="menu-item">
<a class="menu-link" href="/admin/aapanel/databases">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span class="menu-title"><TL>Databases</TL></span>
</a>
</div>
</div>
<span class="menu-title"><TL>Websites</TL></span>
</a>
</div>
<div class="menu-item">
<a class="menu-link" href="/admin/users">

View File

@@ -0,0 +1,101 @@
@using Moonlight.App.Database.Entities
@using Moonlight.App.Services
@inject WebsiteService WebsiteService
@inject SmartTranslateService SmartTranslateService
<div class="row gy-5 g-xl-10">
<div class="col-xl-4 mb-xl-10">
<div class="card h-md-100">
<div class="card-body d-flex flex-column flex-center">
<img class="img-fluid" src="https://image.thum.io/get/http://@(CurrentWebsite.BaseDomain)" alt="Website screenshot"/>
</div>
</div>
</div>
<div class="col-xl-8 mb-5 mb-xl-10">
<div class="card card-flush h-xl-100">
<div class="card-body pt-2">
<LazyLoader Load="Load">
<div class="row mt-5">
<div class="card border">
<div class="card-header">
<span class="card-title"><TL>SSL certificates</TL></span>
</div>
<div class="card-body">
@if (Certs.Any())
{
<table class="table align-middle gs-0 gy-3">
<thead>
<tr>
<th class="p-0 w-50px"></th>
<th class="p-0 min-w-150px"></th>
<th class="p-0 min-w-120px"></th>
</tr>
</thead>
<tbody>
@foreach (var cert in Certs)
{
<tr>
<td>
<div class="symbol symbol-50px me-2">
<span class="symbol-label">
<i class="bx bx-md bx-receipt text-dark"></i>
</span>
</div>
</td>
<td>
<span class="text-dark fw-bold fs-6">@(cert)</span>
</td>
<td class="text-end">
<WButton Text="@(SmartTranslateService.Translate("Use"))"
WorkingText="@(SmartTranslateService.Translate("Working"))"
CssClasses="btn btn-light"
OnClick="() => UseCertificate(cert)">
</WButton>
<WButton Text="@(SmartTranslateService.Translate("Delete"))"
WorkingText="@(SmartTranslateService.Translate("Working"))"
CssClasses="btn btn-danger"
OnClick="() => DeleteCertificate(cert)">
</WButton>
</td>
</tr>
}
</tbody>
</table>
}
else
{
<div class="alert alert-warning">
<TL>No SSL certificate found</TL>
</div>
}
</div>
</div>
</div>
</LazyLoader>
</div>
</div>
</div>
</div>
@code
{
[CascadingParameter]
public Website CurrentWebsite { get; set; }
private string[] Certs;
private async Task Load(LazyLoader lazyLoader)
{
await lazyLoader.SetText("Loading certificates");
Certs = await WebsiteService.GetSslCertificates(CurrentWebsite);
}
private async Task UseCertificate(string name)
{
}
private async Task DeleteCertificate(string name)
{
}
}

View File

@@ -0,0 +1,24 @@
@using Moonlight.App.Database.Entities
@using Moonlight.App.Helpers.Files
@using Moonlight.App.Services
@using Moonlight.Shared.Components.FileManagerPartials
@inject WebsiteService WebsiteService
<LazyLoader Load="Load">
<FileManager Access="Access">
</FileManager>
</LazyLoader>
@code
{
[CascadingParameter]
public Website CurrentWebsite { get; set; }
private FileAccess Access;
private async Task Load(LazyLoader arg)
{
Access = await WebsiteService.CreateFileAccess(CurrentWebsite);
}
}

View File

@@ -0,0 +1,64 @@
@using Moonlight.App.Database.Entities
@using Moonlight.App.Services
@inject WebsiteService WebsiteService
<div class="card card-flush h-xl-100">
<div class="card-body pt-2">
<LazyLoader Load="Load">
<div class="mt-7 row fv-row mb-7">
<div class="col-md-3 text-md-start">
<label class="fs-6 fw-semibold form-label mt-3">
<TL>Ftp Host</TL>
</label>
</div>
<div class="col-md-9">
<input type="text" class="form-control form-control-solid disabled" disabled="disabled" value="@(FtpHost)">
</div>
</div>
<div class="row fv-row mb-7">
<div class="col-md-3 text-md-start">
<label class="fs-6 fw-semibold form-label mt-3">
<TL>Ftp Port</TL>
</label>
</div>
<div class="col-md-9">
<input type="text" class="form-control form-control-solid disabled" disabled="disabled" value="21">
</div>
</div>
<div class="row fv-row mb-7">
<div class="col-md-3 text-md-start">
<label class="fs-6 fw-semibold form-label mt-3">
<TL>Ftp Username</TL>
</label>
</div>
<div class="col-md-9">
<input type="text" class="form-control form-control-solid disabled" disabled="disabled" value="@(Website.FtpLogin)">
</div>
</div>
<div class="row fv-row mb-7">
<div class="col-md-3 text-md-start">
<label class="fs-6 fw-semibold form-label mt-3">
<TL>Ftp Password</TL>
</label>
</div>
<div class="col-md-9">
<input type="text" class="form-control form-control-solid disabled blur-unless-hover" disabled="disabled" value="@(Website.FtpPassword)">
</div>
</div>
</LazyLoader>
</div>
</div>
@code
{
[CascadingParameter]
public Website Website { get; set; }
private string FtpHost = "N/A";
private async Task Load(LazyLoader arg)
{
FtpHost = await WebsiteService.GetHost(Website.PleskServer);
}
}

View File

@@ -0,0 +1,57 @@
@using Moonlight.App.Database.Entities
<div class="card card-body me-6">
<div class="row">
<div class="col-8">
<div class="d-flex align-items-center">
<div class="symbol symbol-circle me-5">
<div class="symbol-label bg-transparent text-primary border border-secondary border-dashed">
<i class="bx bx-globe bx-md"></i>
</div>
</div>
<div class="d-flex flex-column">
<div class="mb-1 fs-4">@(Website.BaseDomain)</div>
<div class="text-muted fs-5">@(Website.PleskServer.Name)</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="separator my-5"></div>
</div>
<div class="card mb-5 mb-xl-10">
<div class="card-body pt-0 pb-0">
<ul class="nav nav-stretch nav-line-tabs nav-line-tabs-2x border-transparent fs-5 fw-bold">
<li class="nav-item mt-2">
<a class="nav-link text-active-primary ms-0 me-10 py-5 @(Index == 0 ? "active" : "")" href="/website/@(Website.Id)">
<TL>Dashboard</TL>
</a>
</li>
<li class="nav-item mt-2">
<a class="nav-link text-active-primary ms-0 me-10 py-5 @(Index == 1 ? "active" : "")" href="/website/@(Website.Id)/files">
<TL>Files</TL>
</a>
</li>
<li class="nav-item mt-2">
<a class="nav-link text-active-primary ms-0 me-10 py-5 @(Index == 2 ? "active" : "")" href="/website/@(Website.Id)/ftp">
<TL>Ftp</TL>
</a>
</li>
<li class="nav-item mt-2">
<a class="nav-link text-active-primary ms-0 me-10 py-5 @(Index == 3 ? "active" : "")" href="/website/@(Website.Id)/databases">
<TL>Databases</TL>
</a>
</li>
</ul>
</div>
</div>
@code
{
[Parameter]
public int Index { get; set; }
[Parameter]
public Website Website { get; set; }
}

View File

@@ -1,12 +1,10 @@
@page "/admin/servers/new"
@using Moonlight.App.Repositories
@using Moonlight.App.Repositories.Servers
@using Moonlight.App.Database.Entities
@using Moonlight.App.Services
@using Microsoft.EntityFrameworkCore
@using Moonlight.App.Exceptions
@using Moonlight.App.Services.Interop
@using Moonlight.App.Services.Sessions
@using Logging.Net
@using Blazored.Typeahead

View File

@@ -0,0 +1,93 @@
@page "/admin/websites/"
@using Moonlight.Shared.Components.Navigations
@using Moonlight.App.Services
@using Moonlight.App.Database.Entities
@using Moonlight.App.Repositories
@using Microsoft.EntityFrameworkCore
@using BlazorTable
@inject SmartTranslateService SmartTranslateService
@inject WebsiteRepository WebsiteRepository
@inject WebsiteService WebsiteService
<OnlyAdmin>
<AdminWebsitesNavigation Index="0"/>
<div class="card">
<div class="card-header border-0 pt-5">
<h3 class="card-title align-items-start flex-column">
<span class="card-label fw-bold fs-3 mb-1">
<TL>Websites</TL>
</span>
</h3>
<div class="card-toolbar">
<a href="/admin/websites/new" class="btn btn-sm btn-light-success">
<i class="bx bx-user-plus"></i>
<TL>New website</TL>
</a>
</div>
</div>
<div class="card-body">
<LazyLoader @ref="LazyLoader" Load="Load">
<div class="table-responsive">
<Table TableItem="Website" Items="Websites" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
<Column TableItem="Website" Title="@(SmartTranslateService.Translate("Id"))" Field="@(x => x.Id)" Sortable="true" Filterable="true"/>
<Column TableItem="Website" Title="@(SmartTranslateService.Translate("Base domain"))" Field="@(x => x.BaseDomain)" Sortable="true" Filterable="true">
<Template>
<a href="/website/@(context.Id)/">
@(context.BaseDomain)
</a>
</Template>
</Column>
<Column TableItem="Website" Title="@(SmartTranslateService.Translate("Owner"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
<Template>
<a href="/admin/users/view/@(context.Owner.Id)">
@(context.Owner.Email)
</a>
</Template>
</Column>
<Column TableItem="Website" Title="@(SmartTranslateService.Translate("Plesk server"))" Field="@(x => x.PleskServer.Id)" Sortable="true" Filterable="true">
<Template>
<a href="/admin/websites/servers/edit/@(context.PleskServer.Id)/">
@(context.PleskServer.Name)
</a>
</Template>
</Column>
<Column TableItem="Website" Title="@(SmartTranslateService.Translate("Manage"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
<Template>
<DeleteButton Confirm="true" OnClick="() => Delete(context)">
</DeleteButton>
</Template>
</Column>
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
</Table>
</div>
</LazyLoader>
</div>
</div>
</OnlyAdmin>
@code
{
private LazyLoader LazyLoader;
private Website[] Websites;
private Task Load(LazyLoader lazyLoader)
{
Websites = WebsiteRepository
.Get()
.Include(x => x.Owner)
.Include(x => x.PleskServer)
.ToArray();
return Task.CompletedTask;
}
private async Task Delete(Website website)
{
await WebsiteService.Delete(website);
await LazyLoader.Reload();
}
}

View File

@@ -0,0 +1,79 @@
@page "/admin/websites/new"
@using Moonlight.App.Models.Forms
@using Moonlight.App.Services
@using Blazored.Typeahead
@using Moonlight.App.Database.Entities
@using Moonlight.App.Repositories
@inject WebsiteService WebsiteService
@inject UserRepository UserRepository
@inject NavigationManager NavigationManager
<OnlyAdmin>
<div class="card card-body p-10">
<LazyLoader Load="Load">
<SmartForm Model="Model" OnValidSubmit="OnValidSubmit">
<label class="form-label">
<TL>Base domain</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.BaseDomain" class="form-control"></InputText>
</div>
<label class="form-label">
<TL>Owner</TL>
</label>
<div class="input-group mb-5">
<BlazoredTypeahead SearchMethod="SearchUsers"
@bind-Value="Model.User">
<SelectedTemplate>
@(context.Email)
</SelectedTemplate>
<ResultTemplate>
@(context.Email)
</ResultTemplate>
</BlazoredTypeahead>
</div>
<div>
<button type="submit" class="btn btn-primary float-end">
<TL>Create</TL>
</button>
</div>
</SmartForm>
</LazyLoader>
</div>
</OnlyAdmin>
@code
{
private WebsiteAdminDataModel Model = new();
private User[] Users;
private async Task OnValidSubmit()
{
await WebsiteService.Create(Model.BaseDomain, Model.User);
NavigationManager.NavigateTo("/admin/websites");
}
private Task Load(LazyLoader arg)
{
Users = UserRepository
.Get()
.ToArray();
return Task.CompletedTask;
}
private Task<IEnumerable<User>> SearchUsers(string input)
{
if (string.IsNullOrEmpty(input))
{
return Task.FromResult(Array.Empty<User>().Cast<User>());
}
else
{
return Task.FromResult(Users.Where(x => x.Email.ToLower().StartsWith(input)));
}
}
}

View File

@@ -0,0 +1,98 @@
@page "/admin/websites/servers/edit/{Id:int}"
@using Moonlight.App.Models.Forms
@using Moonlight.App.Repositories
@using Moonlight.App.Database.Entities
@inject PleskServerRepository PleskServerRepository
@inject NavigationManager NavigationManager
<OnlyAdmin>
<LazyLoader Load="Load">
@if (PleskServer == null)
{
<div class="d-flex justify-content-center flex-center">
<div class="card">
<img src="/assets/media/svg/nodata.svg" class="card-img-top w-50 mx-auto pt-5" alt="Not found image"/>
<div class="card-body text-center">
<h1 class="card-title">
<TL>Plesk server not found</TL>
</h1>
<p class="card-text fs-4">
<TL>A plesk server with that id cannot be found</TL>
</p>
</div>
</div>
</div>
}
else
{
<div class="card card-body p-10">
<SmartForm Model="Model" OnValidSubmit="OnValidSubmit">
<label class="form-label">
<TL>Name</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.Name" class="form-control"></InputText>
</div>
<label class="form-label">
<TL>Api Url</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.ApiUrl" class="form-control"></InputText>
</div>
<label class="form-label">
<TL>Api Key</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.ApiKey" class="blur-unless-hover form-control"></InputText>
</div>
<div>
<button type="submit" class="btn btn-primary float-end">
<TL>Save</TL>
</button>
</div>
</SmartForm>
</div>
}
</LazyLoader>
</OnlyAdmin>
@code
{
[Parameter]
public int Id { get; set; }
private PleskServer? PleskServer;
private PleskServerDataModel Model = new();
private Task OnValidSubmit()
{
PleskServer!.Name = Model.Name;
PleskServer.ApiUrl = Model.ApiUrl;
PleskServer.ApiKey = Model.ApiKey;
PleskServerRepository.Update(PleskServer);
NavigationManager.NavigateTo("/admin/websites/servers");
return Task.CompletedTask;
}
private Task Load(LazyLoader arg)
{
PleskServer = PleskServerRepository
.Get()
.FirstOrDefault(x => x.Id == Id);
if (PleskServer != null)
{
Model.Name = PleskServer.Name;
Model.ApiUrl = PleskServer.ApiUrl;
Model.ApiKey = PleskServer.ApiKey;
}
return Task.CompletedTask;
}
}

View File

@@ -0,0 +1,115 @@
@page "/admin/websites/servers"
@using Moonlight.Shared.Components.Navigations
@using Moonlight.App.Services
@using Moonlight.App.Repositories
@using Moonlight.App.Database.Entities
@using BlazorTable
@inject SmartTranslateService SmartTranslateService
@inject PleskServerRepository PleskServerRepository
@inject WebsiteService WebsiteService
<OnlyAdmin>
<AdminWebsitesNavigation Index="1"/>
<div class="card">
<div class="card-header border-0 pt-5">
<h3 class="card-title align-items-start flex-column">
<span class="card-label fw-bold fs-3 mb-1">
<TL>Plesk servers</TL>
</span>
</h3>
<div class="card-toolbar">
<a href="/admin/websites/servers/new" class="btn btn-sm btn-light-success">
<i class="bx bx-user-plus"></i>
<TL>New plesk server</TL>
</a>
</div>
</div>
<div class="card-body">
<LazyLoader @ref="LazyLoader" Load="Load">
<div class="table-responsive">
<Table TableItem="PleskServer" Items="PleskServers" PageSize="25" TableClass="table table-row-bordered table-row-gray-100 align-middle gs-0 gy-3" TableHeadClass="fw-bold text-muted">
<Column TableItem="PleskServer" Title="@(SmartTranslateService.Translate("Id"))" Field="@(x => x.Id)" Sortable="true" Filterable="true"/>
<Column TableItem="PleskServer" Title="@(SmartTranslateService.Translate("Name"))" Field="@(x => x.Name)" Sortable="true" Filterable="true"/>
<Column TableItem="PleskServer" Title="@(SmartTranslateService.Translate("Api url"))" Field="@(x => x.ApiUrl)" Sortable="true" Filterable="true"/>
<Column TableItem="PleskServer" Title="@(SmartTranslateService.Translate("Status"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
<Template>
@if (OnlineCache.ContainsKey(context))
{
if (OnlineCache[context])
{
<span class="text-success">
<TL>Online</TL>
</span>
}
else
{
<span class="text-danger">
<TL>Offline</TL>
</span>
}
}
else
{
<span class="text-muted">
<TL>Loading</TL>
</span>
}
</Template>
</Column>
<Column TableItem="PleskServer" Title="@(SmartTranslateService.Translate("Edit"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
<Template>
<a href="/admin/websites/servers/edit/@(context.Id)/">
<TL>Manage</TL>
</a>
</Template>
</Column>
<Column TableItem="PleskServer" Title="@(SmartTranslateService.Translate("Manage"))" Field="@(x => x.Id)" Sortable="false" Filterable="false">
<Template>
<DeleteButton Confirm="true" OnClick="() => OnClick(context)">
</DeleteButton>
</Template>
</Column>
<Pager ShowPageNumber="true" ShowTotalCount="true"/>
</Table>
</div>
</LazyLoader>
</div>
</div>
</OnlyAdmin>
@code
{
private PleskServer[] PleskServers;
private LazyLoader LazyLoader;
private Dictionary<PleskServer, bool> OnlineCache = new();
private Task Load(LazyLoader arg)
{
PleskServers = PleskServerRepository
.Get()
.ToArray();
Task.Run(async () =>
{
foreach (var pleskServer in PleskServers)
{
OnlineCache.Add(pleskServer, await WebsiteService.IsHostUp(pleskServer));
await InvokeAsync(StateHasChanged);
}
});
return Task.CompletedTask;
}
private async Task OnClick(PleskServer pleskServer)
{
PleskServerRepository.Delete(pleskServer);
await LazyLoader.Reload();
}
}

View File

@@ -0,0 +1,55 @@
@page "/admin/websites/servers/new"
@using Moonlight.App.Repositories
@using Moonlight.App.Models.Forms
@inject PleskServerRepository PleskServerRepository
@inject NavigationManager NavigationManager
<OnlyAdmin>
<div class="card card-body p-10">
<SmartForm Model="Model" OnValidSubmit="OnValidSubmit">
<label class="form-label">
<TL>Name</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.Name" class="form-control"></InputText>
</div>
<label class="form-label">
<TL>Api Url</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.ApiUrl" class="form-control"></InputText>
</div>
<label class="form-label">
<TL>Api Key</TL>
</label>
<div class="input-group mb-5">
<InputText @bind-Value="Model.ApiKey" class="form-control"></InputText>
</div>
<div>
<button type="submit" class="btn btn-primary float-end">
<TL>Create</TL>
</button>
</div>
</SmartForm>
</div>
</OnlyAdmin>
@code
{
private PleskServerDataModel Model = new();
private Task OnValidSubmit()
{
PleskServerRepository.Add(new()
{
Name = Model.Name,
ApiUrl = Model.ApiUrl,
ApiKey = Model.ApiKey
});
NavigationManager.NavigateTo("/admin/websites/servers");
return Task.CompletedTask;
}
}

View File

@@ -17,7 +17,7 @@
@inject ServerRepository ServerRepository
@inject WingsConsoleHelper WingsConsoleHelper
@inject MessageService MessageService
@inject NodeService NodeService
@inject ServerService ServerService
@inject NavigationManager NavigationManager
@implements IDisposable
@@ -227,31 +227,23 @@
.Include(x => x.MainAllocation)
.Include(x => x.Owner)
.First(x => x.Uuid == uuid);
if (CurrentServer.Owner.Id != User!.Id && !User.Admin)
CurrentServer = null;
}
catch (Exception)
{
// ignored
}
if (CurrentServer != null)
{
if (CurrentServer.Owner.Id != User!.Id && !User.Admin)
CurrentServer = null;
}
if (CurrentServer != null)
{
await lazyLoader.SetText("Checking node online status");
try
{
//TODO: Implement status caching
var data = await NodeService.GetStatus(CurrentServer.Node);
if (data != null)
NodeOnline = true;
}
catch (Exception)
{
// ignored
}
NodeOnline = await ServerService.IsHostUp(CurrentServer);
if (NodeOnline)
{

View File

@@ -0,0 +1,129 @@
@page "/website/{Id:int}/{Route?}"
@using Moonlight.App.Database.Entities
@using Moonlight.App.Repositories
@using Moonlight.App.Services
@using Moonlight.Shared.Components.WebsiteControl
@using Microsoft.EntityFrameworkCore
@inject WebsiteRepository WebsiteRepository
@inject WebsiteService WebsiteService
<LazyLoader Load="Load">
@if (CurrentWebsite == null)
{
<div class="d-flex justify-content-center flex-center">
<div class="card">
<img src="/assets/media/svg/nodata.svg" class="card-img-top w-50 mx-auto pt-5" alt="Not found image"/>
<div class="card-body text-center">
<h1 class="card-title">
<TL>Website not found</TL>
</h1>
<p class="card-text fs-4">
<TL>A website with that id cannot be found or you have no access for this server</TL>
</p>
</div>
</div>
</div>
}
else
{
if (HostOnline)
{
<CascadingValue Value="CurrentWebsite">
@{
var index = 0;
switch (Route)
{
case "files":
index = 1;
break;
case "ftp":
index = 2;
break;
case "databases":
index = 3;
break;
default:
index = 0;
break;
}
<WebsiteNavigation Index="index" Website="CurrentWebsite" />
@switch (Route)
{
case "files":
<WebsiteFiles />
break;
case "ftp":
<WebsiteFtp />
break;
case "databases":
break;
default:
<WebsiteDashboard />
break;
}
}
</CascadingValue>
}
else
{
<div class="d-flex justify-content-center flex-center">
<div class="card">
<img src="/assets/media/svg/serverdown.svg" class="card-img-top w-50 mx-auto pt-5" alt="Not found image"/>
<div class="card-body text-center">
<h1 class="card-title">
<TL>Host system offline</TL>
</h1>
<p class="card-text fs-4">
<TL>The host system the website is running on is currently offline</TL>
</p>
</div>
</div>
</div>
}
}
</LazyLoader>
@code
{
[Parameter]
public int Id { get; set; }
[Parameter]
public string? Route { get; set; }
[CascadingParameter]
public User User { get; set; }
private Website? CurrentWebsite;
private bool HostOnline = false;
private async Task Load(LazyLoader lazyLoader)
{
CurrentWebsite = WebsiteRepository
.Get()
.Include(x => x.PleskServer)
.Include(x => x.Owner)
.FirstOrDefault(x => x.Id == Id);
if (CurrentWebsite != null)
{
if (CurrentWebsite.Owner.Id != User!.Id && !User.Admin)
CurrentWebsite = null;
}
if (CurrentWebsite != null)
{
await lazyLoader.SetText("Checking host system online status");
HostOnline = await WebsiteService.IsHostUp(CurrentWebsite);
if (HostOnline)
{
}
}
}
}

View File

@@ -0,0 +1 @@
@page "/websites"

View File

@@ -0,0 +1 @@
@page "/websites/new"