Skip to content

Commit 57aa06f

Browse files
committed
Refactor Export-AbrOntapDiagram to handle image format for Unix platforms and improve error messaging
1 parent 5421b76 commit 57aa06f

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

Src/Private/Export-AbrOntapDiagram.ps1

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,17 @@ function Export-AbrOntapDiagram {
114114
}
115115
}
116116
try {
117-
if ($PSVersionTable.Platform -ne 'Unix') {
118-
$DiagramParams.Remove('Format')
119-
$DiagramParams.Add('Format', "base64")
117+
$DiagramParams.Remove('Format')
118+
$DiagramParams.Add('Format', "base64")
120119

121-
$Graph = $DiagramObject
122-
$Diagram = New-Diagrammer @DiagramParams -InputObject $Graph
123-
if ($Diagram) {
124-
if ((Get-DiaImagePercent -GraphObj $Diagram).Width -gt 600) { $ImagePrty = 40 } else { $ImagePrty = 30 }
125-
Section -Style Heading2 $MainDiagramLabel {
126-
Image -Base64 $Diagram -Text "NetApp Ontap Diagram" -Percent $ImagePrty -Align Center
127-
Paragraph "Image preview: Opens the image in a new tab to view it at full resolution." -Tabs 2
128-
}
120+
$Graph = $DiagramObject
121+
$Diagram = New-Diagrammer @DiagramParams -InputObject $Graph
122+
if ($Diagram) {
123+
if ((Get-DiaImagePercent -GraphObj $Diagram).Width -gt 600) { $ImagePrty = 40 } else { $ImagePrty = 30 }
124+
Section -Style Heading2 $MainDiagramLabel {
125+
Image -Base64 $Diagram -Text "NetApp Ontap Diagram" -Percent $ImagePrty -Align Center
126+
Paragraph "Image preview: Opens the image in a new tab to view it at full resolution." -Tabs 2
129127
}
130-
} else {
131-
Write-PScriboMessage -IsWarning -Message "PSCribo Images embedding is not supported on PowerShell Core running on Linux or MacOS."
132-
133128
}
134129
} catch {
135130
Write-PScriboMessage -IsWarning -Message "Unable to generate the Ontap Diagram: $($_.Exception.Message)"

0 commit comments

Comments
 (0)