r/PowerShell • • Apr 02 '19

Dashimo - PowerShell Generated HTML Dashboard in a single file

Something that may come useful to you guys. Recently I've written Dashimo which allows creating HTML dashboards in a very easy, intuitive way. With it, you no longer have to build an object and then play with HTML to get it to display correctly in HTML.

The whole idea with screenshots is described in my blog.

https://evotec.xyz/meet-dashimo-powershell-generated-dashboard/

Dashimo generates a single HTML file that you can attach to email or host on a website. There is no DB or anything else. Keep in mind this can't be used as Email Content because it holds JS and heavy CSS. But you can attach it to email and the features it holds within that HTML are well worth it.

On my blog, I'm explicitly showing it using my Active Directory module but you can pass anything to Table. Even $Object = Get-Process if you really want to.

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard.html {
    Tab -Name 'Forest' {
        Section -Name 'Forest Information' -Invisible {
            Section -Name 'Forest Information' {
                Table -HideFooter -DataTable $DataSetForest.ForestInformation
            }
            Section -Name 'FSMO Roles' {
                Table -HideFooter -DataTable $DataSetForest.ForestFSMO
            }
        }
   }
} 

The easiest sample looks like this.

$Process = Get-Process | Select-Object -First 30

Dashboard -Name 'Dashimo Test' -FilePath $PSScriptRoot\Dashboard1.html {
    Section -Name 'Test' {
        Table -DataTable $Process
    }
}

You can have as many sections/panels as you need. Tabs also work just fine. Charts are coming sometime soon.

130 Upvotes

90 comments sorted by

View all comments

2

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

This is awesome, changing a lot of my scripts over now, first one took about 5 minutes. Very intuitive and nicely done! Is there any way for the Section to become fullsize? The -height switch just seems to make it 0 lines, with an INT from 1 to 999

3

u/MadBoyEvo Apr 02 '19

Can you test this for me?

Check your generated page HTML, edit it:

find: "paging": true, add next to it: scrollY: '90vh',

You can set paging to false. Let me know if that looks ok for you?

Alternatively:

scrollY: '90vh', scrollCollapse: true, paging: false

in place of paging true.

2

u/[deleted] Apr 02 '19

Just changing it to false works perfectly, maybe a switch -MaxSize or -FullPage, for now i will find string and replace after Dashimo.

Great darn script!

3

u/MadBoyEvo Apr 02 '19

This is code in PSWriteHTML that I'm testing now

New-HTML -TitleText 'My title' -UseCssLinks:$true -UseJavaScriptLinks:$true -FilePath $PSScriptRoot\Example15.html {
    New-HTMLContent -HeaderText 'Test' {
        New-HTMLTable -DataTable $Process -PagingOptions @(50, 100, 150, 200)
    }
}

I think I will update Dashimo and expose PagingOptions, and other parameters that the table has.

    param(
        [alias('ArrayOfObjects', 'Object', 'Table')][Array] $DataTable,
        [string[]][ValidateSet('copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5')] $Buttons = @('copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5'),
        [string[]][ValidateSet('numbers', 'simple', 'simple_numbers', 'full', 'full_numbers', 'first_last_numbers')] $PagingStyle = 'full_numbers',
        [int[]]$PagingOptions = @(15, 25, 50, 100),
        [switch]$DisablePaging,
        [switch]$DisableOrdering,
        [switch]$DisableInfo,
        [switch]$HideFooter,
        [switch]$DisableColumnReorder,
        [switch]$DisableProcessing,
        [switch]$DisableResponsiveTable,
        [switch]$DisableSelect,
        [switch]$DisableStateSave,
        [switch]$DisableSearch,
        [bool] $ScrollCollapse,
        [string[]][ValidateSet('display', 'cell-border', 'compact', 'hover', 'nowrap', 'order-column', 'row-border', 'stripe')] $Style = @('display', 'compact'),
        [switch]$Simplify,
        [string]$TextWhenNoData = 'No data available.',
        [int] $ScreenSizePercent = 0

I'll release updated version tomorrow or so. Actually scrollY: '90vh' is 90% of the screen. But if you don't have enough content things look different.

2

u/[deleted] Apr 02 '19

Very nice sir!

1

u/[deleted] Apr 02 '19

I will look at it now, thanks sir!