From 8300f5739ab955aa4c3f54fbc15a7450026e766f Mon Sep 17 00:00:00 2001 From: Chris Jacobsen Work Date: Fri, 27 Oct 2023 15:28:04 -0400 Subject: [PATCH] Fixed bug in application launch page that caused forever running loop --- BLAZAM/BLAZAM.csproj | 2 +- BLAZAM/Pages/Configure/Settings.razor | 105 ++++++++++-------- BLAZAM/Pages/Index.razor | 72 ++++++++++-- BLAZAMDatabase/Models/AppSettings.cs | 5 + .../UI/Settings/ApplicationSettings.razor | 6 +- BLAZAMGui/UI/Settings/DatabaseStatus.razor | 39 +++++++ 6 files changed, 171 insertions(+), 58 deletions(-) create mode 100644 BLAZAMGui/UI/Settings/DatabaseStatus.razor diff --git a/BLAZAM/BLAZAM.csproj b/BLAZAM/BLAZAM.csproj index b8fea4d7..5e6c3eff 100644 --- a/BLAZAM/BLAZAM.csproj +++ b/BLAZAM/BLAZAM.csproj @@ -6,7 +6,7 @@ enable false 0.8.2 - 2023.10.09.1826 + 2023.10.27.1927 BLAZAM False diff --git a/BLAZAM/Pages/Configure/Settings.razor b/BLAZAM/Pages/Configure/Settings.razor index 89368578..55cca215 100644 --- a/BLAZAM/Pages/Configure/Settings.razor +++ b/BLAZAM/Pages/Configure/Settings.razor @@ -9,73 +9,84 @@ - - - - - - - - @AppLocalization["Application"] - - - - + + + + + + + + @AppLocalization["Application"] + + + + - - - @AppLocalization["Authentication"] - + + + @AppLocalization["Authentication"] + - - - + + + - - - @AppLocalization["Active Directory"] - + + + @AppLocalization["Active Directory"] + - - - + + + + + + + + @AppLocalization["Database"] + + + + + + - - - @AppLocalization["Email"] - + + + @AppLocalization["Email"] + - - - + + + - - - @AppLocalization["Update"] - + + + @AppLocalization["Update"] + - - - - + + + + - - - @AppLocalization["System"] - + + + @AppLocalization["System"] + - + - + diff --git a/BLAZAM/Pages/Index.razor b/BLAZAM/Pages/Index.razor index 88ec9198..61a1c6f7 100644 --- a/BLAZAM/Pages/Index.razor +++ b/BLAZAM/Pages/Index.razor @@ -1,24 +1,76 @@ @page "/" -@layout MinLayout +@using BLAZAM.Static; +@layout LoginLayout @inject NavigationManager NavManager @inject IAppDatabaseFactory DbFactory @inject ConnMonitor tester @inject ApplicationInfo ApplicationInfo @inject IStringLocalizer Localizer -

- @Localizer["ApplicationStarting"] -

- + + + + + + + + + @DatabaseCache.ApplicationSettings?.AppName + + + + @Localizer["ApplicationStarting"] + + + + + + + + + + + + + + + + + + + + @{ Task.Run(async () => { - while (NavManager.ToBaseRelativePath(NavManager.Uri) == "") + while (waitingForLoadToComplete) { + if (ApplicationInfo.InstallationCompleted) { + waitingForLoadToComplete = false; if (tester.AppReady == ServiceConnectionState.Up) { NavManager.NavigateTo("/home", true); @@ -29,13 +81,16 @@ } } - Task.Delay(1000).Wait(); + if (!waitingForLoadToComplete) + Task.Delay(1000).Wait(); + } }); } @code { + private bool waitingForLoadToComplete = true; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); @@ -45,8 +100,11 @@ private void AppReady(ServiceConnectionState newStatus) { if (newStatus == ServiceConnectionState.Up) + if (NavManager.ToBaseRelativePath(NavManager.Uri) == "") { + waitingForLoadToComplete = false; + NavManager.NavigateTo("/home"); } diff --git a/BLAZAMDatabase/Models/AppSettings.cs b/BLAZAMDatabase/Models/AppSettings.cs index 69f49e3c..d238b6e7 100644 --- a/BLAZAMDatabase/Models/AppSettings.cs +++ b/BLAZAMDatabase/Models/AppSettings.cs @@ -116,5 +116,10 @@ public string AppAbbreviation public string? MyrtilleURL { get; set; } + + /// + /// Whether or not changes made to AD objects should be staged, aka ask to save prior to applying. + /// + //public bool StageChanges { get; set; } } } diff --git a/BLAZAMGui/UI/Settings/ApplicationSettings.razor b/BLAZAMGui/UI/Settings/ApplicationSettings.razor index 6e09f425..b9c755d6 100644 --- a/BLAZAMGui/UI/Settings/ApplicationSettings.razor +++ b/BLAZAMGui/UI/Settings/ApplicationSettings.razor @@ -72,16 +72,16 @@ - + @* settings.MyrtilleURL) ErrorText="Must be a valid url" HelperText="Enter the url of the Myrtille server. (eg: http://localhost:8080)" Placeholder="Enter the url of the Myrtille server" @bind-Value="@settings.MyrtilleURL" /> - {rdpModal.Show();}) >Test Myrtille Connection + {rdpModal.Show();}) >Test Myrtille Connection - + *@ Save Changes diff --git a/BLAZAMGui/UI/Settings/DatabaseStatus.razor b/BLAZAMGui/UI/Settings/DatabaseStatus.razor new file mode 100644 index 00000000..344859f1 --- /dev/null +++ b/BLAZAMGui/UI/Settings/DatabaseStatus.razor @@ -0,0 +1,39 @@ +@inherits SettingsComponents + + + + +@AppLocalization["Database Status"] + + To change these settings, modify appsettings.json in the application directory. + + + + + + + + + + + + + + + + + + +@code { + #nullable disable warnings + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + + + + LoadingData = false; + await InvokeAsync(StateHasChanged); + } + +}