From aa1751f3c05a924fe23bf0245fdab4dd5d6ad9eb Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:38:56 -0700 Subject: [PATCH] Fix the duplicates and revert the unique checking (#3458) Co-authored-by: sima-zhu --- eng/common/scripts/Update-DocsMsToc.ps1 | 28 ++++++------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/eng/common/scripts/Update-DocsMsToc.ps1 b/eng/common/scripts/Update-DocsMsToc.ps1 index 97299656f..4e6db16f4 100644 --- a/eng/common/scripts/Update-DocsMsToc.ps1 +++ b/eng/common/scripts/Update-DocsMsToc.ps1 @@ -90,17 +90,6 @@ function GetPackageLookup($packageList) { Write-Host "Found more than one package entry for $($pkg.Package) selecting the first non-hidden one." } } - - if ($pkg.PSObject.Members.Name -contains "GroupId" -and ($pkg.New -eq "true") -and $pkg.Package) { - $pkgKey = $pkg.Package - if (!$packageLookup.ContainsKey($pkgKey)) { - $packageLookup[$pkgKey] = $pkg - } - else { - $packageValue = $packageLookup[$pkgKey] - Write-Host "Found more than one package entry for $($packageValue.Package) selecting the first one with groupId $($packageValue.GroupId), skipping $($pkg.GroupId)" - } - } } return $packageLookup @@ -116,7 +105,7 @@ $onboardedPackages = &$GetOnboardedDocsMsPackagesFn ` $metadata = (Get-CSVMetadata).Where({ $_.Package ` -and $onboardedPackages.ContainsKey($_.Package) ` - -and $_.Hide -ne 'true' + -and $_.Hide -ne 'true' }) $fileMetadata = @() @@ -177,7 +166,6 @@ foreach ($package in $packagesForToc.Values) { } $serviceNameList = $services.Keys | Sort-Object - $toc = @() foreach ($service in $serviceNameList) { Write-Host "Building service: $service" @@ -186,14 +174,11 @@ foreach ($service in $serviceNameList) { # Client packages get individual entries $clientPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and ('client' -eq $_.Type) }) - $clientPackages = $clientPackages | Sort-Object 'Package', 'GroupId' | Get-Unique - if ($clientPackages) { - foreach ($clientPackage in $clientPackages) { - $packageItems += GetClientPackageNode -clientPackage $clientPackage - } + $clientPackages = $clientPackages | Sort-Object -Property Package + foreach ($clientPackage in $clientPackages) { + $packageItems += GetClientPackageNode -clientPackage $clientPackage } - # All management packages go under a single `Management` header in the ToC $mgmtPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and ('mgmt' -eq $_.Type) }) $mgmtPackages = $mgmtPackages | Sort-Object -Property Package @@ -207,7 +192,7 @@ foreach ($service in $serviceNameList) { # There could be multiple packages, ensure this is treated as an array # even if it is a single package children = @($children) - }; + } } $uncategorizedPackages = $packagesForToc.Values.Where({ $_.ServiceName -eq $service -and !(@('client', 'mgmt') -contains $_.Type) }) @@ -218,13 +203,13 @@ foreach ($service in $serviceNameList) { } $serviceReadmeBaseName = $service.ToLower().Replace(' ', '-') + $serviceTocEntry = [PSCustomObject]@{ name = $service; href = "~/docs-ref-services/{moniker}/$serviceReadmeBaseName.md" landingPageType = 'Service' items = @($packageItems) } - $toc += $serviceTocEntry } @@ -286,7 +271,6 @@ if ($otherPackages) { } } } - $toc += [PSCustomObject]@{ name = 'Other'; landingPageType = 'Service';