UpdateSettings bugfix
ISettingControl introduction
This commit is contained in:
parent
a9a66155e2
commit
91c5ff7b00
|
@ -1,4 +1,5 @@
|
||||||
@namespace Oqtane.Modules.Admin.Modules
|
@namespace Oqtane.Modules.Admin.Modules
|
||||||
|
@using Oqtane.Interfaces
|
||||||
@inherits ModuleBase
|
@inherits ModuleBase
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
|
@ -137,7 +138,7 @@
|
||||||
builder.AddComponentReferenceCapture(1, inst => { _settings = Convert.ChangeType(inst, _settingsModuleType); });
|
builder.AddComponentReferenceCapture(1, inst => { _settings = Convert.ChangeType(inst, _settingsModuleType); });
|
||||||
builder.CloseComponent();
|
builder.CloseComponent();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveModule()
|
private async Task SaveModule()
|
||||||
|
@ -162,15 +163,16 @@
|
||||||
module.Permissions = _permissionGrid.GetPermissions();
|
module.Permissions = _permissionGrid.GetPermissions();
|
||||||
await ModuleService.UpdateModuleAsync(module);
|
await ModuleService.UpdateModuleAsync(module);
|
||||||
|
|
||||||
if (_settingsModuleType != null)
|
|
||||||
{
|
|
||||||
var moduleType = Type.GetType(ModuleState.ModuleType);
|
|
||||||
if (moduleType != null)
|
|
||||||
{
|
|
||||||
moduleType.GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (_settings is ISettingsControl control)
|
||||||
|
{
|
||||||
|
await control.UpdateSettings();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Compatibility 2.0 fallback
|
||||||
|
_settings?.GetType().GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
|
||||||
|
}
|
||||||
NavigationManager.NavigateTo(NavigateUrl());
|
NavigationManager.NavigateTo(NavigateUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
Oqtane.Shared/Interfaces/ISettingsControl.cs
Normal file
9
Oqtane.Shared/Interfaces/ISettingsControl.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Oqtane.Interfaces
|
||||||
|
{
|
||||||
|
public interface ISettingsControl
|
||||||
|
{
|
||||||
|
Task UpdateSettings();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user