r/PowerShell • • 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.

16 Upvotes

16 comments sorted by

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!

8

u/MadBoyEvo Apr 04 '19

Unless you're extreamly rich and want to send me big bucks I don't want anyone to pay anything. My girlfriend is constantly asking me where is the gold from all my modules and it seems I can't deliver ;-)

There are 2 things I can consider:

  • I'm slowly looking for a new job (but not really) - remote only thou as I don't want to move and my current job is remote 95%. So if you have a job opening somewhere with proper pay I'm happy to have an interview. I've house building in progress and I'm happy here ;-)

  • Any documentation, more examples and so on. I can generate automated docs - https://github.com/EvotecIT/Dashimo/tree/master/Docs but the real deal comes from having it updated. Feel free to do PR's but it's not really necessary.

I've 2 motivation values for this:

  • making name for myself

  • driving some traffic to my website - Seeing that people have use of my blog posts, knowledge, scripts, modules... simply motivates me more.

So just spread the love and that's all I need.

Enjoy ;-)

2

u/[deleted] Apr 04 '19

Consider it spread! We are in Las Vegas and dont offer any remote positions from the company unfortunately.

Keep up the great work, I dont have any voice to speak of, but everyone appreciates your work over here!

3

u/MadBoyEvo Apr 04 '19

Enjoy ;-) Thanks for your kind words!

2

u/[deleted] Apr 04 '19 edited Apr 04 '19

Anything im still missing? Ive been scripting/c# for the last 16 hours and I am beginning to think my brain isnt working:

install-module PSWriteHTML -force

help pswritehtml

install-module dashimo -force

. 'D:\Scripts\WinsysDash\WinsysDashboard.ps1' New-HTMLTable : A parameter cannot be found that matches parameter name 'ScrollCollapse'. At C:\Program Files\WindowsPowerShell\Modules\Dashimo\0.0.2\Dashimo.psm1:88 char:153

  • ... sableStateSave -DisableSearch:$DisableSearch -ScrollCollapse:$ScrollC ...

  •                                              ~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [New-HTMLTable], ParameterBindingException

    • FullyQualifiedErrorId : NamedParameterNotFound,New-HTMLTable

Edit, scrubbed info

3

u/MadBoyEvo Apr 04 '19

ScrollCollapse

You may need to kill powershell and restart or Import-module PSWriteHTML -Force. If you have already used PSWriteHTML in session it may not update unless you do that.

2

u/[deleted] Apr 04 '19

Told you my brain was mush, thanks sir

2

u/[deleted] Apr 04 '19 edited Apr 04 '19

help new-htmltable

NAME New-HTMLTable

SYNTAX New-HTMLTable [[-DataTable] <array>] [[-Buttons] {copyHtml5 | excelHtml5 | csvHtml5 | pdfHtml5}] [[-PagingStyle] {numbers | simple | simple_numbers | full | full_numbers | first_last_numbers}] [[-PagingOptions] <int[]>] [[-Style] {display | cell-border | compact | hover | nowrap | order-column | row-border | stripe}] [[-TextWhenNoData] <string>] [-DisablePaging] [-DisableOrdering] [-DisableInfo] [-HideFooter] [-DisableColumnReorder] [-DisableProcessing] [-DisableResponsiveTable] [-DisableSelect] [-DisableStateSave] [-DisableSearch] [-Simplify] [<CommonParameters>]

ALIASES None

REMARKS None

3

u/MadBoyEvo Apr 04 '19

Import-Module PSWriteHTML -Force

It's the old module you have loaded.

2

u/[deleted] Apr 04 '19

Getting a bunch of

New-HTMLTable : A parameter cannot be found that matches parameter name 'ScreenSizePercent'.

At C:\Program Files\WindowsPowerShell\Modules\Dashimo\0.0.2\Dashimo.psm1:89 char:55

+ ... yle $Style -TextWhenNoData:$TextWhenNoData -ScreenSizePercent $Screen ...

+ ~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (:) [New-HTMLTable], ParameterBindingException

+ FullyQualifiedErrorId : NamedParameterNotFound,New-HTMLTable

But you declared it above line 88, maybe I have to update all of the other modules as well

3

u/MadBoyEvo Apr 04 '19

Install-Module Dashimo -Force

You need to update PSWriteHTML as well. and standard Update-Module Dashimo doesn't do that.

2

u/[deleted] Apr 04 '19

Did update, my bad

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.