First Nginx push

This commit is contained in:
Eugene ;) 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,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.3" />
<PackageReference Include="Radzen.Blazor" Version="2.5.8" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,3 @@
@*<RadzenTabs>
</RadzenTabs>*@

View File

@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Seenginx.Components
{
public class TabsBase : ComponentBase
{
}
}

View File

@ -0,0 +1,3 @@
@using Microsoft.AspNetCore.Components.Web
@*@using Radzen*@
@*@using Radzen.Blazor*@

View File

@ -6,5 +6,15 @@ namespace Seenginx.Models
{
public class ConfigFile
{
public string Folder { get; set; }
public string Name { get; set; }
public bool HasDraft => !string.IsNullOrEmpty(DraftName);
public string DraftName { get; set; }
public string OriginalBody { get; set; }
public string ChangedBody { get; set; }
public DateTime LastUpdated { get; set; }
public string[] Owners { get; set; }
public string Permissions { get; set; }
public bool CanBeDeleted { get; set; } = true;
}
}

View File

@ -5,9 +5,9 @@ VisualStudioVersion = 16.0.30002.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seenginx", "Seenginx\Seenginx.csproj", "{9F66F64D-D4A5-452B-ADC6-78ABA9DB3431}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seenginx.Components", "Seenginx.Components\Seenginx.Components.csproj", "{C19AA62F-F324-4FFD-A2FF-19B03766ADA1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seenginx.Models", "Seenginx.Models\Seenginx.Models.csproj", "{DF2CB075-2A33-4EAE-BB1C-7DEDA0D84A9D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seenginx.Models", "Seenginx.Models\Seenginx.Models.csproj", "{DF2CB075-2A33-4EAE-BB1C-7DEDA0D84A9D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seenginx.Components", "Seenginx.Components\Seenginx.Components.csproj", "{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -19,14 +19,14 @@ Global
{9F66F64D-D4A5-452B-ADC6-78ABA9DB3431}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F66F64D-D4A5-452B-ADC6-78ABA9DB3431}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F66F64D-D4A5-452B-ADC6-78ABA9DB3431}.Release|Any CPU.Build.0 = Release|Any CPU
{C19AA62F-F324-4FFD-A2FF-19B03766ADA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C19AA62F-F324-4FFD-A2FF-19B03766ADA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C19AA62F-F324-4FFD-A2FF-19B03766ADA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C19AA62F-F324-4FFD-A2FF-19B03766ADA1}.Release|Any CPU.Build.0 = Release|Any CPU
{DF2CB075-2A33-4EAE-BB1C-7DEDA0D84A9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF2CB075-2A33-4EAE-BB1C-7DEDA0D84A9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF2CB075-2A33-4EAE-BB1C-7DEDA0D84A9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF2CB075-2A33-4EAE-BB1C-7DEDA0D84A9D}.Release|Any CPU.Build.0 = Release|Any CPU
{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

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