Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.2.1 public release #19

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/CodeQL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ on:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
schedule:
- cron: '20 14 * * 1'

permissions:
contents: read
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.1] - 2024-05-16

### Added

- Improved Get-DiaHTMLTable and Get-DiaNodeIcon cmdlet

## [0.2.0] - 2024-04-29

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Diagrammer.Core.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Diagrammer.Core.psm1'

# Version number of this module.
ModuleVersion = '0.2.0'
ModuleVersion = '0.2.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
21 changes: 15 additions & 6 deletions Src/Private/Get-DiaHtmlTable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Function Get-DiaHTMLTable {
_________________

.NOTES
Version: 0.1.7
Version: 0.2.1
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand All @@ -54,6 +54,9 @@ Function Get-DiaHTMLTable {
Hashtable with the IconName > IconPath translation
.PARAMETER IconDebug
Set the table debug mode
.PARAMETER TableStyle
Set the table style (ROUNDED, RADIAL, SOLID, INVISIBLE, INVIS, DOTTED, and DASHED)
styles can be combines ("rounded,dashed")
#>
param(
[string[]] $Rows,
Expand All @@ -65,7 +68,9 @@ Function Get-DiaHTMLTable {
[Switch] $MultiColunms,
[int] $ColumnSize = 2,
[Hashtable] $ImagesObj = @{},
[bool] $IconDebug
[bool] $IconDebug,
[string] $TableStyle = "rounded,dashed",
[Switch] $NoFontBold
)

if ($MultiColunms) {
Expand Down Expand Up @@ -102,16 +107,20 @@ Function Get-DiaHTMLTable {
$TR = ''
foreach ($r in $Rows) {
Write-Verbose "Creating Node: $r"
$TR += '<TR><TD valign="top" align="{0}" colspan="2"><B><FONT POINT-SIZE="{1}">{2}</FONT></B></TD></TR>' -f $Align, $FontSize, $r
if ($NoFontBold) {
$TR += '<TR><TD valign="top" align="{0}" colspan="2"><FONT POINT-SIZE="{1}">{2}</FONT></TD></TR>' -f $Align, $FontSize, $r
} else {
$TR += '<TR><TD valign="top" align="{0}" colspan="2"><B><FONT POINT-SIZE="{1}">{2}</FONT></B></TD></TR>' -f $Align, $FontSize, $r
}
}

if (!$ICON) {
return '<TABLE STYLE="rounded,dashed" border="{0}" cellborder="{1}" cellpadding="5">{2}</TABLE>' -f $TableBorder, $CellBorder, $TR
return '<TABLE STYLE="{0}" border="{1}" cellborder="{2}" cellpadding="5">{3}</TABLE>' -f $TableStyle ,$TableBorder, $CellBorder, $TR
} elseif ($IconDebug) {
return '<TABLE STYLE="rounded,dashed" COLOR="red" border="1" cellborder="1" cellpadding="5"><TR><TD fixedsize="true" width="80" height="80" ALIGN="center" colspan="1" rowspan="4">Logo</TD></TR>{0}</TABLE>' -f $TR
return '<TABLE STYLE="{0}" COLOR="red" border="1" cellborder="1" cellpadding="5"><TR><TD fixedsize="true" width="80" height="80" ALIGN="center" colspan="1" rowspan="4">Logo</TD></TR>{1}</TABLE>' -f $TableStyle, $TR

} else {
return '<TABLE STYLE="rounded,dashed" border="{0}" cellborder="{1}" cellpadding="5"><TR><TD fixedsize="true" width="80" height="80" ALIGN="{2}" colspan="1" rowspan="4"><img src="{3}"/></TD></TR>{4}</TABLE>' -f $TableBorder, $CellBorder, $Align, $Icon, $TR
return '<TABLE STYLE="{0}" border="{1}" cellborder="{2}" cellpadding="5"><TR><TD fixedsize="true" width="80" height="80" ALIGN="{3}" colspan="1" rowspan="4"><img src="{4}"/></TD></TR>{5}</TABLE>' -f $TableStyle, $TableBorder, $CellBorder, $Align, $Icon, $TR
}
}
}
60 changes: 48 additions & 12 deletions Src/Private/Get-DiaNodeIcon.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Function Get-DiaNodeIcon {
| Memory = 4GB |
_________________
.NOTES
Version: 0.1.7
Version: 0.2.1
Author: Jonathan Colon
Twitter: @jcolonfzenpr
Github: rebelinux
Expand All @@ -46,9 +46,13 @@ Function Get-DiaNodeIcon {
[hashtable[]]$Rows,
[string]$IconType,
[String]$Name,
[String]$Align,
[String]$Align = 'Center',
[Hashtable] $ImagesObj = @{},
[bool] $IconDebug
[bool] $IconDebug,
[int] $TableBorder = 0,
[int] $CellBorder = 0,
[int] $FontSize = 14,
[Switch] $NoFontBold
)


Expand All @@ -60,35 +64,67 @@ Function Get-DiaNodeIcon {

$TR = @()
foreach ($r in $Rows) {
$TR += $r.getEnumerator() | ForEach-Object { "<TR><TD align='$Align' colspan='1'><FONT POINT-SIZE='14'>$($_.Key): $($_.Value)</FONT></TD></TR>" }
$TR += $r.getEnumerator() | ForEach-Object { "<TR><TD align='$Align' colspan='1'><FONT POINT-SIZE='$FontSize'>$($_.Key): $($_.Value)</FONT></TD></TR>" }
}

if ($IconDebug) {
if ($ICON -ne 'NoIcon') {
if ($Align -eq "Center") {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' colspan='1'>ICON</TD></TR><TR><TD align='$Align'><B>$Name</B></TD></TR>$TR</TABLE>"
if ($NoFontBold) {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' colspan='1'>ICON</TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'>$Name</FONT></TD></TR>$TR</TABLE>"
} else {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' colspan='1'>ICON</TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'>$Name</FONT></B></TD></TR>$TR</TABLE>"
}
} else {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'>ICON</TD></TR><TR><TD align='$Align'><B> $Name</B></TD></TR> $TR</TABLE>"
if ($NoFontBold) {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'>ICON</TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'> $Name</FONT></TD></TR> $TR</TABLE>"
} else {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'>ICON</TD></TR><TR><TD align='$Align'><B> <FONT POINT-SIZE='$FontSize'> $Name</FONT></B></TD></TR> $TR</TABLE>"
}
}
} else {
if ($Align -eq "Center") {
"<TABLE color='red' border='0' cellborder='0' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' colspan='1'></TD></TR><TR><TD align='$Align'><B>$Name</B></TD></TR>$TR</TABLE>"
if ($NoFontBold) {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' colspan='1'></TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'>$Name</FONT></TD></TR>$TR</TABLE>"
} else {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' colspan='1'></TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'>$Name</FONT></B></TD></TR>$TR</TABLE>"
}
} else {
"<TABLE color='red' border='0' cellborder='0' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'></TD></TR><TR><TD align='$Align'><B> $Name</B></TD></TR> $TR</TABLE>"
if ($NoFontBold) {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'></TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'> $Name</FONT></TD></TR> $TR</TABLE>"
} else {
"<TABLE color='red' border='1' cellborder='1' cellspacing='5' cellpadding='5'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'></TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'> $Name</FONT></B></TD></TR> $TR</TABLE>"
}
}
}
} else {
if ($ICON -ne 'NoIcon') {
if ($Align -eq "Center") {
"<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' colspan='1'><img src='$($ICON)'/></TD></TR><TR><TD align='$Align'><B>$Name</B></TD></TR>$TR</TABLE>"
if ($NoFontBold) {
"<TABLE border='$TableBorder' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' colspan='1'><img src='$($ICON)'/></TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'>$Name</FONT></TD></TR>$TR</TABLE>"
} else {
"<TABLE border='$TableBorder' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' colspan='1'><img src='$($ICON)'/></TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'>$Name</FONT></B></TD></TR>$TR</TABLE>"
}
} else {
"<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'><img src='$($ICON)'/></TD></TR><TR><TD align='$Align'><B> $Name</B></TD></TR> $TR</TABLE>"
if ($NoFontBold) {
"<TABLE border='$TableBorder' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'><img src='$($ICON)'/></TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'> $Name</FONT></TD></TR> $TR</TABLE>"
} else {
"<TABLE border='$TableBorder' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'><img src='$($ICON)'/></TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'> $Name</FONT></B></TD></TR> $TR</TABLE>"
}
}
} else {
if ($Align -eq "Center") {
"<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' colspan='1'></TD></TR><TR><TD align='$Align'><B>$Name</B></TD></TR>$TR</TABLE>"
if ($NoFontBold) {
"<TABLE border='$TableBorder' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' colspan='1'></TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'>$Name</FONT></TD></TR>$TR</TABLE>"
} else {
"<TABLE border='$TableBorder' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' colspan='1'></TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'>$Name</FONT></B></TD></TR>$TR</TABLE>"
}
} else {
"<TABLE border='0' cellborder='0' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'></TD></TR><TR><TD align='$Align'><B> $Name</B></TD></TR> $TR</TABLE>"
if ($NoFontBold) {
"<TABLE border='$TableBorderyyy' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'></TD></TR><TR><TD align='$Align'><FONT POINT-SIZE='$FontSize'> $Name</FONT></TD></TR> $TR</TABLE>"
} else {
"<TABLE border='$TableBorderyyy' cellborder='$CellBorder' cellspacing='5' cellpadding='0'><TR><TD ALIGN='$Align' rowspan='4' valign='Bottom'></TD></TR><TR><TD align='$Align'><B><FONT POINT-SIZE='$FontSize'> $Name</FONT></B></TD></TR> $TR</TABLE>"
}
}
}
}
Expand Down
Loading