Skip to content

Commit

Permalink
Fixed bug in application launch page that caused forever running loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Jacobsen Work committed Oct 27, 2023
1 parent e0041e4 commit 8300f57
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 58 deletions.
2 changes: 1 addition & 1 deletion BLAZAM/BLAZAM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<ServerGarbageCollection>false</ServerGarbageCollection>
<AssemblyVersion>0.8.2</AssemblyVersion>
<Version>2023.10.09.1826</Version>
<Version>2023.10.27.1927</Version>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile>

Expand Down
105 changes: 58 additions & 47 deletions BLAZAM/Pages/Configure/Settings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,84 @@
<SetHeader>
</SetHeader>
<AuthorizeView>
<MudTabs ActivePanelIndex="@ActiveTab">
<MudTabPanel>
<ChildContent>
<ApplicationSettings />

</ChildContent>
<TabContent>
@AppLocalization["Application"]
</TabContent>
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<MudTabs ActivePanelIndex="@ActiveTab">
<MudTabPanel>
<ChildContent>
<ApplicationSettings />

</ChildContent>
<TabContent>
@AppLocalization["Application"]
</TabContent>
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<AuthenticationSetting />

</ChildContent>
<TabContent>
@AppLocalization["Authentication"]
</TabContent>
</ChildContent>
<TabContent>
@AppLocalization["Authentication"]
</TabContent>


</MudTabPanel>
<MudTabPanel>
<ChildContent>
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<DirectorySettings />

</ChildContent>
<TabContent>
@AppLocalization["Active Directory"]
</TabContent>
</ChildContent>
<TabContent>
@AppLocalization["Active Directory"]
</TabContent>


</MudTabPanel>
<MudTabPanel >
<ChildContent>
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<DatabaseStatus />

</ChildContent>
<TabContent>
@AppLocalization["Database"]
</TabContent>


</MudTabPanel>
<MudTabPanel>
<ChildContent>
<EmailSettings />

</ChildContent>
<TabContent>
@AppLocalization["Email"]
</TabContent>
</ChildContent>
<TabContent>
@AppLocalization["Email"]
</TabContent>


</MudTabPanel>
<MudTabPanel>
<ChildContent>
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<UpdateSettings />

</ChildContent>
<TabContent>
@AppLocalization["Update"]
</TabContent>
</ChildContent>
<TabContent>
@AppLocalization["Update"]
</TabContent>


</MudTabPanel>
<MudTabPanel>
<ChildContent>
<SystemSettings />
</MudTabPanel>
<MudTabPanel>
<ChildContent>
<SystemSettings />

</ChildContent>
<TabContent>
@AppLocalization["System"]
</TabContent>
</ChildContent>
<TabContent>
@AppLocalization["System"]
</TabContent>


</MudTabPanel>
</MudTabPanel>

</MudTabs>
</MudTabs>

</AuthorizeView>

Expand Down
72 changes: 65 additions & 7 deletions BLAZAM/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -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<AppLocalization> Localizer
<h2>
@Localizer["ApplicationStarting"]

</h2>
<progress />



<MudContainer Class="py-5">

<MudText Typo="Typo.h3">


@DatabaseCache.ApplicationSettings?.AppName

</MudText>

<MudText>@Localizer["ApplicationStarting"]</MudText>
<MudProgressLinear Color="Color.Info" Indeterminate=true />

<MudElement Class="brand-icon">
<MudImage Src="@StaticAssets.ApplicationIconUri" />

</MudElement>
<MudContainer Style="max-width:300px;" Class="py-4">


</MudContainer>



<Copyright Class="mx-auto" />
</MudContainer>

<style>
body{
height: 98vh;
}
.brand-icon {
position: fixed;
left: 5px;
top: 5px;
}
.brand-icon img {
max-width: 65px;
max-height: 65px;
}
.login-form input {
max-width: 300px;
margin-left: auto;
margin-right: auto;
}
</style>



@{

Task.Run(async () =>
{
while (NavManager.ToBaseRelativePath(NavManager.Uri) == "")
while (waitingForLoadToComplete)
{

if (ApplicationInfo.InstallationCompleted)
{
waitingForLoadToComplete = false;
if (tester.AppReady == ServiceConnectionState.Up)
{
NavManager.NavigateTo("/home", true);
Expand All @@ -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();
Expand All @@ -45,8 +100,11 @@
private void AppReady(ServiceConnectionState newStatus)
{
if (newStatus == ServiceConnectionState.Up)

if (NavManager.ToBaseRelativePath(NavManager.Uri) == "")
{
waitingForLoadToComplete = false;

NavManager.NavigateTo("/home");

}
Expand Down
5 changes: 5 additions & 0 deletions BLAZAMDatabase/Models/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,10 @@ public string AppAbbreviation


public string? MyrtilleURL { get; set; }

/// <summary>
/// Whether or not changes made to AD objects should be staged, aka ask to save prior to applying.
/// </summary>
//public bool StageChanges { get; set; }
}
}
6 changes: 3 additions & 3 deletions BLAZAMGui/UI/Settings/ApplicationSettings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@

</SettingsField>


@*
<SettingsField Label="@AppLocalization["Myrtille Web Adress"]">
<MudTextField Label="@AppLocalization["Myrtille Web Adress"]" For=@(()=> 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" />
</SettingsField>
<MudButton OnClick=@(()=>{rdpModal.Show();}) >Test Myrtille Connection</MudButton>
<MudButton OnClick=@(()=>{rdpModal.Show();}) >Test Myrtille Connection</MudButton>
<AppModal @ref=rdpModal Title="Test Myrtille">
<RDPModal/>
</AppModal>
</AppModal> *@
<SettingsField>
<MudButton Disabled="SaveDisabled" ButtonType="ButtonType.Submit" Color="Color.Success">Save Changes</MudButton>
</SettingsField>
Expand Down
39 changes: 39 additions & 0 deletions BLAZAMGui/UI/Settings/DatabaseStatus.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@inherits SettingsComponents




<MudText Typo="Typo.h4">@AppLocalization["Database Status"]</MudText>
<MudForm>
<MudText>To change these settings, modify appsettings.json in the application directory.</MudText>
<SettingsField Label="@AppLocalization["DB Type"]">
<MudTextField Disabled=true Label="@AppLocalization["DB Type"]" Value="@Context?.ConnectionString?.DatabaseType"/>
</SettingsField>

<SettingsField Label="@AppLocalization["Server"]">
<MudTextField Disabled=true Label="@AppLocalization["Server"]" Value="@Context?.ConnectionString?.ServerAddress" />
</SettingsField>

<SettingsField Label="@AppLocalization["Port"]">
<MudTextField Disabled=true Label="@AppLocalization["Port"]" Value="@Context?.ConnectionString?.ServerPort" />
</SettingsField>

<SettingsField Label="@AppLocalization["Database"]">
<MudTextField Disabled=true Label="@AppLocalization["Database"]" Value="@Context?.ConnectionString?.Database" />
</SettingsField>


</MudForm>
@code {
#nullable disable warnings
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();



LoadingData = false;
await InvokeAsync(StateHasChanged);
}

}

0 comments on commit 8300f57

Please sign in to comment.