Dashimo.psm1

function Dashboard {
    [CmdletBinding()]
    param(
        [Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Dashboard requires opening and closing brace."),
        [string] $Name,
        [string] $FilePath,
        [int] $AutoRefresh # in seconds
    )
    New-HTML -TitleText $Name -UseCssLinks:$true -UseJavaScriptLinks:$true -FilePath $FilePath -AutoRefresh $AutoRefresh {
        $Object = Invoke-Command -ScriptBlock $Content
        $Object
    }
}
function Panel {
    param(
        [Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Panel requires opening and closing brace."),
        [string] $Name,
        [switch] $Invisible,
        [int] $Height
    )
    New-HTMLPanel -Invisible:$Invisible -Height $Height {
        $Object = Invoke-Command -ScriptBlock $Content
        if ($null -ne $Object) {
            $Object
        }
    }
}
function Section {
    [CmdletBinding()]
    param(
        [Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Section requires opening and closing brace."),
        [string] $Name,
        [int] $Height,
        [switch] $Collapsable,
        [switch] $Invisible
    )
    New-HTMLContent -HeaderText $Name -Height $Height -CanCollapse:$Collapsable -Invisible:$Invisible {
        $Object = Invoke-Command -ScriptBlock $Content
        if ($null -ne $Object) {
            $Object
        }
    }
}
function Tab {
    [CmdletBinding()]
    param(
        [Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Tab requires opening and closing brace."),
        [string] $Name
    )
    New-HTMLTab -TabName $Name {
        $Object = Invoke-Command -ScriptBlock $Content
        if ($null -ne $Object) {
            $Object
        }
    }
}
function Table {
    [CmdletBinding()]
    param(
        [Array] $DataTable,
        [switch] $HideFooter
    )
    New-HTMLTable -DataTable $DataTable -HideFooter:$HideFooter
}


Export-ModuleMember `
    -Function @('Dashboard','Panel','Section','Tab','Table') `
    -Alias @()