Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for fatal exception when no variables are set #616 #617

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>1.0.7</AssemblyVersion>
<Version>2024.10.30.1014</Version>
<Version>2024.10.30.2210</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<RootNamespace>BLAZAM</RootNamespace>
<GenerateDocumentationFile>False</GenerateDocumentationFile>
Expand Down
1 change: 1 addition & 0 deletions BLAZAMDatabase/Models/Templates/DirectoryTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public string ReplaceVariablesOld(string toParse, NewUserName newUser)
}
public string ReplaceVariables(string toParse, NewUserName? newUser = null, string? username = null)
{
if (toParse.IsNullOrEmpty()) return "";
var regex = new Regex(@"\{(?<var>\w+)(:(?<mod>\w+))?(\[(?<arg>.*?)\])?\}");
return regex.Replace(toParse, match =>
{
Expand Down
12 changes: 10 additions & 2 deletions BLAZAMGui/Layouts/MainAppBar.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@
<MudImage Class="app-icon" Src="@StaticAssets.ApplicationIconUri" />
</MudLink>
<MudHidden Breakpoint="Breakpoint.MdAndUp" Invert=true>
<MudText Align="Align.Center" Class="px-3 align-middle"> @DatabaseCache.ApplicationSettings?.AppAbbreviation</MudText>

@if (DatabaseCache.ApplicationSettings?.AppName != DatabaseCache.ApplicationSettings?.AppAbbreviation)
{
<AppTooltip Text="@DatabaseCache.ApplicationSettings?.AppName">
<MudText Align="Align.Center" Class="px-3 align-middle">@DatabaseCache.ApplicationSettings?.AppAbbreviation</MudText>
</AppTooltip>
}
else
{
<MudText Align="Align.Center" Class="px-3 align-middle">@DatabaseCache.ApplicationSettings?.AppAbbreviation</MudText>
}
</MudHidden>


Expand Down
4 changes: 2 additions & 2 deletions BLAZAMGui/UI/Inputs/ADAutoComplete.razor
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@
get => _selectedResult;
set
{
// if (_selectedResult == value)
// return;
if (_selectedResult == value)
return;

SearchResults = new List<IDirectoryEntryAdapter>
{
Expand Down
12 changes: 6 additions & 6 deletions BLAZAMGui/UI/Settings/Templates/EditDirectoryTemplate.razor
Original file line number Diff line number Diff line change
Expand Up @@ -498,24 +498,24 @@ await ParentTemplateChanged(null);
</MudItem>
<MudItem xs="12" md="6">
<MudStack>
@{

@{
var testName = new NewUserName()
{
GivenName = _testFirstName,
MiddleName = _testMiddleName,
Surname = _testLastName
};
}
}
<MudTextField T="string"
Label="@AppLocalization["Username"]"
Value="@DirectoryTemplate.ReplaceVariables(DirectoryTemplate.EffectiveUsernameFormula,testName)" />
Value="@(DirectoryTemplate.EffectiveUsernameFormula.IsNullOrEmpty()==false?DirectoryTemplate.ReplaceVariables(DirectoryTemplate.EffectiveUsernameFormula,testName):null)" />
<MudTextField T="string"
Label="@AppLocalization["Display Name"]"
Value="@DirectoryTemplate.ReplaceVariables(DirectoryTemplate.EffectiveDisplayNameFormula,testName)" />
Value="@(DirectoryTemplate.EffectiveDisplayNameFormula.IsNullOrEmpty()==false?DirectoryTemplate.ReplaceVariables(DirectoryTemplate.EffectiveDisplayNameFormula,testName):null)" />
<MudTextField T="string"
Label="@AppLocalization["Password"]"
Value="@DirectoryTemplate.ReplaceVariables(DirectoryTemplate.EffectivePasswordFormula,testName)" />

Value="@(DirectoryTemplate.EffectivePasswordFormula.IsNullOrEmpty()==false?DirectoryTemplate.ReplaceVariables(DirectoryTemplate.EffectivePasswordFormula,testName):null)" />
</MudStack>
</MudItem>
</MudGrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<AppTooltip Text="@AppLocalization["Revert to inherited value"]">

<MudIconButton DisableElevation=true
Class="d-inline-flex pa-0"
<MudIconButton Class="d-inline-flex pa-0"
Style="vertical-align:top;"
Color="Color.Dark"
Icon="@Icons.Material.Filled.Undo"
Expand Down