Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example from README.md not displaying sparklines #1

Open
pldmgg opened this issue Aug 24, 2018 · 0 comments
Open

Example from README.md not displaying sparklines #1

pldmgg opened this issue Aug 24, 2018 · 0 comments

Comments

@pldmgg
Copy link

pldmgg commented Aug 24, 2018

Trying to follow README.md ...

Issue also tracked here: ironmansoftware/universal-dashboard#315

To recreate issue, on Win 10 or Server 2012 R2/2016 in Windows PowerShell 5.1, do the following:

Install-Module -Name UniversalDashboard.Community -AllowPrerelease
# NOTE: UniversalDashboard.Community is 2.0.0-beta2
Save-Module -Name UniversalDashboard.Sparklines -Path "$HOME\Documents\WindowsPowerShell\Modules"

# Remove the UniversalDashboard Module that is automatically downloaded since it is designated
# under RequiredModules in the UniversalDashboard.Sparklines Manifest
Remove-Item -Recurse "$HOME\Documents\WindowsPowerShell\Modules\UniversalDashboard" -Force

# Change Module Manifest RequiredModules from 'UniversalDashboard' to 'UniversalDashboard.Community'
Remove-Item "$HOME\Documents\WindowsPowerShell\Modules\UniversalDashboard.Sparklines\0.1.1\PSGetModuleInfo.xml" -Force
$ManifestPath = "$HOME\Documents\WindowsPowerShell\Modules\UniversalDashboard.Sparklines\0.1.1\UniversalDashboard.Sparklines.psd1"
$ManifestContent = Get-Content -Path $ManifestPath
$ManifestContent -replace 'RequiredModules = @\(.*?\)',
'RequiredModules = @("UniversalDashboard.Community")' | Set-Content -Path $ManifestPath

# Create the UD-Test function that copies the example in the ud-sparklines README.md
Set-Content -Path "$HOME\Test-UD.ps1" -Value @'
function Test-UD {
    Param (
        [Parameter(Mandatory=$False)]
        [switch]$RemoveAllOtherUDDashboards = $True
    )

    if ($RemoveAllOtherUDDashboards) {
        Get-UDDashboard | Stop-UDDashboard
    }

    $MyDashboard = New-UDDashboard -Title "Hello, World" -Content {
        New-UDTable -Title "Users" -Headers @("Name", "Emails per Day") -Endpoint {
            Import-Module UniversalDashboard.Sparklines
            @(
                [PSCustomObject]@{"Name" = "Adam"; Values = @(12,12,4,2,75,23,54,12); Color = "#234254"}
                [PSCustomObject]@{"Name" = "Jon"; Values = @(2,42,33,21,11,3,32,9); Color = "#453423"}
                [PSCustomObject]@{"Name" = "Bill"; Values = @(1,92,40,21,7,3,2,12); Color = "#923923"}
                [PSCustomObject]@{"Name" = "Ted"; Values = @(112,11,41,2,5,63,74,12); Color = "#A43534"}
                [PSCustomObject]@{"Name" = "Tommy"; Values = @(12,2,42,21,18,26,26,19); Color = "#593493"}
            ) | ForEach-Object {
                [PSCustomObject]@{
                    Name = $_.Name
                    Sparkline = New-UDSparkline -Data $_.Values -Color $_.Color
                }
            } | Out-UDTableData -Property @("Name", "Sparkline")
        }
    }

    Start-UDDashboard -Dashboard $MyDashboard
}
'@

. "$HOME\Test-UD.ps1"

Import-Module UniversalDashboard.Community
Test-UD

Navigating to http://localhost/home only shows the UDTable headers and no content. No errors are displayed on the page.

Do I need the WebSockets Feature installed or something like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant