Introduction of the template FilesWithEditor

This commit is contained in:
thepra committed 2020-04-16 00:49:34 +02:00
1 parent 0af8f20db1
commit c584733ab1
23 files changed
+31565 -48

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
@inherits FileItemBase
+16
View File
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Components;
using Seenginx.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace Seenginx.Components
{
public class FileItemBase : ComponentBase
{
[Parameter]
public ConfigFile File { get; set; }
}
}
+65
View File
@@ -0,0 +1,65 @@
@typeparam CFile
<div class="tile is-ancestor">
<div class="tile is-parent is-vertical is-3">
<div class="content">
<p>
@foreach (var filter in Filters)
{
<span class="tag is-light">@filter</span>
}
</p>
</div>
<div class="content">
<div class="field">
<div class="control">
<InputText Value="SearchInput" ValueChanged="OnSearchChanged" class="input is-primary" type="text" placeholder="Search..." />
</div>
</div>
</div>
<div class="content">
<aside class="menu">
<ul class="menu-list">
@foreach (var file in Files)
{
<li>
<FileItem File="file" @onclick="OnFileClick(file)"></FileItem>
</li>
}
<li><a>Dashboard</a></li>
<li><a>Customers</a></li>
</ul>
</aside>
</div>
<div class="content">
<div class="buttons has-addons">
<button class="button is-primary">
<span class="icon is-small">
<i class="mdi mdi-plus-box-outline"></i>
</span>
Add
</button>
<button class="button is-warning">
<span class="icon is-small">
<i class="mdi mdi-pencil-box-outline"></i>
</span>
Update
</button>
<button class="button is-danger">
<span class="icon is-small">
<i class="mdi mdi-minus-box-outline"></i>
</span>
Delete
</button>
</div>
</div>
</div>
<div class="tile is-parent is-vertical is-9">
@Editor
</div>
</div>
@@ -0,0 +1,87 @@
using Microsoft.AspNetCore.Components;
using Seenginx.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Seenginx.Components
{
public partial class FilesWithEditor<CFile> : ComponentBase
where CFile : ConfigFile
{
[Parameter]
public List<CFile> Files { get; set; } = new List<CFile>();
[Parameter]
public List<string> Filters { get; set; } = new List<string>();
[Parameter]
public List<int> FilteredOutFiles { get; set; } = new List<int>();
[Parameter]
public EventCallback<string> ApplyFilter { get; set; }
[Parameter]
public RenderFragment<CFile> Editor { get; set; }
[Parameter]
public RenderFragment<CFile> CreateDialog { get; set; }
[Parameter]
public RenderFragment<CFile> UpdateDialog { get; set; }
[Parameter]
public RenderFragment<CFile> DeleteDialog { get; set; }
protected bool IsAnyFileSelected => SelectedFile != default;
private CFile SelectedFile { get; set; }
protected string SearchInput { get; set; }
protected async Task OnDeselectClick()
{
SelectedFile = null;
//Clean on the right
}
protected async Task OnFilterClick(EventArgs e, string filter)
{
await ApplyFilter.InvokeAsync(filter);
for (int index = 0; index < Files.Count; index++)
if (FilteredOutFiles.Contains(index))
Files[index].Hide();
else
Files[index].Unhide();
}
protected async Task OnSearchChanged()
{
if (string.IsNullOrEmpty(SearchInput))
Files.ForEach(f => f.Hide());
else
Files.ForEach(f =>
{
if (f.Name.ToLower().Contains(SearchInput.ToLower()))
f.Unhide();
else
f.Hide();
});
}
protected async Task OnFileClick(CFile file)
{
SelectedFile = file;
}
protected async Task OnCreateFile()
{
}
protected async Task OnUpdateDialog(CFile file)
{
}
protected async Task OnDeleteDialog(CFile file)
{
}
}
}
@@ -14,7 +14,7 @@
<ItemGroup>
<Folder Include="wwwroot\" />
<ProjectReference Include="..\Seenginx.Models\Seenginx.Models.csproj" />
</ItemGroup>
</Project>
+1 -2
View File
@@ -1,3 +1,2 @@
@using Microsoft.AspNetCore.Components.Web
@*@using Radzen*@
@*@using Radzen.Blazor*@
@using Microsoft.AspNetCore.Components.Forms
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
/*! bulma.io v0.8.2 | MIT License | github.com/jgthms/bulma */@-webkit-keyframes spinAround{from{transform:rotate(0)}to{transform:rotate(359deg)}}@keyframes spinAround{from{transform:rotate(0)}to{transform:rotate(359deg)}}.breadcrumb,.button,.delete,.file,.is-unselectable,.modal-close,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.tabs{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.navbar-link:not(.is-arrowless)::after,.select:not(.is-multiple):not(.is-loading)::after{border:3px solid transparent;border-radius:2px;border-right:0;border-top:0;content:" ";display:block;height:.625em;margin-top:-.4375em;pointer-events:none;position:absolute;top:50%;transform:rotate(-45deg);transform-origin:center;width:.625em}.block:not(:last-child),.box:not(:last-child),.breadcrumb:not(:last-child),.content:not(:last-child),.highlight:not(:last-child),.level:not(:last-child),.list:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.pagination:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.table-container:not(:last-child),.table:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:1.5rem}.delete,.modal-close{-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:290486px;cursor:pointer;pointer-events:auto;display:inline-block;flex-grow:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px}.delete::after,.delete::before,.modal-close::after,.modal-close::before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) rotate(45deg);transform-origin:center center}.delete::before,.modal-close::before{height:2px;width:50%}.delete::after,.modal-close::after{height:50%;width:2px}.delete:focus,.delete:hover,.modal-close:focus,.modal-close:hover{background-color:rgba(10,10,10,.3)}.delete:active,.modal-close:active{background-color:rgba(10,10,10,.4)}.is-small.delete,.is-small.modal-close{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.is-medium.delete,.is-medium.modal-close{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.is-large.delete,.is-large.modal-close{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.button.is-loading::after,.control.is-loading::after,.loader,.select.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:290486px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em}.hero-video,.image.is-16by9 .has-ratio,.image.is-16by9 img,.image.is-1by1 .has-ratio,.image.is-1by1 img,.image.is-1by2 .has-ratio,.image.is-1by2 img,.image.is-1by3 .has-ratio,.image.is-1by3 img,.image.is-2by1 .has-ratio,.image.is-2by1 img,.image.is-2by3 .has-ratio,.image.is-2by3 img,.image.is-3by1 .has-ratio,.image.is-3by1 img,.image.is-3by2 .has-ratio,.image.is-3by2 img,.image.is-3by4 .has-ratio,.image.is-3by4 img,.image.is-3by5 .has-ratio,.image.is-3by5 img,.image.is-4by3 .has-ratio,.image.is-4by3 img,.image.is-4by5 .has-ratio,.image.is-4by5 img,.image.is-5by3 .has-ratio,.image.is-5by3 img,.image.is-5by4 .has-ratio,.image.is-5by4 img,.image.is-9by16 .has-ratio,.image.is-9by16 img,.image.is-square .has-ratio,.image.is-square img,.is-overlay,.modal,.modal-background{bottom:0;left:0;position:absolute;right:0;top:0}.button,.file-cta,.file-name,.input,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none;align-items:center;border:1px solid transparent;border-radius:4px;box-shadow:none;display:inline-flex;font-size:1rem;height:2.5em;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.5em - 1px);padding-left:calc(.75em - 1px);padding-right:calc(.75em - 1px);padding-top:calc(.5em - 1px);position:relative;vertical-align:top}.button:active,.button:focus,.file-cta:active,.file-cta:focus,.file-name:active,.file-name:focus,.input:active,.input:focus,.is-active.button,.is-active.file-cta,.is-active.file-name,.is-active.input,.is-active.pagination-ellipsis,.is-active.pagination-link,.is-active.pagination-next,.is-active.pagination-previous,.is-active.textarea,.is-focused.button,.is-focused.file-cta,.is-focused.file-name,.is-focused.input,.is-focused.pagination-ellipsis,.is-focused.pagination-link,.is-focused.pagination-next,.is-focused.pagination-previous,.is-focused.textarea,.pagination-ellipsis:active,.pagination-ellipsis:focus,.pagination-link:active,.pagination-link:focus,.pagination-next:active,.pagination-next:focus,.pagination-previous:active,.pagination-previous:focus,.select select.is-active,.seleLine truncated
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,3 @@
@font-face{font-family:"Material Design Icons";src:url("../fonts/materialdesignicons-webfont.eot?v=5.0.45");src:url("../fonts/materialdesignicons-webfont.eot?#iefix&v=5.0.45") format("embedded-opentype"),url("../fonts/materialdesignicons-webfont.woff2?v=5.0.45") format("woff2"),url("../fonts/materialdesignicons-webfont.woff?v=5.0.45") format("woff"),url("../fonts/materialdesignicons-webfont.ttf?v=5.0.45") format("truetype");font-weight:normal;font-style:normal}.mdi:before,.mdi-set{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.mdi-ab-testing::before{content:"\F01C9"}.mdi-abjad-arabic::before{content:"\F1328"}.mdi-abjad-hebrew::before{content:"\F1329"}.mdi-abugida-devanagari::before{content:"\F132A"}.mdi-abugida-thai::before{content:"\F132B"}.mdi-access-point::before{content:"\F0003"}.mdi-access-point-network::before{content:"\F0002"}.mdi-access-point-network-off::before{content:"\F0BE1"}.mdi-account::before{content:"\F0004"}.mdi-account-alert::before{content:"\F0005"}.mdi-account-alert-outline::before{content:"\F0B50"}.mdi-account-arrow-left::before{content:"\F0B51"}.mdi-account-arrow-left-outline::before{content:"\F0B52"}.mdi-account-arrow-right::before{content:"\F0B53"}.mdi-account-arrow-right-outline::before{content:"\F0B54"}.mdi-account-box::before{content:"\F0006"}.mdi-account-box-multiple::before{content:"\F0934"}.mdi-account-box-multiple-outline::before{content:"\F100A"}.mdi-account-box-outline::before{content:"\F0007"}.mdi-account-cancel::before{content:"\F12DF"}.mdi-account-cancel-outline::before{content:"\F12E0"}.mdi-account-cash::before{content:"\F1097"}.mdi-account-cash-outline::before{content:"\F1098"}.mdi-account-check::before{content:"\F0008"}.mdi-account-check-outline::before{content:"\F0BE2"}.mdi-account-child::before{content:"\F0A89"}.mdi-account-child-circle::before{content:"\F0A8A"}.mdi-account-child-outline::before{content:"\F10C8"}.mdi-account-circle::before{content:"\F0009"}.mdi-account-circle-outline::before{content:"\F0B55"}.mdi-account-clock::before{content:"\F0B56"}.mdi-account-clock-outline::before{content:"\F0B57"}.mdi-account-cog::before{content:"\F1370"}.mdi-account-cog-outline::before{content:"\F1371"}.mdi-account-convert::before{content:"\F000A"}.mdi-account-convert-outline::before{content:"\F1301"}.mdi-account-cowboy-hat::before{content:"\F0E9B"}.mdi-account-details::before{content:"\F0631"}.mdi-account-details-outline::before{content:"\F1372"}.mdi-account-edit::before{content:"\F06BC"}.mdi-account-edit-outline::before{content:"\F0FFB"}.mdi-account-group::before{content:"\F0849"}.mdi-account-group-outline::before{content:"\F0B58"}.mdi-account-hard-hat::before{content:"\F05B5"}.mdi-account-heart::before{content:"\F0899"}.mdi-account-heart-outline::before{content:"\F0BE3"}.mdi-account-key::before{content:"\F000B"}.mdi-account-key-outline::before{content:"\F0BE4"}.mdi-account-lock::before{content:"\F115E"}.mdi-account-lock-outline::before{content:"\F115F"}.mdi-account-minus::before{content:"\F000D"}.mdi-account-minus-outline::before{content:"\F0AEC"}.mdi-account-multiple::before{content:"\F000E"}.mdi-account-multiple-check::before{content:"\F08C5"}.mdi-account-multiple-check-outline::before{content:"\F11FE"}.mdi-account-multiple-minus::before{content:"\F05D3"}.mdi-account-multiple-minus-outline::before{content:"\F0BE5"}.mdi-account-multiple-outline::before{content:"\F000F"}.mdi-account-multiple-plus::before{content:"\F0010"}.mdi-account-multiple-plus-outline::before{content:"\F0800"}.mdi-account-multiple-remove::before{content:"\F120A"}.mdi-account-multiple-remove-outline::before{content:"\F120B"}.mdi-account-music::before{content:"\F0803"}.mdi-account-music-outline::before{content:"\F0CE9"}.mdi-account-network::before{content:"\F0011"}.mdi-account-network-outline::before{content:"\F0BE6"}.mdi-account-off::before{content:"\F0012"}.mdi-account-off-outline::before{content:"\F0BE7"}.mdi-account-outline::before{content:"\F0013"}.mdi-account-plus::before{content:"\F0014"}.mdi-account-plus-outline::before{content:"\F0801"}.mdi-account-question::before{content:"\F0B59"}.mdi-account-question-outline::before{content:"\F0B5A"}.mdi-account-remove::before{content:"\F0015"}.mdi-account-remove-outline::before{content:"\F0AED"}.mdi-account-search::before{content:"\F0016"}.mdi-account-search-outline::before{content:"\F0935"}.mdi-account-settings::before{content:"\F0630"}.mdi-account-settings-outline::before{content:"\F10C9"}.mdi-account-star::before{content:"\F0017"}.mdi-account-star-outline::before{content:"\F0BE8"}.mdi-account-supervisor::before{content:"\F0A8B"}.mdi-account-supervisor-circle::before{content:"\F0A8C"}.mdi-account-supervisor-outline::before{content:"\F112D"}.mdi-account-switch::before{content:"\F0019"}.mdi-account-switch-outline::before{content:"\F04CB"}.mdi-account-tie::before{content:"\F0CE3"}.mdi-account-tie-outlinLine truncated
/*# sourceMappingURL=materialdesignicons.css.map */
+4
View File
@@ -16,5 +16,9 @@ namespace Seenginx.Models
public string[] Owners { get; set; }
public string Permissions { get; set; }
public bool CanBeDeleted { get; set; } = true;
public string IsVisible { get; set; } = string.Empty;
public void Hide() { IsVisible = "hide"; }
public void Unhide() { IsVisible = string.Empty; }
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seenginx", "Seenginx\Seengi
EndProject
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.Components", "Seenginx.Components\Seenginx.Components.csproj", "{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seenginx.Components", "Seenginx.Components\Seenginx.Components.csproj", "{EB02BCC6-1B40-44FB-9493-ACAD2E0AB963}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+11 -27
View File
@@ -2,33 +2,17 @@
@page "/nginx"
<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-g">
<div class="pure-u-1-5">
<p>Configuration Files</p>
heh
</div>
<div class="pure-u-4-5">
<h1>
Hello
</h1>
</div>
</div>
<div class="pure-u-4-5">
<h1>
Hello
</h1>
</div>
</div>
</RadzenTabsItem>
<RadzenTabsItem Text="Logs">
</RadzenTabsItem>
</Tabs>
</RadzenTabs>
+18
View File
@@ -0,0 +1,18 @@
@inherits NginxLogsBase
@page "/nginx/logs"
<div class="pure-g">
<div class="pure-u-1-5">
<p>Configuration Files</p>
heh
</div>
<div class="pure-u-4-5">
<h1>
Hello
</h1>
</div>
</div>
+37
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 NginxLogsBase : 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();
}
}
}
+8 -3
View File
@@ -8,12 +8,13 @@
</NavLink>
</p>
<p class="menu-label flexCenter">
<span class="mdi mdi-18px"><img src="https://img.icons8.com/color/18/000000/nginx.png"></span>
<span class="mdi mdi-18px"><img src="https://img.icons8.com/color/20/000000/nginx.png"></span>
<span class="petiteCaps">&nbsp; NginX</span>
</p>
<ul class="menu-list">
<li>
<NavLink href="/nginx" class="petiteCaps"
@key="@ActiveNav.Keys.ElementAt(0)"
ActiveClass="@ActiveNav.GetValueOrDefault("nginx")"
@onclick="@(e => SelectMenuItem("nginx"))">
<span class="mdi mdi-file-cog-outline"></span>
@@ -22,6 +23,7 @@
</li>
<li>
<NavLink href="/nginx/logs" class="petiteCaps"
@key="@ActiveNav.Keys.ElementAt(1)"
ActiveClass="@ActiveNav.GetValueOrDefault("nginx/logs")"
@onclick="@(e => SelectMenuItem("nginx/logs"))">
<span class="mdi mdi-information-outline"></span>
@@ -30,12 +32,13 @@
</li>
</ul>
<p class="menu-label flexCenter">
<span class="mdi mdi-18px"><img src="https://img.icons8.com/color/18/000000/service.png"></span>
<span class="mdi mdi-18px"><img src="https://img.icons8.com/color/20/000000/service.png"></span>
<span class="petiteCaps">&nbsp; SystemD</span>
</p>
<ul class="menu-list">
<li>
<NavLink href="/systemd" class="petiteCaps"
@key="@ActiveNav.Keys.ElementAt(2)"
ActiveClass="@ActiveNav.GetValueOrDefault("systemd")"
@onclick="@(e => SelectMenuItem("systemd"))">
<span class="mdi mdi-file-cog-outline"></span>
@@ -44,6 +47,7 @@
</li>
<li>
<NavLink href="/systemd/logs" class="petiteCaps"
@key="@ActiveNav.Keys.ElementAt(3)"
ActiveClass="@ActiveNav.GetValueOrDefault("systemd/logs")"
@onclick="@(e => SelectMenuItem("systemd/logs"))">
<span class="mdi mdi-information-outline"></span>
@@ -52,12 +56,13 @@
</li>
</ul>
<p class="menu-label flexCenter">
<span class="mdi mdi-18px"><img src="https://img.icons8.com/color/18/000000/event-log.png"></span>
<span class="mdi mdi-18px"><img src="https://img.icons8.com/color/20/000000/event-log.png"></span>
<span class="petiteCaps">&nbsp; Dmesg</span>
</p>
<ul class="menu-list">
<li>
<NavLink href="/dmesg" class="petiteCaps"
@key="@ActiveNav.Keys.ElementAt(4)"
ActiveClass="@ActiveNav.GetValueOrDefault("dmesg")"
@onclick="@(e => SelectMenuItem("dmesg"))">
<span class="mdi mdi-information-outline"></span>
-14
View File
@@ -10,11 +10,6 @@ namespace Seenginx.Shared
{
protected Dictionary<string, string> ActiveNav { get; set; }
public bool CollapsePanel { get; set; } = false;
[Parameter]
public string MenuActiveClass { get; set; }
[Parameter]
public EventCallback<string> MenuActiveClassChanged { get; set; }
protected async override Task OnInitializedAsync()
{
@@ -36,14 +31,5 @@ namespace Seenginx.Shared
ActiveNav[menuItem] = "is-active";
}
protected async Task ToggleMenu()
{
CollapsePanel = !CollapsePanel;
MenuActiveClass = CollapsePanel ? "active" : null;
await MenuActiveClassChanged.InvokeAsync(MenuActiveClass);
StateHasChanged();
}
}
}