Skip to content

Commit f852faf

Browse files
azure-sdksima-zhuweshaggard
authored
Sync eng/common directory with azure-sdk-tools for PR 3000 (Azure#27936)
* Sort by client, mgmt, track2, track1 * sort by the type * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * fix the sorting * Define the order of new and type * address comments * fix typo * Address your comments * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> * Update Generate-DocIndex.ps1 * Update Generate-DocIndex.ps1 * Update eng/common/docgeneration/Generate-DocIndex.ps1 Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: sima-zhu <[email protected]> Co-authored-by: Sima Zhu <[email protected]> Co-authored-by: Wes Haggard <[email protected]>
1 parent 80bb77a commit f852faf

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

eng/common/docgeneration/Generate-DocIndex.ps1

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ function Get-TocMapping {
6666

6767
foreach ($artifact in $artifacts) {
6868
$packageInfo = $metadata | ? { $_.Package -eq $artifact -and $_.Hide -ne "true" }
69+
6970
$serviceName = ""
70-
$displayName = ""
7171
if (!$packageInfo) {
7272
LogDebug "There is no service name for artifact $artifact or it is marked as hidden. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. "
7373
continue
@@ -76,16 +76,28 @@ function Get-TocMapping {
7676
LogWarning "There is no service name for artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. "
7777
# If no service name retrieved, print out warning message, and put it into Other page.
7878
$serviceName = "Other"
79-
$displayName = $packageInfo[0].DisplayName.Trim()
8079
}
8180
else {
8281
if ($packageInfo.Length -gt 1) {
8382
LogWarning "There are more than 1 packages fetched out for artifact $artifact. Please check csv of Azure/azure-sdk/_data/release/latest repo if this is intended. "
8483
}
8584
$serviceName = $packageInfo[0].ServiceName.Trim()
86-
$displayName = $packageInfo[0].DisplayName.Trim()
8785
}
88-
$orderServiceMapping[$artifact] = @($serviceName, $displayName)
86+
87+
# Define the order of "New", "Type", if not match, return the length of the array.
88+
$CustomOrder_New = "true", "false", ""
89+
$newIndex = $CustomOrder_New.IndexOf($packageInfo[0].New.ToLower())
90+
$newIndex = $newIndex -eq -1 ? $CustomOrder_New.Count : $newIndex
91+
$CustomOrder_Type = "client", "mgmt", "compat", "spring", ""
92+
$typeIndex = $CustomOrder_Type.IndexOf($packageInfo[0].Type.ToLower())
93+
$typeIndex = $typeIndex -eq -1 ? $CustomOrder_Type.Count : $typeIndex
94+
$orderServiceMapping[$artifact] = [PSCustomObject][ordered]@{
95+
NewIndex = $newIndex
96+
TypeIndex = $typeIndex
97+
ServiceName = $serviceName
98+
DisplayName = $packageInfo[0].DisplayName.Trim()
99+
Artifact = $artifact
100+
}
89101
}
90102
return $orderServiceMapping
91103
}
@@ -114,10 +126,11 @@ function GenerateDocfxTocContent([Hashtable]$tocContent, [String]$lang, [String]
114126
New-Item -Path $YmlPath -Name "toc.yml" -Force
115127
$visitedService = @{}
116128
# Sort and display toc service name by alphabetical order, and then sort artifact by order.
117-
foreach ($serviceMapping in ($tocContent.GetEnumerator() | Sort-Object Value, Key)) {
118-
$artifact = $serviceMapping.Key
119-
$serviceName = $serviceMapping.Value[0]
120-
$displayName = $serviceMapping.Value[1]
129+
$sortedToc = $tocContent.Values | Sort-Object NewIndex, TypeIndex, ServiceName, DisplayName, Artifact
130+
foreach ($serviceMapping in $sortedToc) {
131+
$artifact = $serviceMapping.Artifact
132+
$serviceName = $serviceMapping.ServiceName
133+
$displayName = $serviceMapping.DisplayName
121134

122135
# handle spaces in service name, EG "Confidential Ledger"
123136
# handle / in service name, EG "Database for MySQL/PostgreSQL". Leaving a "/" present will generate a bad link location.

0 commit comments

Comments
 (0)