Skip to content

Commit

Permalink
Merge pull request #2743 from NikCharlebois/Fix#2715
Browse files Browse the repository at this point in the history
Fixes #2715
  • Loading branch information
NikCharlebois authored Jan 4, 2023
2 parents c90b606 + 0a56664 commit b853391
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
* Added support to generate parameter descriptions automatically from schema
FIXES [#2720](https://github.com/microsoft/Microsoft365DSC/issues/2720)
* MISC
* Fixes an issue where OrderedDictionary values weren't properly expanded in a delta report
FIXES [#2715](https://github.com/microsoft/Microsoft365DSC/issues/2715)
* Updated website generation code to checkout correct commit

# 1.22.1221.1
Expand Down
45 changes: 42 additions & 3 deletions Modules/Microsoft365DSC/Modules/M365DSCReport.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1093,13 +1093,52 @@ function New-M365DSCDeltaReport
$emoticon = '🟦'
}

$sourceValue = $drift.ValueInSource
$destinationValue = $drift.ValueInDestination
$CIMType = $drift.ValueInSource[0].CimInstance

if ($sourceValue.GetType().Name -eq 'Object[]' -and -not [System.String]::IsNullOrEmpty($CIMType))
{
$sourceValue = ""
$orderedKeys = $drift.ValueInSource.Key | Sort-Object

foreach ($key in $orderedKeys)
{
$currentValue = ($drift.ValueInSource | Where-Object -FilterScript {$_.Key -eq $key}).Value
$sourceValue += "<table width='100%'>"
$sourceValue += "<tr><th colspan='2' width='100%' style='border:1px solid black; text-align:middle;'>$CIMType</th></tr>"
$sourceValue += "<tr><td width='100%' style='border:1px solid black; text-align:right;'>$key = $currentValue</td></tr>"
$sourceValue += "</table><br/>"
}
$sourceValue = $sourceValue.Substring(0, $sourceValue.Length -5)
$cellStyle = "vertical-align:top;"
}

if ($destinationValue.GetType().Name -eq 'Object[]' -and -not [System.String]::IsNullOrEmpty($CIMType))
{
$destinationValue = ""
$orderedKeys = $drift.ValueInDestination.Key | Sort-Object
$CIMType = $drift.ValueInDestination[0].CimInstance

foreach ($key in $orderedKeys)
{
$currentValue = ($drift.ValueInDestination | Where-Object -FilterScript {$_.Key -eq $key}).Value
$destinationValue += "<table width='100%'>"
$destinationValue += "<tr><th colspan='2' width='100%' style='border:1px solid black; text-align:middle;'>$CIMType</th></tr>"
$destinationValue += "<tr><td width='100%' style='border:1px solid black; text-align:right;'>$key = $currentValue</td></tr>"
$destinationValue += "</table><br/>"
}
$destinationValue = $destinationValue.Substring(0, $destinationValue.Length -5)
$cellDestinationStyle = "vertical-align:top;"
}

[void]$reportSB.AppendLine('<tr>')
[void]$reportSB.AppendLine("<td style='border:1px solid black;text-align:right;' width='45%'>")
[void]$reportSB.AppendLine("$($drift.ParameterName)</td>")
[void]$reportSB.AppendLine("<td style='border:1px solid black;$cellStyle' width='15%'>")
[void]$reportSB.AppendLine("$($drift.ValueInSource)</td>")
[void]$reportSB.AppendLine("<td style='border:1px solid black;' width='15%'>")
[void]$reportSB.AppendLine("$($drift.ValueInDestination)</td>")
[void]$reportSB.AppendLine("$($sourceValue)</td>")
[void]$reportSB.AppendLine("<td style='border:1px solid black;$cellDestinationStyle' width='15%'>")
[void]$reportSB.AppendLine("$($destinationValue)</td>")
[void]$reportSB.AppendLine('</tr>')

if ($null -ne $drift._Metadata_Level)
Expand Down

0 comments on commit b853391

Please sign in to comment.