v1.0.7#24
Merged
rebelinux merged 15 commits intoAsBuiltReport:devfrom May 2, 2026
Merged
Conversation
…ble with background color parameters Co-authored-by: Copilot <copilot@github.com>
…d maintainability
…sts for consistency
…ter usage in Add-HtmlNodeTable function Co-authored-by: Copilot <copilot@github.com>
…lSubGraph function
…n logic in Add-HtmlTable function
…sing in Add-NodeIcon function
…dling in Add-NodeImage function
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prepares the AsBuiltReport.Diagram PowerShell module for the upcoming v1.0.7 release by bumping the module version, updating the changelog, and refactoring several HTML/Graphviz helper functions (icons, labels, tables) to streamline parameter handling and improve readability/consistency.
Changes:
- Bump module version to 1.0.7 and add an Unreleased 1.0.7 changelog section.
- Extend/refactor HTML helper functions (notably signature table background color options and icon handling/percent sizing logic).
- Fix duplicate Pester test names and adjust test expectations for updated HTML output.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/AdvancedExample02.Tests.ps1 | Renames duplicated Context blocks to avoid duplicate Pester test names. |
| Tests/Add-HtmlSignatureTable.Tests.ps1 | Updates expected HTML string output to match new background color handling. |
| CHANGELOG.md | Adds 1.0.7 “Unreleased” section summarizing changes/fixes. |
| AsBuiltReport.Diagram/Src/Private/Add-NodeText.ps1 | Refactors font parameter passing and centralizes Format-NodeObject call. |
| AsBuiltReport.Diagram/Src/Private/Add-NodeImage.ps1 | Refactors table parameter handling and centralizes Format-NodeObject call. |
| AsBuiltReport.Diagram/Src/Private/Add-NodeIcon.ps1 | Refactors additional info + font/table param handling; adjusts image sizing condition. |
| AsBuiltReport.Diagram/Src/Private/Add-HtmlTable.ps1 | Refactors font params and subgraph label/icon rendering logic to reduce duplication. |
| AsBuiltReport.Diagram/Src/Private/Add-HtmlSubGraph.ps1 | Adds IconPath parameter and refactors subgraph icon sizing/table param handling. |
| AsBuiltReport.Diagram/Src/Private/Add-HtmlSignatureTable.ps1 | Adds background color parameters; refactors logo handling and row generation. |
| AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1 | Refactors additional info + font parameter handling and icon null semantics. |
| AsBuiltReport.Diagram/Src/Private/Add-HtmlLabel.ps1 | Refactors for readability, consolidates table parameters, and improves image sizing logic. |
| AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 | Updates ModuleVersion to 1.0.7. |
Comment on lines
+257
to
+268
| $fontParams = @{ | ||
| FontSize = $FontSize | ||
| FontColor = $FontColor | ||
| FontBold = $FontBold | ||
| FontItalic = $FontItalic | ||
| FontUnderline = $FontUnderline | ||
| FontName = $FontName | ||
| FontSubscript = $FontSubscript | ||
| FontSuperscript = $FontSuperscript | ||
| FontStrikeThrough = $FontStrikeThrough | ||
| FontOverline = $FontOverline | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Comment on lines
+463
to
464
| $FontBold = $true | ||
|
|
Comment on lines
+225
to
+235
| [Parameter( | ||
| Mandatory = $false, | ||
| HelpMessage = 'Allow to set a table background color' | ||
| )] | ||
| [string] $TableBackgroundColor = '#FFFFFF', | ||
|
|
||
| [Parameter( | ||
| Mandatory = $false, | ||
| HelpMessage = 'Allow to set a cell background color' | ||
| )] | ||
| [string] $CellBackgroundColor = '#FFFFFF', |
Collaborator
Author
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Comment on lines
278
to
322
| @@ -303,15 +309,14 @@ function Add-HtmlSubGraph { | |||
|
|
|||
| if ($ImagesObj -and $ImagesObj[$IconType]) { | |||
| $Icon = $ImagesObj[$IconType] | |||
| } else { $Icon = $false } | |||
| } else { $Icon = $null } | |||
|
|
|||
| # Set the image size if ImageSizePercent is less than 100 | |||
| if ($ImageSizePercent -lt 100) { | |||
| if ($Icon -and $ImageSizePercent -lt 100) { | |||
| if (-not $IconPath) { | |||
| throw 'IconPath is required when ImageSizePercent is less than 100.' | |||
| } | |||
| $ImageSize = Get-ImagePercent -ImageInput (Join-Path -Path $IconPath -Child $Icon) -Percent $ImageSizePercent | |||
|
|
|||
| $IconWidth = $ImageSize.Width | |||
| $IconHeight = $ImageSize.Height | |||
| } | |||
Collaborator
Author
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| $HTML = Format-HtmlTable -TableBackgroundColor '#FFCCCC' -TableBorderColor 'red' -CellBorder 0 -CellSpacing $CellSpacing -CellPadding $CellPadding -TableRowContent $TRContent | ||
|
|
||
| Format-NodeObject -Name $Name -HtmlObject $HTML -GraphvizAttributes $GraphvizAttributes -AsHtml:(-not $NodeObject) | ||
| $HTML = Format-HtmlTable -TableBackgroundColor '#FFCCCC' -TableBorderColor 'red' -CellBorder 0 -CellSpacing 0 -CellPadding 0 -TableRowContent $TRContent |
Comment on lines
20
to
+24
| It 'Should return a multiple column HTML table with an Logo' { | ||
| $HTMLSignaturewithLogo | Should -BeExactly '<TABLE PORT="EdgeDot" STYLE="rounded,dashed" BORDER="0" CELLBORDER="0" CELLSPACING="5" CELLPADDING="5" BGCOLOR="white" COLOR="#000000"><TR><TD fixedsize="true" width="80" height="80" ALIGN="Center" colspan="1" rowspan="4"><img src="AsBuiltReport.png"/></TD></TR><TR><TD valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Jonathan Colon</FONT></TD></TR><TR><TD valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Zen PR Solutions</FONT></TD></TR></TABLE>' | ||
| $HTMLSignaturewithLogo | Should -BeExactly '<TABLE PORT="EdgeDot" STYLE="rounded,dashed" BORDER="0" CELLBORDER="0" CELLSPACING="5" CELLPADDING="5" BGCOLOR="#FFFFFF" COLOR="#000000"><TR><TD fixedsize="true" width="80" height="80" ALIGN="Center" colspan="1" rowspan="4"><img src="AsBuiltReport.png"/></TD></TR><TR><TD BGCOLOR="#FFFFFF" valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Jonathan Colon</FONT></TD></TR><TR><TD BGCOLOR="#FFFFFF" valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Zen PR Solutions</FONT></TD></TR></TABLE>' | ||
| } | ||
| It 'Should return a multiple column HTML table with an Logo in Debug Mode' { | ||
| $HTMLSignaturewithLogoDebug | Should -BeExactly '<TABLE PORT="EdgeDot" STYLE="rounded,dashed" BORDER="0" CELLBORDER="0" CELLSPACING="5" CELLPADDING="5" BGCOLOR="white" COLOR="black"><TR><TD bgcolor="#FFCCCC" ALIGN="Center" colspan="1" rowspan="4">AsBuiltReport.png</TD></TR><TR><TD valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Jonathan Colon</FONT></TD></TR><TR><TD valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Zen PR Solutions</FONT></TD></TR></TABLE>' | ||
| $HTMLSignaturewithLogoDebug | Should -BeExactly '<TABLE PORT="EdgeDot" STYLE="rounded,dashed" BORDER="0" CELLBORDER="0" CELLSPACING="5" CELLPADDING="5" BGCOLOR="#FFFFFF" COLOR="#000000"><TR><TD bgcolor="#FFCCCC" ALIGN="Center" colspan="1" rowspan="4">AsBuiltReport.png</TD></TR><TR><TD BGCOLOR="#FFFFFF" valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Jonathan Colon</FONT></TD></TR><TR><TD BGCOLOR="#FFFFFF" valign="top" align="Center" colspan="2"><FONT FACE="Segoe Ui" POINT-SIZE="14" COLOR="#000000">Zen PR Solutions</FONT></TD></TR></TABLE>' |
| if (-not $IconPath) { | ||
| throw 'IconPath is required when ImageSizePercent is less than 100.' | ||
| } | ||
| $ImageSize = Get-ImagePercent -ImageInput (Join-Path -Path $IconPath -Child $Icon) -Percent $ImageSizePercent |
| } else { | ||
| $FontBold = $true | ||
| } | ||
| $FontBold = $true |
Comment on lines
+370
to
377
| $isPSCustomObj = $AditionalInfo.GetType().Name -in 'PSCustomObject', 'Object[]' | ||
| foreach ($r in $AditionalInfo) { | ||
| $entries = if ($isPSCustomObj) { $r.PSObject.Properties } else { $r.getEnumerator() } | ||
| [string]$TRAditionalInfo += $entries | ForEach-Object { | ||
| $key = if ($isPSCustomObj) { $_.Name } else { $_.Key } | ||
| '<TR><TD PORT="{0}" BGCOLOR="{1}" ALIGN="{2}" colspan="1"><FONT POINT-SIZE="{3}">{4}: {5}</FONT></TD></TR>' -f $key, $CellBackgroundColor, $Align, $FontSize, $key, $_.Value | ||
| } | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.
[1.0.7] - Unreleased
🔃 Changed
🔧 Fixed