diff --git a/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor b/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor
index 23b2ffe..0dc2402 100644
--- a/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor
+++ b/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor
@@ -35,8 +35,8 @@
@bind-SelectedValues="_selectedCaddyConfigurations">
@foreach (var (index, caddyConfig) in _availableCaddyConfigurations.Index())
{
-
+
@if (index < _availableCaddyConfigurations.Count - 1)
{
diff --git a/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor.cs b/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor.cs
index f2dbd31..6bc195d 100644
--- a/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor.cs
+++ b/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxiesPage.razor.cs
@@ -63,7 +63,8 @@ public partial class CaddyReverseProxiesPage : ComponentBase
///
private async Task ShowCaddyfileEditorDialog(string fileName, string initialContent = "")
{
- var dialog = await DialogService.ShowAsync("New configuration",
+ var dialog = await DialogService.ShowAsync(
+ string.IsNullOrWhiteSpace(fileName) ? "New configuration" : "Caddy file",
options: new DialogOptions
{
FullWidth = true,
@@ -71,7 +72,8 @@ public partial class CaddyReverseProxiesPage : ComponentBase
}, parameters: new DialogParameters
{
{ p => p.FileName, fileName },
- { p => p.InitialContent, initialContent }
+ { p => p.InitialContent, initialContent },
+ { p => p.OnDuplicate, EventCallback.Factory.Create(this, HandleDuplicateRequest) }
});
var result = await dialog.Result;
@@ -81,6 +83,7 @@ public partial class CaddyReverseProxiesPage : ComponentBase
await ReloadCaddy();
}
+ // Always rebuild the list, the configuration may have been renamed or had its hostnames and ports changed
Refresh();
}
diff --git a/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxyItem.razor.cs b/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxyItem.razor.cs
index 5d558ae..227f098 100644
--- a/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxyItem.razor.cs
+++ b/CaddyManager/Components/Pages/Caddy/CaddyReverseProxies/CaddyReverseProxyItem.razor.cs
@@ -1,7 +1,5 @@
-using CaddyManager.Contracts.Caddy;
using CaddyManager.Contracts.Models.Caddy;
using Microsoft.AspNetCore.Components;
-using MudBlazor;
namespace CaddyManager.Components.Pages.Caddy.CaddyReverseProxies;
@@ -12,52 +10,18 @@ namespace CaddyManager.Components.Pages.Caddy.CaddyReverseProxies;
public partial class CaddyReverseProxyItem : ComponentBase
{
///
- /// Callback to refresh the Caddy reverse proxies on the main page
+ /// Callback asking the main page to open the editor for this configuration. The page owns the dialog so that it
+ /// can refresh the whole list afterwards, which matters when the configuration is renamed or deleted.
///
[Parameter]
- public EventCallback OnCaddyRestartRequired { get; set; }
-
- [Parameter]
- public EventCallback OnCaddyfileDuplicateRequested { get; set; }
+ public EventCallback OnEditRequested { get; set; }
[Parameter]
public CaddyConfigurationInfo ConfigurationInfo { get; set; } = null!;
-
- ///
- /// Dialog service for showing the Caddy file editor dialog
- ///
- [Inject]
- private IDialogService DialogService { get; set; } = null!;
///
- /// Caddy service for ops on the Caddy configuration
- ///
- [Inject] private ICaddyService CaddyService { get; set; } = null!;
-
- ///
- /// Show the Caddy file editor dialog
+ /// Request the Caddy file editor dialog for this configuration
///
///
- private async Task Edit()
- {
- var dialog = await DialogService.ShowAsync("Caddy file", options: new DialogOptions
- {
- FullWidth = true,
- MaxWidth = MaxWidth.Medium,
- }, parameters: new DialogParameters
- {
- { p => p.FileName, ConfigurationInfo.FileName },
- { p => p.OnDuplicate, EventCallback.Factory.Create(this, OnCaddyfileDuplicateRequested) }
- });
-
- var result = await dialog.Result;
-
- ConfigurationInfo = CaddyService.GetCaddyConfigurationInfo(ConfigurationInfo.FileName);
- await InvokeAsync(StateHasChanged);
-
- if (result is { Data: bool, Canceled: false } && (bool)result.Data)
- {
- await OnCaddyRestartRequired.InvokeAsync();
- }
- }
-}
\ No newline at end of file
+ private Task Edit() => OnEditRequested.InvokeAsync(ConfigurationInfo.FileName);
+}
diff --git a/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor b/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor
index 6f6b1db..411cd89 100644
--- a/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor
+++ b/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor
@@ -19,6 +19,6 @@
Duplicate
}
Save
- Save & Restart
+ Save & Reload
\ No newline at end of file
diff --git a/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor.cs b/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor.cs
index d4842d6..ac1c2d8 100644
--- a/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor.cs
+++ b/CaddyManager/Components/Pages/Caddy/CaddyfileEditor/CaddyfileEditor.razor.cs
@@ -144,13 +144,13 @@ public partial class CaddyfileEditor : ComponentBase
}
///
- /// Saves the Caddy configuration file and restarts the Caddy container
+ /// Saves the Caddy configuration file and reloads the Caddy configuration
///
- private async Task SaveAndRestart()
+ private async Task SaveAndReload()
{
if (await Save())
{
- // Indicate successful save and that a restart is required by the calling component
+ // Indicate successful save and that a reload is required by the calling component
MudDialog.Close(DialogResult.Ok(true));
}
}
diff --git a/CaddyManager/Configurations/Application/ApplicationInfo.cs b/CaddyManager/Configurations/Application/ApplicationInfo.cs
index 160eb77..45c9069 100644
--- a/CaddyManager/Configurations/Application/ApplicationInfo.cs
+++ b/CaddyManager/Configurations/Application/ApplicationInfo.cs
@@ -8,7 +8,7 @@ public class ApplicationInfo
///
/// The version of the application, to be defined and tagged
///
- public static readonly string Version = "1.1.0";
+ public static readonly string Version = "1.1.1";
///
/// The commit hash of the application