Refactor diagram generation functions to use updated naming conventions#86
Closed
rebelinux wants to merge 3 commits intoAsBuiltReport:devfrom
Closed
Refactor diagram generation functions to use updated naming conventions#86rebelinux wants to merge 3 commits intoAsBuiltReport:devfrom
rebelinux wants to merge 3 commits intoAsBuiltReport:devfrom
Conversation
- Updated function calls from `Add-Dia*` to `Add-*` for consistency across diagram generation scripts. - Changed `Remove-SpecialChar` to `Remove-SpecialCharacter` for improved clarity in `Get-AbrOntapClusterDiagram.ps1`. - Adjusted edge and node creation methods in `Get-AbrOntapClusterReplicationDiagram.ps1`, `Get-AbrOntapNodeAggrDiagram.ps1`, and `Get-AbrOntapNodeNetworkDiagram.ps1` to reflect new naming. - Enhanced readability and maintainability of the code by standardizing function names and parameters.
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors several NetApp ONTAP diagram-generation scripts to align with updated naming conventions in the diagram helper functions (moving from Add-Dia* to Add-*, and Remove-SpecialChar to Remove-SpecialCharacter), plus updates the diagram export path to use the new diagram creation/aspect-ratio helpers.
Changes:
- Updated multiple diagram builders to use
Add-*/Add-Html*helper function names. - Renamed special-character sanitization usage to
Remove-SpecialCharacterin cluster/replication diagram flows. - Updated diagram export generation from
New-Diagrammer/Get-DiaBestImageAspectRatiotoNew-AbrDiagram/Get-BestImageAspectRatio.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Src/Private/Get-AbrOntapNodeNetworkDiagram.ps1 | Renames node/subgraph/edge helper calls to Add-* equivalents. |
| Src/Private/Get-AbrOntapNodeAggrDiagram.ps1 | Renames HTML node/subgraph helper calls to Add-Html* equivalents. |
| Src/Private/Get-AbrOntapClusterReplicationDiagram.ps1 | Renames HTML node/subgraph/edge helper calls and switches to Remove-SpecialCharacter. |
| Src/Private/Get-AbrOntapClusterDiagram.ps1 | Renames helper calls and sanitization, and updates edge creation calls. |
| Src/Private/Export-AbrOntapDiagram.ps1 | Switches to new diagram creation and aspect ratio helper functions. |
Comments suppressed due to low confidence (1)
Src/Private/Get-AbrOntapClusterDiagram.ps1:128
- In the HA-pair branch, node labels still call
Add-DiaNodeIconwhile the rest of this refactor switches to the newAdd-*naming. IfAdd-DiaNodeIconhas been renamed/removed (as implied by this PR), this path will fail at runtime; update these remaining calls to the new function name for consistency and to avoid broken HA-pair diagrams.
Node $HAName @{Label = Add-DiaNodeIcon -Name $HA.Name -AditionalInfo ($NodeAdditionalInfo | Where-Object { $_.NodeName -eq $HA.Name }).AdditionalInfo -ImagesObj $Images -IconType 'Ontap_Node' -Align 'Center' -IconDebug $IconDebug -FontSize 18; shape = 'plain'; fillColor = 'transparent'; fontsize = 14 }
Node $HAPartner @{Label = Add-DiaNodeIcon -Name $HA.Partner -AditionalInfo ($NodeAdditionalInfo | Where-Object { $_.NodeName -eq $HA.Partner }).AdditionalInfo -ImagesObj $Images -IconType 'Ontap_Node' -Align 'Center' -IconDebug $IconDebug -FontSize 18; shape = 'plain'; fillColor = 'transparent'; fontsize = 14 }
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
193
to
197
| if (-not $PerPortLifs) { | ||
| $PerPortLifs = Add-DiaNodeIcon -Name "$($Port.NodeName)_$($Port.PortName)_NoLifs" -LabelName 'No LIFs Assigned' -ImagesObj $Images -IconType 'Ontap_Network_Nic' -IconDebug $IconDebug -FontSize 12 -ImageSizePercent 50 -AditionalInfo @() -IconPath $IconPath | ||
| $PerPortLifs = Add-NodeText -Name "$($Port.NodeName)_$($Port.PortName)_NoLifs" -Text 'No LIFs Assigned' -IconDebug $IconDebug -FontSize 14 -FontBold | ||
| } | ||
|
|
||
| if ($PerPortLifs.Count -eq 1) { $PerPortLifsColumnSize = 1 } elseif ($Options.DiagramColumnSize) { $PerPortLifsColumnSize = $Options.DiagramColumnSize } else { $PerPortLifsColumnSize = $PerPortLifs.Count } |
Comment on lines
+115
to
+116
| $ClusterNetworkImage = Add-NodeImage -Name 'ClusterSwitch1' -ImagesObj $Images -IconType 'Ontap_Cluster_Network' -IconDebug $IconDebug -TableBackgroundColor '#a1e3fd' | ||
| Add-HtmlSubGraph -Name 'ClusterNetwork' -TableArray $ClusterNetworkImage -Label 'Cluster Network' -LabelPos top -ImagesObj $Images -IconDebug $IconDebug -NodeObject -TableBorder 1 -FontSize 16 -TableBorderColor '#71797E' -TableStyle 'rounded,dashed' -FontColor 'darkblue' -FontBold -FontName 'Segoe Ui Bold' -TableBackgroundColor '#a1e3fd' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add-Dia*toAdd-*for consistency across diagram generation scripts.Remove-SpecialChartoRemove-SpecialCharacterfor improved clarity inGet-AbrOntapClusterDiagram.ps1.Get-AbrOntapClusterReplicationDiagram.ps1,Get-AbrOntapNodeAggrDiagram.ps1, andGet-AbrOntapNodeNetworkDiagram.ps1to reflect new naming.