From 05ca320103a2f1cc4282c744a2fd784a2e47377b Mon Sep 17 00:00:00 2001 From: Adam Driscoll Date: Fri, 22 May 2020 13:56:58 -0600 Subject: [PATCH] Fixes --- CHANGELOG.md | 3 ++ src/v3/Components/button.jsx | 2 +- src/v3/Components/paper.jsx | 2 +- src/v3/Scripts/container.ps1 | 2 +- src/v3/Scripts/dynamic.ps1 | 4 ++- src/v3/Scripts/page.ps1 | 2 +- src/v3/example/dashboard.ps1 | 61 +++++++++++++++--------------------- src/v3/example/start.ps1 | 2 +- 8 files changed, 36 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5e4c2de..9163cb9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## v3.0.0-beta3 +### Changed + - Added dependency on Universal module - Fixed custom component loading - Updated demo dashboard +- Removed styles that made paper and buttons look weird diff --git a/src/v3/Components/button.jsx b/src/v3/Components/button.jsx index adf65830..ade7645b 100644 --- a/src/v3/Components/button.jsx +++ b/src/v3/Components/button.jsx @@ -46,7 +46,7 @@ const UdButton = props => { href={props.href} onClick={handleClick} style={{ ...props.style }} - sx={{ bg: 'primary', color: 'text' }} + //sx={{ bg: 'primary', color: 'text' }} id={props.id} > {props.iconAlignment === 'left' ? icon : null} diff --git a/src/v3/Components/paper.jsx b/src/v3/Components/paper.jsx index b4e2af76..7f3d975c 100644 --- a/src/v3/Components/paper.jsx +++ b/src/v3/Components/paper.jsx @@ -36,7 +36,7 @@ const UdPaper = (props) => { height={height} width={width} square={square} - sx={{ bg: 'primary', color: 'text'}} + //sx={{ bg: 'primary', color: 'text'}} > {props.render(props.children)} diff --git a/src/v3/Scripts/container.ps1 b/src/v3/Scripts/container.ps1 index 79c24db7..b1fd17c6 100644 --- a/src/v3/Scripts/container.ps1 +++ b/src/v3/Scripts/container.ps1 @@ -16,7 +16,7 @@ function New-UDContainer assetId = $MUAssetId type = "mu-container" - children = & $Children + children = . $Children } } } \ No newline at end of file diff --git a/src/v3/Scripts/dynamic.ps1 b/src/v3/Scripts/dynamic.ps1 index e435492b..64f134ac 100644 --- a/src/v3/Scripts/dynamic.ps1 +++ b/src/v3/Scripts/dynamic.ps1 @@ -15,6 +15,8 @@ function New-UDDynamic [ScriptBlock]$LoadingComponent = {} ) + Write-Debug "UDynamic: $id" + $Content.Register($Id, $PSCmdlet) @{ @@ -23,6 +25,6 @@ function New-UDDynamic autoRefreshInterval = $AutoRefreshInterval type = "dynamic" isPlugin = $true - loadingComponent = & $LoadingComponent + loadingComponent = . $LoadingComponent } } \ No newline at end of file diff --git a/src/v3/Scripts/page.ps1 b/src/v3/Scripts/page.ps1 index 80a49dfe..6692f778 100644 --- a/src/v3/Scripts/page.ps1 +++ b/src/v3/Scripts/page.ps1 @@ -34,7 +34,7 @@ function New-UDPage if ($OnLoading) { - $LoadingContent = & $OnLoading + $LoadingContent = . $OnLoading } diff --git a/src/v3/example/dashboard.ps1 b/src/v3/example/dashboard.ps1 index a13207b3..81e0a0fe 100644 --- a/src/v3/example/dashboard.ps1 +++ b/src/v3/example/dashboard.ps1 @@ -1,11 +1,10 @@ -$Cache:Help = @{} - +$DebugPreference = 'Continue' function New-ComponentPage { param( - [Parameter(Mandatory)] - [string]$Title, [Parameter(Mandatory)] [string]$Description, + [Parameter(Mandatory)] + [string]$Title, [Parameter()] [string]$SecondDescription, [Parameter(Mandatory)] @@ -14,9 +13,7 @@ function New-ComponentPage { [string[]]$Cmdlet ) - $AdditionalParameters = @{} - - New-UDPage @AdditionalParameters -Name $Title -Content { + New-UDPage -Name $Title -Content { New-UDContainer { New-AppBar -Title $title @@ -45,37 +42,29 @@ function New-ComponentPage { New-UDTypography -Text 'Parameters' -Variant h4 } - New-UDDynamic -Content { - foreach($item in $Cmdlet) - { - if ($Cache:Help.ContainsKey($item)) { - $Parameters = $Cache:Help[$item] - } - else - { - $Parameters = (Get-Command $item).Parameters.GetEnumerator() | ForEach-Object { - $Parameter = $_.Key - - $Help = Get-Help -Name $item -Parameter $Parameter -ErrorAction SilentlyContinue - - if ($null -ne $Help) - { - @{ - name = $Help.name - type = $Help.type.name - description = $Help.description.text - required = $Help.required - } - } - } - $Cache:Help[$item] = $Parameters - } + foreach($item in $Cmdlet) + { + $Parameters = (Get-Command $item).Parameters.GetEnumerator() | ForEach-Object { + + $Parameter = $_.Key + + $Help = Get-Help -Name $item -Parameter $Parameter -ErrorAction SilentlyContinue - if ($Parameters) + if ($null -ne $Help) { - New-UDTable -Title $item -Data $Parameters -Columns $Columns + @{ + name = $Help.name + type = $Help.type.name + description = $Help.description.text + required = $Help.required + } } } + + if ($Parameters) + { + New-UDTable -Title $item -Data $Parameters -Columns $Columns + } } } } @@ -187,7 +176,7 @@ $Pages += New-UDPage @AdditionalParameters -Name "PowerShell Universal Dashboard New-UDContainer { New-UDGrid -Container -Content { New-UDGrid -Item -SmallSize 3 -Content { - New-UDImage -Url 'https://github.com/ironmansoftware/universal-dashboard/raw/master/images/logo.png' + New-UDImage -Url 'https://github.com/ironmansoftware/universal-dashboard/raw/master/images/logo.png' -Height 128 } New-UDGrid -Item -SmallSize 9 -Content { New-UDTypography -Text 'PowerShell Universal Dashboard' -Variant h2 @@ -228,7 +217,7 @@ $Pages += New-UDPage @AdditionalParameters -Name "PowerShell Universal Dashboard } New-UDGrid -Item -SmallSize 6 -Content { - New-UDCard -Title "Get Started" -Content { + New-UDCard -Title "Documentation" -Content { New-UDElement -Tag p -Content { New-UDTypography -Text "Learn how to get up and running witrh PowerShell Universal" -Paragraph New-UDButton -Variant outlined -Text "Learn More" -OnClick { Invoke-UDRedirect -Url "https://docs.ironmansoftware.com/getting-started" } diff --git a/src/v3/example/start.ps1 b/src/v3/example/start.ps1 index 26843936..655242b2 100644 --- a/src/v3/example/start.ps1 +++ b/src/v3/example/start.ps1 @@ -25,7 +25,7 @@ try $AppToken = (Invoke-WebRequest "$Address/api/v1/apptoken/grant" -WebSession $PUWS).Content | ConvertFrom-Json Connect-UAServer -ComputerName $Address -AppToken $AppToken.Token - $Framework = Get-UDDashboardFramework | Where-Object { $_.Version.StartsWith("3")} + $Framework = Add-UDDashboardFramework -Name 'Test' -Version 'Test' -Path "$PSScriptRoot\..\output" Add-UDDashboard -Name 'Test' -FilePath "$PSScriptRoot\dashboard.ps1" -Framework $Framework -BaseUrl '/' } catch