Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll committed May 22, 2020
1 parent f6cb7c5 commit 05ca320
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/v3/Components/button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Components/paper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
</Paper>
Expand Down
2 changes: 1 addition & 1 deletion src/v3/Scripts/container.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function New-UDContainer
assetId = $MUAssetId
type = "mu-container"

children = & $Children
children = . $Children
}
}
}
4 changes: 3 additions & 1 deletion src/v3/Scripts/dynamic.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ function New-UDDynamic
[ScriptBlock]$LoadingComponent = {}
)

Write-Debug "UDynamic: $id"

$Content.Register($Id, $PSCmdlet)

@{
Expand All @@ -23,6 +25,6 @@ function New-UDDynamic
autoRefreshInterval = $AutoRefreshInterval
type = "dynamic"
isPlugin = $true
loadingComponent = & $LoadingComponent
loadingComponent = . $LoadingComponent
}
}
2 changes: 1 addition & 1 deletion src/v3/Scripts/page.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function New-UDPage

if ($OnLoading)
{
$LoadingContent = & $OnLoading
$LoadingContent = . $OnLoading
}


Expand Down
61 changes: 25 additions & 36 deletions src/v3/example/dashboard.ps1
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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

Expand Down Expand Up @@ -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
}
}
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion src/v3/example/start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 05ca320

Please sign in to comment.