Skip to content

Commit

Permalink
Merge pull request #54 from mspnp/dev
Browse files Browse the repository at this point in the history
v3.4.0
  • Loading branch information
BryanSoltis authored Nov 30, 2023
2 parents ff98584 + d8ddad8 commit ddd2b38
Show file tree
Hide file tree
Showing 14 changed files with 720 additions and 179 deletions.
2 changes: 1 addition & 1 deletion src/AzureNamingTool.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<Version>3.2.0</Version>
<Version>3.3.0</Version>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
15 changes: 14 additions & 1 deletion src/Helpers/ValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static ValidateNameResponse ValidateGeneratedName(Models.ResourceType res
}
else
{
sbMessage.Append("The specified delimiter is not allowed for this resource type and has been removed.");
sbMessage.Append("The specified delimiter was removed. This is often caused by the length of the name exceeding the max length and the delimiter removed to shorten the value or the delimiter is not an allowed character for the resoure type.");
sbMessage.Append(Environment.NewLine);
}
}
Expand Down Expand Up @@ -251,5 +251,18 @@ public static bool CheckAlphanumeric(string value)
Match match = regx.Match(value);
return match.Success;
}

public static bool CheckComponentLength(ResourceComponent component, string value)
{
// Check if the component value length is valid
if ((value.Length < int.Parse(component.MinLength)) || (value.Length > int.Parse(component.MaxLength)))
{
return false;
}
else
{
return true;
}
}
}
}
6 changes: 4 additions & 2 deletions src/Models/ResourceComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ public class ResourceComponent
{
public long Id { get; set; }
[Required()]
public string Name { get; set; } = String.Empty;
public string Name { get; set; } = String.Empty;
[Required()]
public string DisplayName { get; set; } = String.Empty;
public string DisplayName { get; set; } = String.Empty;
[Required()]
public bool Enabled { get; set; }
public int SortOrder { get; set; } = 0;
Expand All @@ -18,5 +18,7 @@ public class ResourceComponent
public string MaxLength { get; set; } = "10";
public bool EnforceRandom { get; set; } = false;
public bool Alphanumeric { get; set; } = true;
public bool ApplyDelimiterBefore { get; set; } = true;
public bool ApplyDelimiterAfter { get; set; } = true;
}
}
33 changes: 17 additions & 16 deletions src/Models/ResourceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,29 @@ public class ResourceType
{
public long Id { get; set; }
[Required()]
public string Resource { get; set; } = String.Empty;
public string Optional { get; set; } = String.Empty;
public string Exclude { get; set; } = String.Empty;
public string Property { get; set; } = String.Empty;
private string _ShortName = String.Empty;
public string Resource { get; set; } = String.Empty;
public string Optional { get; set; } = String.Empty;
public string Exclude { get; set; } = String.Empty;
public string Property { get; set; } = String.Empty;
private string _ShortName = String.Empty;
[JsonPropertyName("ShortName")]
public string ShortName
{
get { return _ShortName; } // get method
set => _ShortName = value?.ToLower()!; // set method
}
public string Scope { get; set; } = String.Empty;
public string LengthMin { get; set; } = String.Empty;
public string LengthMax { get; set; } = String.Empty;
public string ValidText { get; set; } = String.Empty;
public string InvalidText { get; set; } = String.Empty;
public string InvalidCharacters { get; set; } = String.Empty;
public string InvalidCharactersStart { get; set; } = String.Empty;
public string InvalidCharactersEnd { get; set; } = String.Empty;
public string InvalidCharactersConsecutive { get; set; } = String.Empty;
public string Regx { get; set; } = String.Empty;
public string StaticValues { get; set; } = String.Empty;
public string Scope { get; set; } = String.Empty;
public string LengthMin { get; set; } = String.Empty;
public string LengthMax { get; set; } = String.Empty;
public string ValidText { get; set; } = String.Empty;
public string InvalidText { get; set; } = String.Empty;
public string InvalidCharacters { get; set; } = String.Empty;
public string InvalidCharactersStart { get; set; } = String.Empty;
public string InvalidCharactersEnd { get; set; } = String.Empty;
public string InvalidCharactersConsecutive { get; set; } = String.Empty;
public string Regx { get; set; } = String.Empty;
public string StaticValues { get; set; } = String.Empty;
public bool Enabled { get; set; } = true;
public bool ApplyDelimiter { get; set; } = true;
}
}
2 changes: 1 addition & 1 deletion src/Pages/Configuration.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3153,7 +3153,7 @@
case "edit":
if (GeneralHelper.IsNotNull(thisresourceComponent))
{
confirm = await ModalHelper.ShowEditModal(Modal, servicesData, theme, "bg-navcolor", "Edit Org", "<p>Edit the Project/App/Service.</p><p><span class=\"fw-bold\">NOTES</span></p><ul><li>Short Name value will be converted to lower case.</li><li>Short Name must be " + thisresourceComponent.MinLength + "-" + thisresourceComponent.MaxLength + " characters.</li></ul>", (int)id, "ResourceProjAppSvc", false);
confirm = await ModalHelper.ShowEditModal(Modal, servicesData, theme, "bg-navcolor", "Edit Project/App/Service", "<p>Edit the Project/App/Service.</p><p><span class=\"fw-bold\">NOTES</span></p><ul><li>Short Name value will be converted to lower case.</li><li>Short Name must be " + thisresourceComponent.MinLength + "-" + thisresourceComponent.MaxLength + " characters.</li></ul>", (int)id, "ResourceProjAppSvc", false);
if (confirm)
{
servicesData = await ServicesHelper.LoadServicesData(servicesData, admin);
Expand Down
Loading

0 comments on commit ddd2b38

Please sign in to comment.