Added Progress Indicator

When deleting large blocks of Pages, Modules or Notifications there was currently no visual feedback so added the ModuleInstance.ShowProgressIndicator() and ModuleInstance.HideProgressIndicator() calls to these processes.
This commit is contained in:
Leigh Pointer 2022-08-02 10:37:04 +02:00
parent ec73f4dbea
commit 5d2c7c3058
2 changed files with 12 additions and 2 deletions

View File

@ -140,6 +140,7 @@
{ {
try try
{ {
ModuleInstance.ShowProgressIndicator();
foreach (Page page in _pages) foreach (Page page in _pages)
{ {
await PageService.DeletePageAsync(page.PageId); await PageService.DeletePageAsync(page.PageId);
@ -148,6 +149,7 @@
await logger.LogInformation("Pages Permanently Deleted"); await logger.LogInformation("Pages Permanently Deleted");
await Load(); await Load();
ModuleInstance.HideProgressIndicator();
StateHasChanged(); StateHasChanged();
NavigationManager.NavigateTo(NavigateUrl()); NavigationManager.NavigateTo(NavigateUrl());
} }
@ -155,6 +157,7 @@
{ {
await logger.LogError(ex, "Error Permanently Deleting Pages {Error}", ex.Message); await logger.LogError(ex, "Error Permanently Deleting Pages {Error}", ex.Message);
AddModuleMessage(ex.Message, MessageType.Error); AddModuleMessage(ex.Message, MessageType.Error);
ModuleInstance.HideProgressIndicator();
} }
} }
@ -204,6 +207,7 @@
{ {
try try
{ {
ModuleInstance.ShowProgressIndicator();
foreach (Module module in _modules) foreach (Module module in _modules)
{ {
await PageModuleService.DeletePageModuleAsync(module.PageModuleId); await PageModuleService.DeletePageModuleAsync(module.PageModuleId);
@ -218,12 +222,14 @@
await logger.LogInformation("Modules Permanently Deleted"); await logger.LogInformation("Modules Permanently Deleted");
await Load(); await Load();
ModuleInstance.HideProgressIndicator();
StateHasChanged(); StateHasChanged();
} }
catch (Exception ex) catch (Exception ex)
{ {
await logger.LogError(ex, "Error Permanently Deleting Modules {Error}", ex.Message); await logger.LogError(ex, "Error Permanently Deleting Modules {Error}", ex.Message);
AddModuleMessage(Localizer["Error.Modules.Delete"], MessageType.Error); AddModuleMessage(Localizer["Error.Modules.Delete"], MessageType.Error);
ModuleInstance.HideProgressIndicator();
} }
} }
} }

View File

@ -226,8 +226,8 @@ else
@code { @code {
private string username = string.Empty; private string username = string.Empty;
private string _password = string.Empty; private string _password = string.Empty;
private string _passwordtype = "password"; private string _passwordtype = "password";
private string _togglepassword = string.Empty; private string _togglepassword = string.Empty;
private string confirm = string.Empty; private string confirm = string.Empty;
private bool allowtwofactor = false; private bool allowtwofactor = false;
private string twofactor = "False"; private string twofactor = "False";
@ -429,6 +429,7 @@ else
{ {
try try
{ {
ModuleInstance.ShowProgressIndicator();
foreach(var Notification in notifications) foreach(var Notification in notifications)
{ {
if (!Notification.IsDeleted) if (!Notification.IsDeleted)
@ -444,12 +445,15 @@ else
} }
await logger.LogInformation("Notifications Permanently Deleted"); await logger.LogInformation("Notifications Permanently Deleted");
await LoadNotificationsAsync(); await LoadNotificationsAsync();
ModuleInstance.HideProgressIndicator();
StateHasChanged(); StateHasChanged();
} }
catch (Exception ex) catch (Exception ex)
{ {
await logger.LogError(ex, "Error Deleting Notifications {Error}", ex.Message); await logger.LogError(ex, "Error Deleting Notifications {Error}", ex.Message);
AddModuleMessage(ex.Message, MessageType.Error); AddModuleMessage(ex.Message, MessageType.Error);
ModuleInstance.HideProgressIndicator();
} }
} }