Browse Source

Refresh configuration on setting changes.

pull/7114/head
Halil İbrahim Kalkan 6 years ago
parent
commit
9da2acc087
  1. 21
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs
  2. 4
      modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.js

21
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs

@ -2,7 +2,9 @@ using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
using Volo.Abp.EventBus.Local;
namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
{ {
@ -10,10 +12,14 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
{ {
public SettingPageCreationContext SettingPageCreationContext { get; private set; } public SettingPageCreationContext SettingPageCreationContext { get; private set; }
protected ILocalEventBus LocalEventBus { get; }
protected SettingManagementPageOptions Options { get; } protected SettingManagementPageOptions Options { get; }
public IndexModel(IOptions<SettingManagementPageOptions> options) public IndexModel(
IOptions<SettingManagementPageOptions> options,
ILocalEventBus localEventBus)
{ {
LocalEventBus = localEventBus;
Options = options.Value; Options = options.Value;
} }
@ -25,7 +31,7 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
{ {
await contributor.ConfigureAsync(SettingPageCreationContext); await contributor.ConfigureAsync(SettingPageCreationContext);
} }
return Page(); return Page();
} }
@ -33,5 +39,14 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement
{ {
return Task.FromResult<IActionResult>(Page()); return Task.FromResult<IActionResult>(Page());
} }
public virtual async Task<NoContentResult> OnPostRefreshConfigurationAsync()
{
await LocalEventBus.PublishAsync(
new CurrentApplicationConfigurationCacheResetEventData()
);
return NoContent();
}
} }
} }

4
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.js

@ -3,5 +3,9 @@
$(document).on('AbpSettingSaved', function () { $(document).on('AbpSettingSaved', function () {
abp.notify.success(l('SuccessfullySaved')); abp.notify.success(l('SuccessfullySaved'));
abp.ajax({
url: abp.appPath + 'SettingManagement?handler=RefreshConfiguration'
});
}); });
})(jQuery); })(jQuery);

Loading…
Cancel
Save