Many more updates and cleanups
This commit is contained in:
parent
234a0e28cd
commit
f2cc603195
@ -1,12 +1,5 @@
|
||||
@inherits FileItemBase
|
||||
|
||||
<a class="level">
|
||||
<div class="level-left">
|
||||
<div class="level-item">
|
||||
<p class="is-size-7"><sub>@File.Folder</sub></p>
|
||||
<p class="@(File.CanBeDeleted ? "has-text-danger" : null)">
|
||||
@File.Name
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a>
|
||||
<p class="subtitle is-6"><sub>@File.Folder</sub></p>
|
||||
<h6 class="title is-6 @(File.CanBeDeleted ? null : "has-text-danger")">@File.Name</h6>
|
||||
</a>
|
||||
|
@ -49,6 +49,14 @@ namespace Seenginx.Components
|
||||
[Parameter]
|
||||
public CFile SelectedFile { get; set; }
|
||||
|
||||
protected async override Task OnInitializedAsync()
|
||||
{
|
||||
SelectedFilter = Filters.First();
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
protected async Task OnDeselectClick()
|
||||
{
|
||||
SelectedFile = null;
|
||||
@ -94,31 +102,27 @@ namespace Seenginx.Components
|
||||
{
|
||||
if (SelectedFilter == "All")
|
||||
Files.ForEach(f => { if (f.Name.ToLower().Contains(SearchInput)) f.Unhide(); else f.Hide(); });
|
||||
else if (SelectedFilter == "Root")
|
||||
Files.ForEach(f =>
|
||||
{
|
||||
if (f.Folder == FilterFolder[SelectedFilter])
|
||||
f.Unhide();
|
||||
else
|
||||
f.Hide();
|
||||
});
|
||||
else
|
||||
Files.ForEach(f =>
|
||||
{
|
||||
if (f.Folder.Contains(FilterFolder[SelectedFilter]))
|
||||
f.Unhide();
|
||||
if (SelectedFilter == "Root")
|
||||
{
|
||||
if (f.Folder == FilterFolder[SelectedFilter] && f.Folder.ToLower().Contains(SearchInput.ToLower()))
|
||||
f.Unhide();
|
||||
else
|
||||
f.Hide();
|
||||
}
|
||||
else
|
||||
f.Hide();
|
||||
{
|
||||
Files.ForEach(f =>
|
||||
{
|
||||
if (f.Folder.Contains(FilterFolder[SelectedFilter]) && f.Folder.ToLower().Contains(SearchInput.ToLower()))
|
||||
f.Unhide();
|
||||
else
|
||||
f.Hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
//Files.ForEach(f => f.Unhide());
|
||||
//else
|
||||
// Files.ForEach(f =>
|
||||
// {
|
||||
// if (f.Name.ToLower().Contains(searchInput.ToLower()))
|
||||
// f.Unhide();
|
||||
// else
|
||||
// f.Hide();
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
</DeleteDialog>
|
||||
<Editor>
|
||||
|
||||
<p>Qualcosa</p>
|
||||
</Editor>
|
||||
</FilesWithEditor>
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Radzen;
|
||||
using Radzen.Blazor;
|
||||
using Seenginx.Models;
|
||||
using Seenginx.Services;
|
||||
using System;
|
||||
@ -28,12 +26,12 @@ namespace Seenginx.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfigFiles.AddRange(await NginxService.GetFilesAsync());
|
||||
Filters.AddRange(new List<string> { "All", "Root", "Conf.d", "Enabled", "Disabled" });
|
||||
Filters.AddRange(new List<string> { "All", "Root", "Conf.d", "Available", "Enabled" });
|
||||
FilterFolder.Add("All", null);
|
||||
FilterFolder.Add("Root", "/");
|
||||
FilterFolder.Add("Conf.d", "/conf.d");
|
||||
FilterFolder.Add("Available", "/sites-available");
|
||||
FilterFolder.Add("Enabled", "/sites-enabled");
|
||||
FilterFolder.Add("Disabled", "/sites-disabled");
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
@inherits NginxLogsBase
|
||||
@page "/nginx/logs"
|
||||
@page "/nginxlogs"
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Radzen;
|
||||
using Radzen.Blazor;
|
||||
using Seenginx.Models;
|
||||
using Seenginx.Services;
|
||||
using System;
|
||||
|
@ -42,6 +42,6 @@
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
<script src="_content/Radzen.Blazor/Radzen.Blazor.js"></script>
|
||||
<script src="_content/Blazorise/blazorise.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -24,3 +24,8 @@ html {
|
||||
.menu-list li a {
|
||||
font-family: Ubuntu-Mono,'Noto Mono'
|
||||
}
|
||||
|
||||
.menu-list a.active {
|
||||
background-color: #3273dc;
|
||||
color: #fff;
|
||||
}
|
@ -18,9 +18,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazorise.Bulma" Version="0.9.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.3" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="2.5.8" />
|
||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -6,7 +6,7 @@ namespace Seenginx.Services
|
||||
{
|
||||
public interface INginxService
|
||||
{
|
||||
Task<IEnumerable<ConfigFile>> GetFilesAsync(NginxFilter filter = null);
|
||||
Task<IEnumerable<ConfigFile>> GetFilesAsync();
|
||||
Task<Result<bool>> TestNginxConfigurations();
|
||||
}
|
||||
}
|
13
Seenginx/Services/Models/ConfigPaths.cs
Normal file
13
Seenginx/Services/Models/ConfigPaths.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Seenginx.Services.Models
|
||||
{
|
||||
public class ConfigPaths
|
||||
{
|
||||
public string NginxPath { get; set; }
|
||||
public string SystemDPath { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
using Seenginx.Models;
|
||||
using Seenginx.Services.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -8,38 +10,72 @@ namespace Seenginx.Services
|
||||
{
|
||||
public class NginxService : INginxService
|
||||
{
|
||||
public async Task<IEnumerable<ConfigFile>> GetFilesAsync(NginxFilter filter = null)
|
||||
private readonly ConfigPaths ConfigPaths;
|
||||
|
||||
public NginxService(ConfigPaths configPaths)
|
||||
{
|
||||
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
|
||||
}
|
||||
};
|
||||
ConfigPaths = configPaths;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IEnumerable<ConfigFile>> GetFilesAsync()
|
||||
{
|
||||
var rootConfigs = Directory.GetFiles(ConfigPaths.NginxPath, "*.conf");
|
||||
var confdConfigs = Directory.GetFiles(Path.Combine(ConfigPaths.NginxPath, "conf.d"), "*.conf");
|
||||
var sitesAvailableConfigs = Directory.GetFiles(Path.Combine(ConfigPaths.NginxPath, "sites-available"), "*.conf");
|
||||
var sitesEnabledConfigs = Directory.GetFiles(Path.Combine(ConfigPaths.NginxPath, "sites-enabled"), "*.conf");
|
||||
|
||||
var rootConfigFiles = rootConfigs.Select(fp =>
|
||||
{
|
||||
var fileName = Path.GetFileName(fp);
|
||||
var configFile = new ConfigFile();
|
||||
configFile.CanBeDeleted = fileName != "nginx.conf";
|
||||
configFile.Folder = "/";
|
||||
configFile.LastUpdated = File.GetLastWriteTime(fp);
|
||||
configFile.Name = fileName;
|
||||
configFile.OriginalBody = File.ReadAllText(fp);
|
||||
return configFile;
|
||||
});
|
||||
var confdConfigFiles = confdConfigs.Select(fp =>
|
||||
{
|
||||
var fileName = Path.GetFileName(fp);
|
||||
var configFile = new ConfigFile();
|
||||
configFile.CanBeDeleted = true;
|
||||
configFile.Folder = "/conf.d";
|
||||
configFile.LastUpdated = File.GetLastWriteTime(fp);
|
||||
configFile.Name = fileName;
|
||||
configFile.OriginalBody = File.ReadAllText(fp);
|
||||
return configFile;
|
||||
});
|
||||
var sitesAvailableConfigFiles = sitesAvailableConfigs.Select(fp =>
|
||||
{
|
||||
var fileName = Path.GetFileName(fp);
|
||||
var configFile = new ConfigFile();
|
||||
configFile.CanBeDeleted = true;
|
||||
configFile.Folder = "/sites-available";
|
||||
configFile.LastUpdated = File.GetLastWriteTime(fp);
|
||||
configFile.Name = fileName;
|
||||
configFile.OriginalBody = File.ReadAllText(fp);
|
||||
return configFile;
|
||||
});
|
||||
var sitesEnabledConfigFiles = sitesEnabledConfigs.Select(fp =>
|
||||
{
|
||||
var fileName = Path.GetFileName(fp);
|
||||
var configFile = new ConfigFile();
|
||||
configFile.CanBeDeleted = true;
|
||||
configFile.Folder = "/sites-enabled";
|
||||
configFile.LastUpdated = File.GetLastWriteTime(fp);
|
||||
configFile.Name = fileName;
|
||||
configFile.OriginalBody = File.ReadAllText(fp);
|
||||
return configFile;
|
||||
});
|
||||
var finalList = new List<ConfigFile>();
|
||||
finalList.AddRange(rootConfigFiles);
|
||||
finalList.AddRange(confdConfigFiles);
|
||||
finalList.AddRange(sitesAvailableConfigFiles);
|
||||
finalList.AddRange(sitesEnabledConfigFiles);
|
||||
|
||||
return finalList;
|
||||
}
|
||||
|
||||
public async Task<Result<bool>> TestNginxConfigurations()
|
||||
|
@ -22,10 +22,10 @@
|
||||
</NavLink>
|
||||
</li>
|
||||
<li>
|
||||
<NavLink href="/nginx/logs" class="petiteCaps"
|
||||
<NavLink href="/nginxlogs" class="petiteCaps"
|
||||
@key="@ActiveNav.Keys.ElementAt(1)"
|
||||
ActiveClass="@ActiveNav.GetValueOrDefault("nginx/logs")"
|
||||
@onclick="@(e => SelectMenuItem("nginx/logs"))">
|
||||
ActiveClass="@ActiveNav.GetValueOrDefault("nginxlogs")"
|
||||
@onclick="@(e => SelectMenuItem("nginxlogs"))">
|
||||
<span class="mdi mdi-information-outline"></span>
|
||||
Logs
|
||||
</NavLink>
|
||||
@ -46,10 +46,10 @@
|
||||
</NavLink>
|
||||
</li>
|
||||
<li>
|
||||
<NavLink href="/systemd/logs" class="petiteCaps"
|
||||
<NavLink href="/systemdlogs" class="petiteCaps"
|
||||
@key="@ActiveNav.Keys.ElementAt(3)"
|
||||
ActiveClass="@ActiveNav.GetValueOrDefault("systemd/logs")"
|
||||
@onclick="@(e => SelectMenuItem("systemd/logs"))">
|
||||
ActiveClass="@ActiveNav.GetValueOrDefault("systemdlogs")"
|
||||
@onclick="@(e => SelectMenuItem("systemdlogs"))">
|
||||
<span class="mdi mdi-information-outline"></span>
|
||||
Logs
|
||||
</NavLink>
|
||||
|
@ -16,9 +16,9 @@ namespace Seenginx.Shared
|
||||
ActiveNav = new Dictionary<string, string>
|
||||
{
|
||||
{ "nginx", null },
|
||||
{ "nginx/logs", null },
|
||||
{ "nginxlogs", null },
|
||||
{ "systemd", null },
|
||||
{ "systemd/logs", null },
|
||||
{ "systemdlogs", null },
|
||||
{ "dmesg", null }
|
||||
};
|
||||
await base.OnInitializedAsync();
|
||||
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Blazorise;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@ -9,6 +10,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Seenginx.Services;
|
||||
using Seenginx.Services.Models;
|
||||
|
||||
namespace Seenginx
|
||||
{
|
||||
@ -31,6 +33,15 @@ namespace Seenginx
|
||||
#endif
|
||||
;
|
||||
services.AddServerSideBlazor();
|
||||
services.AddBlazorise(options =>
|
||||
{
|
||||
options.ChangeTextOnKeyPress = true; // optional
|
||||
});
|
||||
var configPaths = new ConfigPaths();
|
||||
configPaths.NginxPath = @"C:\nginx\";
|
||||
configPaths.SystemDPath = @"C:\systemd\system\";
|
||||
|
||||
services.AddSingleton(configPaths);
|
||||
services.AddTransient<IDmesgService, DmesgService>();
|
||||
services.AddTransient<INginxService, NginxService>();
|
||||
services.AddTransient<ISystemDService, SystemDService>();
|
||||
|
@ -9,4 +9,6 @@
|
||||
@using Seenginx.Shared
|
||||
@using Seenginx.Models
|
||||
@using Seenginx.Components
|
||||
@using Blazorise
|
||||
@using Blazorise.Bulma
|
||||
|
||||
|
@ -88,6 +88,10 @@ html {
|
||||
.menu-list li a {
|
||||
font-family: Ubuntu-Mono,'Noto Mono'; }
|
||||
|
||||
.menu-list a.active {
|
||||
background-color: #3273dc;
|
||||
color: #fff; }
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
2
Seenginx/wwwroot/css/main.min.css
vendored
2
Seenginx/wwwroot/css/main.min.css
vendored
@ -1 +1 @@
|
||||
#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.isHidden{display:none;}@media only screen and (max-width:37.5em){.isHiddenMobile{display:none;}}.petiteCaps{font-variant:petite-caps;}.flexCenter{display:flex;align-content:center;align-items:center;}.isNoWrap{white-space:nowrap;}.isFinger{cursor:pointer;}.neomorph{box-shadow:-8px -8px 16px rgba(251,238,208,.5),8px 8px 16px rgba(241,185,65,.5);}.neomorphSmall{box-shadow:-6px -6px 12px rgba(251,238,208,.5),6px 6px 12px rgba(241,185,65,.5);}.neomorphBottom{filter:drop-shadow(8px 8px 14px #f1b941);}.gradientBackground{background:linear-gradient(to right bottom,#f7d794,#f5cd79);}.borderR{border-radius:14px;}.borderRSmall{border-radius:7px;}.borderRBig{border-radius:28px;}.bg{background:#f6d287;}.sameMarginBottom{margin-bottom:1rem !important;}@font-face{font-family:'Ubuntu';src:url(/fonts/ubuntu-light-webfont.woff2) format("woff2");font-weight:300;font-style:normal;}@font-face{font-family:'Ubuntu-Mono';src:url(/fonts/ubuntumono-regular-webfont.woff2) format("woff2");font-style:normal;}html{font-family:Ubuntu,sans-serif;}.pure-menu-heading{text-transform:none;font-family:Ubuntu-Mono,'Noto Mono';}.menu-list li a{font-family:Ubuntu-Mono,'Noto Mono';}.main{display:flex;flex-wrap:nowrap;align-items:start;width:100%;height:100vh;padding:2.5%;}.mainNav{overflow-y:auto;padding:14px;width:17%;margin-right:40px;}.mainPage{overflow-y:auto;padding:28px;width:calc(83% - 40px);align-self:stretch;}.files{display:flex;flex-direction:column;align-items:stretch;}.filesWithEditor{display:flex;align-items:stretch;height:100%;}.files .buttons{justify-content:space-between;align-items:stretch;}.filesList{height:100%;overflow-y:auto;}
|
||||
#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.isHidden{display:none;}@media only screen and (max-width:37.5em){.isHiddenMobile{display:none;}}.petiteCaps{font-variant:petite-caps;}.flexCenter{display:flex;align-content:center;align-items:center;}.isNoWrap{white-space:nowrap;}.isFinger{cursor:pointer;}.neomorph{box-shadow:-8px -8px 16px rgba(251,238,208,.5),8px 8px 16px rgba(241,185,65,.5);}.neomorphSmall{box-shadow:-6px -6px 12px rgba(251,238,208,.5),6px 6px 12px rgba(241,185,65,.5);}.neomorphBottom{filter:drop-shadow(8px 8px 14px #f1b941);}.gradientBackground{background:linear-gradient(to right bottom,#f7d794,#f5cd79);}.borderR{border-radius:14px;}.borderRSmall{border-radius:7px;}.borderRBig{border-radius:28px;}.bg{background:#f6d287;}.sameMarginBottom{margin-bottom:1rem !important;}@font-face{font-family:'Ubuntu';src:url(/fonts/ubuntu-light-webfont.woff2) format("woff2");font-weight:300;font-style:normal;}@font-face{font-family:'Ubuntu-Mono';src:url(/fonts/ubuntumono-regular-webfont.woff2) format("woff2");font-style:normal;}html{font-family:Ubuntu,sans-serif;}.pure-menu-heading{text-transform:none;font-family:Ubuntu-Mono,'Noto Mono';}.menu-list li a{font-family:Ubuntu-Mono,'Noto Mono';}.menu-list a.active{background-color:#3273dc;color:#fff;}.main{display:flex;flex-wrap:nowrap;align-items:start;width:100%;height:100vh;padding:2.5%;}.mainNav{overflow-y:auto;padding:14px;width:17%;margin-right:40px;}.mainPage{overflow-y:auto;padding:28px;width:calc(83% - 40px);align-self:stretch;}.files{display:flex;flex-direction:column;align-items:stretch;}.filesWithEditor{display:flex;align-items:stretch;height:100%;}.files .buttons{justify-content:space-between;align-items:stretch;}.filesList{height:100%;overflow-y:auto;}
|
Loading…
Reference in New Issue
Block a user