First Nginx push

This commit is contained in:
2020-04-13 23:58:26 +02:00
parent adcd20c09e
commit d5c138fa5a
14 changed files with 166 additions and 19 deletions

View File

@@ -1,7 +1,34 @@
@page "/nginx"
@inherits NginxBase
@page "/nginx"
<h3>Nginx</h3>
@code {
<RadzenTabs>
<Tabs>
<RadzenTabsItem Text="Configuration">
}
<div class="pure-g">
<div class="pure-u-1-5">
<p>Configuration Files</p>
<RadzenListBox AllowFiltering="true"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
@bind-Value="InputSearch"
Data="@ConfigFiles"
TextProperty="Name"
ValueProperty="Name"
Change="@(args => Change(args, "ListBox with filtering"))"
Style="margin-bottom: 20px; height:200px;" />
</div>
<div class="pure-u-4-5">
<h1>
Hello
</h1>
</div>
</div>
</RadzenTabsItem>
<RadzenTabsItem Text="Logs">
</RadzenTabsItem>
</Tabs>
</RadzenTabs>

View File

@@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Components;
using Radzen;
using Radzen.Blazor;
using Seenginx.Models;
using Seenginx.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace Seenginx.Pages
{
public class NginxBase : ComponentBase
{
[Inject]
public INginxService NginxService { get; set; }
public string InputSearch { get; set; }
public List<ConfigFile> ConfigFiles { get; set; } = new List<ConfigFile>();
protected override async Task OnInitializedAsync()
{
ConfigFiles.AddRange(await NginxService.GetFilesAsync());
await base.OnInitializedAsync();
}
protected void Change(object value, string name)
{
var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;
StateHasChanged();
}
}
}

View File

@@ -13,7 +13,7 @@
<link rel="icon" href="~/favicon.png" />
<title>Seenginx</title>
<base href="~/" />
<link rel="stylesheet" href="~/css/side-menu.css" asp-append-version="true" />
<link rel="stylesheet" href="_content/Radzen.Blazor/css/default-base.css">
<environment include="Staging,Production">
<link rel="stylesheet" href="~/css/open-iconic.min.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/pure.min.css" asp-append-version="true" />
@@ -42,6 +42,7 @@
</div>
<script src="_framework/blazor.server.js"></script>
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
<script src="js/modal.js" asp-append-version="true"></script>
</body>
</html>

View File

@@ -4,6 +4,7 @@
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'Ubuntu-Mono';
src: url(/fonts/ubuntumono-regular-webfont.woff2) format('woff2');
@@ -11,15 +12,19 @@
font-style: normal;
}
html{
html {
font-family: Ubuntu, sans-serif;
}
.pure-menu-heading{
.pure-menu-heading {
text-transform: none;
font-family: Ubuntu-Mono,'Noto Mono'
}
.pure-menu-link {
font-family: Ubuntu-Mono,'Noto Mono'
}
.ui-listbox {
display: flex
}

View File

@@ -22,7 +22,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
<PackageReference Include="Radzen.Blazor" Version="2.5.8" />
</ItemGroup>
<ItemGroup>

View File

@@ -6,7 +6,7 @@ namespace Seenginx.Services
{
public interface INginxService
{
Task<IEnumerable<ConfigFile>> GetFiles(NginxFilter filter = null);
Task<IEnumerable<ConfigFile>> GetFilesAsync(NginxFilter filter = null);
Task<Result<bool>> TestNginxConfigurations();
}
}

View File

@@ -8,14 +8,45 @@ namespace Seenginx.Services
{
public class NginxService : INginxService
{
public async Task<IEnumerable<ConfigFile>> GetFiles(NginxFilter filter = null)
public async Task<IEnumerable<ConfigFile>> GetFilesAsync(NginxFilter filter = null)
{
return new List<ConfigFile>();
return new List<ConfigFile>() {
new ConfigFile
{
Folder = "/conf.d",
Name = "matrix.conf",
LastUpdated = DateTime.Now.AddDays(new Random(DateTime.Now.Millisecond).Next(-50,0)),
OriginalBody = "something something",
Owners = new string[]{ "root" },
Permissions = "-drwe-rw-r"
},
new ConfigFile
{
Folder = "/conf.d",
Name = "pleroma.conf",
LastUpdated = DateTime.Now.AddDays(new Random(DateTime.Now.Millisecond).Next(-100,0)),
OriginalBody = "something something 2",
Owners = new string[]{ "root", "void" },
Permissions = "-drwe-rw-r"
},
new ConfigFile
{
Folder = "/conf.d",
Name = "ghost.conf",
LastUpdated = DateTime.Now.AddDays(new Random(DateTime.Now.Millisecond).Next(-25,0)),
OriginalBody = "something something 3",
Owners = new string[]{ "root" },
Permissions = "-drwe-rw-r",
CanBeDeleted = false
}
};
}
public async Task<Result<bool>> TestNginxConfigurations()
{
return new Result<bool>();
var result = new Result<bool>();
result.SetData(true);
return result;
}
}
}

View File

@@ -7,3 +7,6 @@
@using Microsoft.JSInterop
@using Seenginx
@using Seenginx.Shared
@using Radzen
@using Radzen.Blazor