EvotecIT / PSWriteHTML

PSWriteHTML is PowerShell Module to generate beautiful HTML reports, pages, emails without any knowledge of HTML, CSS or JavaScript. To get started basics PowerShell knowledge is required.
MIT License
826 stars 106 forks source link

Linking Diagram with Tables by using New-DiagramEvent is currently broken #449

Closed h00jraq closed 2 months ago

h00jraq commented 2 months ago

I've tried following the docs and also the below article and none of the examples with using New-DiagramEvent work atm. Using Even the simple example from https://evotec.xyz/nested-tabs-diagram-updates-diagram-events-calendar object-and-more-in-pswritehtml/

$Processes = Get-Process | Select-Object -First 10
$TableID = 'RandomID'

New-HTML -TitleText 'My Title' -UseCssLinks -UseJavaScriptLinks -FilePath $PSScriptRoot\Example30-LinkedProcesses.html -ShowHTML {
    New-HTMLSection -Invisible {
        New-HTMLPanel {
            New-HTMLTable -DataTable $Processes -DataTableID $TableID
        }
        New-HTMLPanel {
            New-HTMLDiagram -Height '1000px' {
                New-DiagramEvent -ID $TableID -ColumnID 1
                New-DiagramNode -Label 'Processes' -IconBrands delicious
                foreach ($_ in $Processes) {
                    New-DiagramNode -Label $_.ProcessName -Id $_.Id -To 'Processes'
                }
            }
        }
    }
}

When you click on the Diagram Node, nothing is highlited/selected in the table. Tried other examples and they also did not worked. Dev Console in chrome only shows: image

P.S @PrzemyslawKlys we have talked about this today on LinkedIn. Filip here :)

PrzemyslawKlys commented 2 months ago

The issue is now fixed. Keep in mind that ColumnID needs to match the order of the column in the table. So if you Id column which are you referencing in New-DiagramNode is first it should be 0, but if notice Get-Process sometimes puts it on 9th location which won't work.

$Processes = Get-Process | Select-Object -First 10 -property Id, ProcessName
$TableID = 'RandomID'

New-HTML -TitleText 'My Title' -FilePath $PSScriptRoot\Example30-LinkedProcesses.html {
    New-HTMLSection -Invisible {
        New-HTMLPanel {
            New-HTMLTable -DataTable $Processes -DataTableID $TableID -DataStore JavaScript
        }
        New-HTMLPanel {
            New-HTMLDiagram -Height '1000px' {
                New-DiagramEvent -ID $TableID -ColumnID 0
                New-DiagramNode -Label 'Processes' -IconBrands delicious
                foreach ($_ in $Processes) {
                    New-DiagramNode -Label $_.ProcessName -Id $_.Id -To 'Processes'
                }
            }
        }
    }
} -Online