Skip to content

Commit

Permalink
2023-10-26 - BryanSoltis - v3.1.1 Updates
Browse files Browse the repository at this point in the history
- Fixed mspnp#33 - Updated Generate page to rperoply set selected reource type
  • Loading branch information
BryanSoltis committed Oct 26, 2023
1 parent 35ee912 commit 7c79740
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 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.1.0</Version>
<Version>3.1.1</Version>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
1 change: 1 addition & 0 deletions src/Models/ValidateNameRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public class ValidateNameRequest
{
public long? ResourceTypeId { get; set;}
public string? ResourceType { get; set; }
public string? Name { get; set; }
}
Expand Down
2 changes: 2 additions & 0 deletions src/Services/ResourceNamingRequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public static async Task<ResourceNameResponse> RequestNameWithComponents(Resourc
// CALL VALIDATION FUNCTION
ValidateNameRequest validateNameRequest = new()
{
ResourceTypeId = resourceType.Id,
ResourceType = resourceType.ShortName,
Name = name
};
Expand Down Expand Up @@ -706,6 +707,7 @@ public static async Task<ResourceNameResponse> RequestName(ResourceNameRequest r
// Validate the generated name for the resource type
ValidateNameRequest validateNameRequest = new()
{
ResourceTypeId = resourceType.Id,
ResourceType = resourceType.ShortName,
Name = name
};
Expand Down
13 changes: 11 additions & 2 deletions src/Services/ResourceTypeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,17 @@ public static async Task<ServiceResponse> ValidateResourceTypeName(ValidateNameR
List<ResourceType> resourceTypes = (List<ResourceType>)serviceResponse.ResponseObject!;
if (GeneralHelper.IsNotNull(resourceTypes))
{
// Get the specified resoure type
ResourceType resourceType = resourceTypes.FirstOrDefault(x => x.ShortName == validateNameRequest.ResourceType)!;
ResourceType resourceType = null;
if (GeneralHelper.IsNotNull(validateNameRequest.ResourceTypeId))
{
// Get the specified resoure type by id
resourceType = resourceTypes.FirstOrDefault(x => x.Id == validateNameRequest.ResourceTypeId)!;
}
else
{
// Get the specified resoure type by short name
resourceType = resourceTypes.FirstOrDefault(x => x.ShortName == validateNameRequest.ResourceType)!;
}
if (GeneralHelper.IsNotNull(resourceType))
{
// Create a validate name request
Expand Down
2 changes: 1 addition & 1 deletion src/programsettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"FeedbackURL": "https://forms.office.com/r/M2EZLg6zKq",
"latestNewsEnabled": "false",
"toolVersion":"3.1.0"
"toolVersion":"3.1.1"
}

0 comments on commit 7c79740

Please sign in to comment.