Skip to content

Commit 2f4bbf2

Browse files
committed
Enhance Export-AbrOntapDiagram function to support Unix platform by adding conditional format handling and warning for unsupported image embedding
1 parent 2157e7d commit 2f4bbf2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

Src/Private/Export-AbrOntapDiagram.ps1

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Export-AbrOntapDiagram {
4848
'LogoName' = 'AsBuiltReport_LOGO'
4949
'SignatureLogoName' = 'Abr_LOGO_Footer'
5050
'WaterMarkText' = $Options.DiagramWaterMark
51-
'Direction' = &{
51+
'Direction' = & {
5252
if ($MainDiagramLabel -eq 'Cluster Replication Diagram') {
5353
'left-to-right'
5454
} else {
@@ -114,17 +114,22 @@ function Export-AbrOntapDiagram {
114114
}
115115
}
116116
try {
117-
$DiagramParams.Remove('Format')
118-
$DiagramParams.Add('Format', "base64")
117+
if ($PSVersionTable.Platform -ne 'Unix') {
118+
$DiagramParams.Remove('Format')
119+
$DiagramParams.Add('Format', "base64")
119120

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
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+
}
127129
}
130+
} else {
131+
Write-PScriboMessage -IsWarning -Message "PSCribo Images embedding is not supported on PowerShell Core running on Linux or MacOS."
132+
128133
}
129134
} catch {
130135
Write-PScriboMessage -IsWarning -Message "Unable to generate the Ontap Diagram: $($_.Exception.Message)"

0 commit comments

Comments
 (0)