r/PowerShell • u/MadBoyEvo • Apr 04 '19
Script Sharing Dashimo - Conditional formatting for HTML table and more
Hi guys,
After a few days of work, I'm releasing an updated version of Dashimo.
New blog post with examples/screenshots and how to: https://evotec.xyz/dashimo-easy-table-conditional-formatting-and-more/
If you never have seen this before: https://evotec.xyz/meet-dashimo-powershell-generated-dashboard/ is an overview of what Dashimo is.
What's new:
conditional formatting
more exposed parameters to Table
description of Autorefresh
Show parameter for dashboard
Conditional formatting in action...
$Process = Get-Process | Select-Object -First 30
Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\DashboardSimplestTableConditions.html -Show {
Table -DataTable $Process -HideFooter {
TableConditionalFormatting -Name 'ID' -ComparisonType number -Operator gt -Value 10000 -Color BlueViolet -Row
TableConditionalFormatting -Name 'Name' -ComparisonType string -Operator eq -Value 'chrome' -Color White -BackgroundColor Crimson -Row
TableConditionalFormatting -Name 'PriorityClass' -ComparisonType string -Operator eq -Value 'Idle' -Color White -BackgroundColor Green
}
}Easy example:
$Process = Get-Process | Select-Object -First 30
Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\DashboardSimplestTable.html -AutoRefresh 15 -Show {
Table -DataTable $Process -DefaultSortIndex 4 -ScrollCollapse -HideFooter -Buttons @()
}Complicated, still easy example:
$Process = Get-Process | Select-Object -First 30
$Process1 = Get-Process | Select-Object -First 5
$Process2 = Get-Process | Select-Object -First 10
$Process3 = Get-Process | Select-Object -First 10
Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\DashboardEasy.html -Show {
Tab -Name 'First tab' {
Section -Name 'Test' {
Table -DataTable $Process
}
Section -Name 'Test2' {
Panel {
Table -DataTable $Process1
}
Panel {
Table -DataTable $Process1
}
}
Section -Name 'Test3' {
Table -DataTable $Process -DefaultSortColumn 'Id'
}
}
Tab -Name 'second tab' {
Panel {
Table -DataTable $Process2
}
Panel {
Table -DataTable $Process2
}
Panel {
Table -DataTable $Process3 -DefaultSortIndex 4
}
}
}Enjoy and hope you like this one.
1
u/stoneyredneck May 15 '19
I know this thread is a bit old but hoping this message finds you well. First off, you are a PS rock star. I really appreciate your modules.
I am struggling trying to do something with Dashimo.
I am attempting to export a report of all my external domains, with all the records and the values of all the records. I am wanting to make multiple sections in a single HTML, where each section is the domain name. I would then make it collapsible -collapsed.
To simplify the question, I have all my domain info in a CSV. One column is DomainName. Any idea how I would create collapsible sections for each DomainName and then dump all the records that belong to that domain in it.
Example csv
DomainName,Type, RecordName,Value
domain1.com,A,www.domain.com,10.10.10.10
domain1.com,MX,domain1.com,10 smtp.domain1.com
domain1.com,NS,domain1.com,ns1.google.com
domain2.com,A,www.domain2.com,10.10.10.10
domain2.com,MX,domain2.com,10 smtp.domain2.com
domain2.com,NS,domain2.com,ns1.google.com
I hope that makes sense. I am guessing I am just asking too much of the module but figured I would ping you and see if you had any ideas.
2
u/MadBoyEvo May 16 '19
Basic idea:
Import-Module PSWritehTML -Force Import-Module Dashimo -Force $Import = Import-CSV -LiteralPath $PSScriptRoot\Test.csv Dashboard -FilePath $PSScriptRoot\Test.Html -Show { Section -Collapsable -Name "Everything" { Table -DataTable $Import -HideFooter } $UniqueDomains = $Import.DomainName | Sort-Object -Unique foreach ($Domain in $UniqueDomains) { $TemporaryTable = $Import | Where-Object { $_.DomainName -eq $Domain } Section -Collapsable -Name "Domain - $Domain" { Table -DataTable $TemporaryTable -HideFooter } } }You can of course go and create tabs/section within sections and so on. But this should get you started.
1
u/stoneyredneck May 16 '19
I was thinking of that all backwards. Thank you for setting me straight. Many thanks.
2
u/saGot3n Apr 05 '19
Damn yesterday already used this for output lots of data nicely, now I need to update and fix them with conditional formatting!!! Great work. Love the module.
2
u/[deleted] Apr 04 '19
This is amazeballs, I'm literally wrapping 40 scripts with this module. Do you have a donate link or anything? I can also volunteer to write a comprehensive help file if that is not your thing. Not mine either, I just feel like I need to give back!