Files with editor update
This commit is contained in:
parent
c584733ab1
commit
b9cc775ff4
@ -1,3 +1,12 @@
|
|||||||
@inherits FileItemBase
|
@inherits FileItemBase
|
||||||
|
|
||||||
|
<div 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>
|
||||||
|
</div>
|
@ -14,7 +14,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<InputText Value="SearchInput" ValueChanged="OnSearchChanged" class="input is-primary" type="text" placeholder="Search..." />
|
<InputText Value="SearchInput" ValueChanged="SearchInputChanged" class="input is-primary" type="text" placeholder="Search..." />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -23,30 +23,28 @@
|
|||||||
<ul class="menu-list">
|
<ul class="menu-list">
|
||||||
@foreach (var file in Files)
|
@foreach (var file in Files)
|
||||||
{
|
{
|
||||||
<li>
|
<li @onclick="e => OnFileClick(file)" @key="file" class="@file.IsVisible">
|
||||||
<FileItem File="file" @onclick="OnFileClick(file)"></FileItem>
|
<FileItem File="file"></FileItem>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
<li><a>Dashboard</a></li>
|
|
||||||
<li><a>Customers</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="buttons has-addons">
|
<div class="buttons has-addons">
|
||||||
<button class="button is-primary">
|
<button class="button is-primary" @onclick="OnAddDialog">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<i class="mdi mdi-plus-box-outline"></i>
|
<i class="mdi mdi-plus-box-outline"></i>
|
||||||
</span>
|
</span>
|
||||||
Add
|
Add
|
||||||
</button>
|
</button>
|
||||||
<button class="button is-warning">
|
<button class="button is-warning" @onclick="OnUpdateDialog">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<i class="mdi mdi-pencil-box-outline"></i>
|
<i class="mdi mdi-pencil-box-outline"></i>
|
||||||
</span>
|
</span>
|
||||||
Update
|
Update
|
||||||
</button>
|
</button>
|
||||||
<button class="button is-danger">
|
<button class="button is-danger" @onclick="OnDeleteDialog">
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<i class="mdi mdi-minus-box-outline"></i>
|
<i class="mdi mdi-minus-box-outline"></i>
|
||||||
</span>
|
</span>
|
||||||
@ -61,5 +59,7 @@
|
|||||||
@Editor
|
@Editor
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -21,6 +21,13 @@ namespace Seenginx.Components
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<string> ApplyFilter { get; set; }
|
public EventCallback<string> ApplyFilter { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback AddFile { get; set; }
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<CFile> UpdateFile { get; set; }
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<CFile> DeleteFile { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public RenderFragment<CFile> Editor { get; set; }
|
public RenderFragment<CFile> Editor { get; set; }
|
||||||
|
|
||||||
@ -35,14 +42,17 @@ namespace Seenginx.Components
|
|||||||
|
|
||||||
protected bool IsAnyFileSelected => SelectedFile != default;
|
protected bool IsAnyFileSelected => SelectedFile != default;
|
||||||
|
|
||||||
private CFile SelectedFile { get; set; }
|
[Parameter]
|
||||||
|
public EventCallback<CFile> SelectedFileChanged { get; set; }
|
||||||
|
[Parameter]
|
||||||
|
public CFile SelectedFile { get; set; }
|
||||||
|
|
||||||
protected string SearchInput { get; set; }
|
protected string SearchInput { get; set; }
|
||||||
|
|
||||||
protected async Task OnDeselectClick()
|
protected async Task OnDeselectClick()
|
||||||
{
|
{
|
||||||
SelectedFile = null;
|
SelectedFile = null;
|
||||||
//Clean on the right
|
await SelectedFileChanged.InvokeAsync(SelectedFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task OnFilterClick(EventArgs e, string filter)
|
protected async Task OnFilterClick(EventArgs e, string filter)
|
||||||
@ -55,7 +65,7 @@ namespace Seenginx.Components
|
|||||||
Files[index].Unhide();
|
Files[index].Unhide();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task OnSearchChanged()
|
protected void SearchInputChanged()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(SearchInput))
|
if (string.IsNullOrEmpty(SearchInput))
|
||||||
Files.ForEach(f => f.Hide());
|
Files.ForEach(f => f.Hide());
|
||||||
@ -71,17 +81,20 @@ namespace Seenginx.Components
|
|||||||
|
|
||||||
protected async Task OnFileClick(CFile file)
|
protected async Task OnFileClick(CFile file)
|
||||||
{
|
{
|
||||||
SelectedFile = file;
|
await SelectedFileChanged.InvokeAsync(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task OnCreateFile()
|
protected async Task OnAddDialog()
|
||||||
{
|
{
|
||||||
|
await AddFile.InvokeAsync(null);
|
||||||
}
|
}
|
||||||
protected async Task OnUpdateDialog(CFile file)
|
protected async Task OnUpdateDialog()
|
||||||
{
|
{
|
||||||
|
await UpdateFile.InvokeAsync(SelectedFile);
|
||||||
}
|
}
|
||||||
protected async Task OnDeleteDialog(CFile file)
|
protected async Task OnDeleteDialog()
|
||||||
{
|
{
|
||||||
|
await UpdateFile.InvokeAsync(SelectedFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
@*<RadzenTabs>
|
|
||||||
|
|
||||||
</RadzenTabs>*@
|
|
@ -1,13 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Seenginx.Components
|
|
||||||
{
|
|
||||||
public class TabsBase : ComponentBase
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,17 +2,20 @@
|
|||||||
@page "/nginx"
|
@page "/nginx"
|
||||||
|
|
||||||
|
|
||||||
|
<FilesWithEditor CFile="ConfigFile" Filters="Filters" FilteredOutFiles="FilteredOutFiles" Files="ConfigFiles"
|
||||||
|
SelectedFile="SelectedFile" SelectedFileChanged="SelectedFileChanged" ApplyFilter="ApplyFilter"
|
||||||
|
AddFile="AddFile" UpdateFile="UpdateFile" DeleteFile="DeleteFile" >
|
||||||
|
<CreateDialog>
|
||||||
|
|
||||||
<div class="pure-g">
|
</CreateDialog>
|
||||||
<div class="pure-u-1-5">
|
<UpdateDialog>
|
||||||
<p>Configuration Files</p>
|
|
||||||
heh
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="pure-u-4-5">
|
</UpdateDialog>
|
||||||
<h1>
|
<DeleteDialog>
|
||||||
Hello
|
|
||||||
</h1>
|
</DeleteDialog>
|
||||||
</div>
|
<Editor>
|
||||||
</div>
|
|
||||||
|
</Editor>
|
||||||
|
</FilesWithEditor>
|
||||||
|
|
||||||
|
@ -19,19 +19,51 @@ namespace Seenginx.Pages
|
|||||||
public string InputSearch { get; set; }
|
public string InputSearch { get; set; }
|
||||||
|
|
||||||
public List<ConfigFile> ConfigFiles { get; set; } = new List<ConfigFile>();
|
public List<ConfigFile> ConfigFiles { get; set; } = new List<ConfigFile>();
|
||||||
|
public ConfigFile SelectedFile { get; set; }
|
||||||
|
public List<string> Filters { get; set; } = new List<string>();
|
||||||
|
public List<int> FilteredOutFiles { get; set; } = new List<int>();
|
||||||
|
|
||||||
|
private Dictionary<string, string> FilterFolder { get; set; } = new Dictionary<string, string>();
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
ConfigFiles.AddRange(await NginxService.GetFilesAsync());
|
ConfigFiles.AddRange(await NginxService.GetFilesAsync());
|
||||||
|
Filters.AddRange(new List<string> { "All", "Root", "Conf.d", "Enabled", "Disabled" });
|
||||||
|
FilterFolder.Add("All", null);
|
||||||
|
FilterFolder.Add("Root", "/");
|
||||||
|
FilterFolder.Add("Conf.d", "/conf.d");
|
||||||
|
FilterFolder.Add("Enabled", "/sites-enabled");
|
||||||
|
FilterFolder.Add("Disabled", "/sites-disabled");
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Change(object value, string name)
|
public async Task ApplyFilter(string filter)
|
||||||
{
|
{
|
||||||
var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;
|
if (filter == "All")
|
||||||
|
ConfigFiles.ForEach(f => f.Unhide());
|
||||||
StateHasChanged();
|
else
|
||||||
|
ConfigFiles.ForEach(f =>
|
||||||
|
{
|
||||||
|
if (f.Folder.Contains(FilterFolder[filter]))
|
||||||
|
f.Unhide();
|
||||||
|
else
|
||||||
|
f.Hide();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task SelectedFileChanged(ConfigFile configFile)
|
||||||
|
{
|
||||||
|
SelectedFile = configFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AddFile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public async Task UpdateFile(ConfigFile configFile)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public async Task DeleteFile(ConfigFile configFile)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
@using Microsoft.JSInterop
|
@using Microsoft.JSInterop
|
||||||
@using Seenginx
|
@using Seenginx
|
||||||
@using Seenginx.Shared
|
@using Seenginx.Shared
|
||||||
|
@using Seenginx.Models
|
||||||
|
@using Seenginx.Components
|
||||||
|
|
||||||
@using Radzen
|
|
||||||
@using Radzen.Blazor
|
|
Loading…
Reference in New Issue
Block a user