diff --git a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor index 0cd12dcd..4cf7347a 100644 --- a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor +++ b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor @@ -18,15 +18,21 @@ - + - + - + @@ -62,6 +68,7 @@ +  @Localizer["Access Framework API"]  @@ -92,6 +99,23 @@ } } + private async Task SaveConfig() + { + try + { + var settings = new Dictionary(); + settings.Add("runtime", _runtime); + settings.Add("rendermode", _rendermode); + await SystemService.UpdateSystemInfoAsync(settings); + AddModuleMessage(Localizer["Configuration Updated. Please Select Restart Application For These Changes To Be Activated."], MessageType.Success); + } + catch (Exception ex) + { + await logger.LogError(ex, "Error Saving Configuration"); + AddModuleMessage(Localizer["An Error Occurred Updating The Configuration"], MessageType.Error); + } + } + private async Task RestartApplication() { try diff --git a/Oqtane.Client/Services/Interfaces/ISystemService.cs b/Oqtane.Client/Services/Interfaces/ISystemService.cs index c450cdc7..f710b524 100644 --- a/Oqtane.Client/Services/Interfaces/ISystemService.cs +++ b/Oqtane.Client/Services/Interfaces/ISystemService.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; namespace Oqtane.Services @@ -6,5 +6,7 @@ namespace Oqtane.Services public interface ISystemService { Task> GetSystemInfoAsync(); + + Task UpdateSystemInfoAsync(Dictionary settings); } } diff --git a/Oqtane.Client/Services/SystemService.cs b/Oqtane.Client/Services/SystemService.cs index 97112ca1..ba0f54d0 100644 --- a/Oqtane.Client/Services/SystemService.cs +++ b/Oqtane.Client/Services/SystemService.cs @@ -22,5 +22,10 @@ namespace Oqtane.Services { return await GetJsonAsync>(Apiurl); } + + public async Task UpdateSystemInfoAsync(Dictionary settings) + { + await PostJsonAsync(Apiurl, settings); + } } } diff --git a/Oqtane.Server/Controllers/SystemController.cs b/Oqtane.Server/Controllers/SystemController.cs index 0adeaacd..19dae995 100644 --- a/Oqtane.Server/Controllers/SystemController.cs +++ b/Oqtane.Server/Controllers/SystemController.cs @@ -37,5 +37,23 @@ namespace Oqtane.Controllers return systeminfo; } + [HttpPost] + [Authorize(Roles = RoleNames.Host)] + public void Post([FromBody] Dictionary settings) + { + foreach(KeyValuePair kvp in settings) + { + switch (kvp.Key) + { + case "runtime": + _configManager.AddOrUpdateSetting("Runtime", kvp.Value, false); + break; + case "rendermode": + _configManager.AddOrUpdateSetting("RenderMode", kvp.Value, false); + break; + } + } + } + } }