Skip to content

Commit

Permalink
Adam Driscoll - 2022 (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll authored Aug 19, 2022
1 parent 88b95f7 commit dc3e9b1
Show file tree
Hide file tree
Showing 30 changed files with 53,892 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
New-PSUDashboard -Name "Dashboard" -FilePath "dashboards\Dashboard\Dashboard.ps1" -BaseUrl "/dashboard" -Framework "UniversalDashboard:Latest" -Authenticated -SessionTimeout 0 -AutoDeploy
New-PSUDashboard -Name "Chatroom" -FilePath "dashboards\Chatroom\Chatroom.ps1" -BaseUrl "/chatroom" -Framework "UniversalDashboard:Latest" -Authenticated -SessionTimeout 0 -AutoDeploy
New-PSUDashboard -Name "Integration" -FilePath "dashboards\Integration\Integration.ps1" -BaseUrl "/integration" -Framework "UniversalDashboard:Latest" -Authenticated -SessionTimeout 0 -AutoDeploy
New-PSUDashboard -Name "Components" -FilePath "dashboards\Components\Components.ps1" -BaseUrl "/components" -Framework "UniversalDashboard:Latest" -Authenticated -SessionTimeout 0 -AutoDeploy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New-PSUScript -Name "CreatePizza.ps1" -Path "CreatePizza.ps1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
param(
[switch]$ExtraCheese,
[string]$OrderName,
[DateTime]$DeliveryDate
)

$ExtraCheese
$OrderName
$DeliveryDate
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
New-UDDashboard -Title 'Chatroom' -Content {
Show-UDToast "$User joined the room!" -Broadcast

if (-not $Cache:Messages) {
$Cache:Messages = [System.Collections.Generic.List[string]]::new()
}

if (-not $Cache:GuestList) {
$Cache:GuestList = [System.Collections.Generic.List[string]]::new()
}

if (-not $Cache:GuestList.Contains($User)) {
$Cache:GuestList.Add($User)
Sync-UDElement -Id 'guestList'
}


New-UDRow -Columns {
New-UDColumn -LargeSize 10 -Content {
New-UDDynamic -Id 'chatroom' -Content {
$Messages = ""
if ($Cache:Messages) {
$Messages = $Cache:Messages -join ([Environment]::NewLine)
}
New-UDTextbox -Multiline -Rows 10 -FullWidth -Value $Messages
}
}
New-UDColumn -LargeSize 2 -Content {
New-UDDynamic -Id 'guestList' -Content {
New-UDList -Children {
$Cache:GuestList | ForEach-Object {
New-UDListItem -Label $_
}
}
}
}
}

New-UDForm -Content {
New-UDTextbox -Id 'message' -Label 'message'
} -OnSubmit {
$Message = "[$(Get-Date)] $User - $($EventData.message)"
$Cache:Messages.Add($Message)
Sync-UDElement -Id 'chatroom' -Broadcast
Set-UDElement -Id 'message' -Properties @{
value = ''
}
}

New-UDFloatingActionButton -Icon (New-UDIcon -Icon cog) -OnClick {
Show-UDModal -Content {
New-UDButton -Text 'Clear Chatroom' -OnClick {
$Cache:Messages = [System.Collections.Generic.List[string]]::new()
Sync-UDElement -Id 'chatroom' -Broadcast
}
} -Header {
New-UDTypography "Toolbox"
}
} -Position bottomRight

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
New-UDDashboard -Title 'PowerShell Universal' -Content {
$Nodes = 1..5 | % { New-UDDiagramNode -Id "node$_" -Name "node$_" -OutPort 'out' -InPort 'in' -Color blue -xOffset (100 * $_) }
$Links = 1..4 | % { New-UDDiagramLink -OutNode "node$_" -OutPort 'out' -InNode "node$($_ + 1)" -InPort 'in' }

New-UDDiagram -Node $Nodes -Link $Links -Locked -OnSelected {
Show-UDToast -Message $EventData
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
$Theme = Get-UDTheme -Name 'AntDesign'

New-UDDashboard -Title 'PowerShell Conference EU 2022' -Content {
New-UDImage -Url 'https://psconf.eu/wp-content/uploads/2022/01/psconfeu_logo_300.png'
New-UDTypography -Text 'PowerShell Conference EU 2022' -Variant h4

New-UDDynamic -Content {
$data = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -First 10 | ForEach-Object {
[PSCustomObject]@{
Name = $_.Name
Value = $_.CPU
Id = $_.Id
}
}
New-UDNivoChart -Bar -Keys "value" -IndexBy 'name' -Data $Data -Height 500 -Width 1000 -Id 'cpuChart' -Colors @{
scheme = "category10"
}

New-UDTable -Data $data -Columns @(
New-UDTableColumn -Property 'Name' -Title 'Name'
New-UDTableColumn -Property 'Value' -Title 'Value'
New-UDTableColumn -Property 'Actions' -Render {
New-UDButton -Text 'Stop' -OnClick {
Stop-Process -Id $EVentData.Id
}
}
)
} -AutoRefresh -AutoRefreshInterval 1

New-UDCard -Content {
New-UDForm -Content {
New-UDTextbox -Id 'file' -Placeholder 'File'
New-UDTextbox -Id 'arguments' -Placeholder 'Arguments'
New-UDSwitch -Id 'admin' -Label 'As Administrator?'
} -OnSubmit {
$verb = ""
if ($EventData.admin) {
$verb = "runas"
}

Start-Process -FilePath $EventData.File -ArgumentList $EventData.Arguments -Verb $verb
}
}
} -Theme $Theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
New-UDDashboard -Title 'PowerShell Universal' -Content {
New-UDForm -Content {
New-UDTextbox -Id 'name' -Label Name
} -OnSubmit {
Invoke-PSUScript -Name 'CreatePizza.ps1' -OrderName $EventData.Name -Integrated -Wait | ConvertTo-Json

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import-module C:\src\udjoyride\output\UniversalDashboard.Joyride.psd1

New-UDDashboard -Title 'PowerShell Universal' -Content {
New-UDJoyride -Id 'joyride' -Step @(
New-UDJoyrideStep -Target '#alert' -Text 'Alerts are used to highlight text.'
New-UDJoyrideStep -Target '#card' -Text 'Cards highlight functional groups.'
)

New-UDButton -Text 'Start' -OnClick {
Set-UDElement -Id 'joyride' -Properties @{
run = $true
}
}

New-UDAlert -Id 'alert' -Text 'This is an alert!'
New-UDCard -Id 'card' -Text 'This is a card!' -Title 'Card'
}
Binary file not shown.
24 changes: 24 additions & 0 deletions AdamDriscoll/Deep Dive into Universal Dashboard/demos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Getting Started

- Creating a dashboard
- Components
- Chart
- Form
- Images
- Text
- Tables

# Templates

# Interaction

- Chatroom

# PSU Integration

- Calling scripts and returning output
- Schedules jobs

# Extensiblity

- React Joyride Example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
New-PSUDashboard -Name "Services" -FilePath "dashboards\Services\Services.ps1" -BaseUrl "/Services" -Framework "UniversalDashboard:Latest" -SessionTimeout 0 -AutoDeploy
New-PSUDashboard -Name "Launch" -FilePath "dashboards\Launch\Launch.ps1" -BaseUrl "/launch" -Framework "UniversalDashboard:Latest" -Authenticated -SessionTimeout 0 -AutoDeploy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New-PSUFileAssociation -Script "fileAssociation.ps1" -Environment "Default" -Credential "Default" -Extension ".ps3"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New-PSUHotKey -Script "Hotkey.ps1" -Credential "Default" -ModifierKeys "Alt" -Keys "S" -Page 'Services'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New-PSUProtocolHandler -Script "protocol.ps1" -Environment "Default" -Credential "Default" -Protocol "psu"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
New-PSUScript -Name "StartProcess.ps1" -Path "StartProcess.ps1" -InformationAction "Continue" -Anonymous
New-PSUScript -Name "Hotkey.ps1" -Path "Hotkey.ps1" -InformationAction "Continue"
New-PSUScript -Name "protocol.ps1" -Path "protocol.ps1" -InformationAction "Continue"
New-PSUScript -Name "fileAssociation.ps1" -Path "fileAssociation.ps1" -InformationAction "Continue"
New-PSUScript -Name "systemEvent.ps1" -Path "systemEvent.ps1" -InformationAction "Continue"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New-PSUSystemEvent -Script "systemEvent.ps1" -Environment "Default" -Credential "Default" -Type "Create" -Condition "TargetInstance isa `"Win32_Process`" and TargetInstance.Name = `"pwsh.exe`"" -Name "PowerShell Started"
Loading

0 comments on commit dc3e9b1

Please sign in to comment.