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

Custom Component JavaScript Element ud-sparklines not working #315

Closed
pldmgg opened this issue Aug 24, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@pldmgg
Copy link

commented Aug 24, 2018

Trying to follow README.md from https://github.com/ironmansoftware/ud-sparklines ...

Issue also tracked here: ironmansoftware/ud-sparklines#1

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?

@adamdriscoll

This comment has been minimized.

Copy link
Member

commented Aug 27, 2018

This is a problem with 2.0. I had the grand plan of changing how to make custom components. It's not going to make it into this release. I'm going to revert that code and get this working again.

@adamdriscoll adamdriscoll added this to the 2.0.0 milestone Aug 27, 2018

@pldmgg

This comment has been minimized.

Copy link
Author

commented Aug 27, 2018

No worries! I'm trying to get fancy with some things, but it's by no means critical. I appreciate all the effort you're putting behind UD!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.