Files with editor update
This commit is contained in:
@ -2,17 +2,20 @@
|
||||
@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">
|
||||
<div class="pure-u-1-5">
|
||||
<p>Configuration Files</p>
|
||||
heh
|
||||
</div>
|
||||
</CreateDialog>
|
||||
<UpdateDialog>
|
||||
|
||||
<div class="pure-u-4-5">
|
||||
<h1>
|
||||
Hello
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</UpdateDialog>
|
||||
<DeleteDialog>
|
||||
|
||||
</DeleteDialog>
|
||||
<Editor>
|
||||
|
||||
</Editor>
|
||||
</FilesWithEditor>
|
||||
|
||||
|
@ -19,19 +19,51 @@ namespace Seenginx.Pages
|
||||
public string InputSearch { get; set; }
|
||||
|
||||
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()
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
StateHasChanged();
|
||||
if (filter == "All")
|
||||
ConfigFiles.ForEach(f => f.Unhide());
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user