feat: also show the file name in edit mode
This commit is contained in:
@@ -4,13 +4,11 @@
|
|||||||
|
|
||||||
<MudDialog>
|
<MudDialog>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
@if (IsNew)
|
|
||||||
{
|
|
||||||
<MudTextField @bind-Value="FileName" Label="File name" Variant="Variant.Outlined"
|
<MudTextField @bind-Value="FileName" Label="File name" Variant="Variant.Outlined"
|
||||||
Style="margin-bottom: 16px;"
|
Style="margin-bottom: 8px;"
|
||||||
ShrinkLabel="true"></MudTextField>
|
ShrinkLabel="true"
|
||||||
}
|
Disabled="@(!IsNew)"></MudTextField>
|
||||||
<MudText Typo="Typo.caption" Style="padding-left: 8px; padding-bottom: 4px;">File content</MudText>
|
<MudText Typo="Typo.caption" Style="padding-left: 18px; padding-bottom: 8px;">File content</MudText>
|
||||||
<StandaloneCodeEditor ConstructionOptions="@EditorConstructionOptions"
|
<StandaloneCodeEditor ConstructionOptions="@EditorConstructionOptions"
|
||||||
CssClass="caddy-file-editor"></StandaloneCodeEditor>
|
CssClass="caddy-file-editor"></StandaloneCodeEditor>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
@@ -15,15 +15,21 @@ public partial class CaddyfileEditor : ComponentBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the Caddy configuration file is new
|
/// Determines if the Caddy configuration file is new
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool IsNew => string.IsNullOrWhiteSpace(FileName);
|
private bool IsNew { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
|
|
||||||
protected override Task OnInitializedAsync()
|
protected override Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
IsNew = string.IsNullOrWhiteSpace(FileName);
|
||||||
|
|
||||||
|
if (!IsNew)
|
||||||
{
|
{
|
||||||
// Load the content of the Caddy configuration file
|
// Load the content of the Caddy configuration file
|
||||||
_caddyConfigurationContent = CaddyService.GetCaddyConfigurationContent(FileName);
|
_caddyConfigurationContent = CaddyService.GetCaddyConfigurationContent(FileName);
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnInitializedAsync();
|
return base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public partial class ReverseProxyItem : ComponentBase
|
|||||||
|
|
||||||
private Task Edit()
|
private Task Edit()
|
||||||
{
|
{
|
||||||
return DialogService.ShowAsync<CaddyfileEditor.CaddyfileEditor>(FileName, options: new DialogOptions
|
return DialogService.ShowAsync<CaddyfileEditor.CaddyfileEditor>("Caddy file", options: new DialogOptions
|
||||||
{
|
{
|
||||||
FullWidth = true,
|
FullWidth = true,
|
||||||
MaxWidth = MaxWidth.Medium,
|
MaxWidth = MaxWidth.Medium,
|
||||||
|
|||||||
Reference in New Issue
Block a user