-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1087 from ironmansoftware/1086
Fixes #1086
- Loading branch information
Showing
9 changed files
with
120 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
function New-UDTreeView { | ||
param( | ||
[Parameter()] | ||
[string]$Id = [Guid]::NewGuid(), | ||
[Parameter(Mandatory)] | ||
[Hashtable]$Node, | ||
[Parameter()] | ||
[object]$OnNodeClicked, | ||
[Parameter()] | ||
[DashboardColor]$BackgroundColor, | ||
[Parameter()] | ||
[DashboardColor]$FontColor = 'black', | ||
[Parameter()] | ||
[DashboardColor]$ActiveBackgroundColor = '0xDFE8E4', | ||
[Parameter()] | ||
[DashboardColor]$ToggleColor = 'black' | ||
) | ||
|
||
End { | ||
if ($null -ne $OnNodeClicked) { | ||
if ($OnNodeClicked -is [scriptblock]) { | ||
$OnNodeClicked = New-UDEndpoint -Endpoint $OnNodeClicked -Id $Id | ||
} | ||
elseif ($OnNodeClicked -isnot [UniversalDashboard.Models.Endpoint]) { | ||
throw "OnNodeClicked must be a script block or UDEndpoint" | ||
} | ||
} | ||
|
||
|
||
@{ | ||
assetId = $AssetId | ||
isPlugin = $true | ||
id = $Id | ||
type = 'ud-treeview' | ||
|
||
node = $Node | ||
hasCallback = $null -ne $OnNodeClicked | ||
backgroundColor = $BackgroundColor.HtmlColor | ||
fontColor = $FontColor.HtmlColor | ||
activeBackgroundColor = $ActiveBackgroundColor.HtmlColor | ||
toggleColor = $ToggleColor.HtmlColor | ||
} | ||
} | ||
} | ||
|
||
function New-UDTreeNode { | ||
param( | ||
[Parameter(Mandatory, Position = 1)] | ||
[string]$Name, | ||
[Parameter()] | ||
[string]$Id, | ||
[Parameter()] | ||
[ScriptBlock]$Children, | ||
[Parameter()] | ||
[UniversalDashboard.Models.FontAwesomeIcons]$Icon, | ||
[Parameter()] | ||
[UniversalDashboard.Models.FontAwesomeIcons]$ExpandedIcon | ||
) | ||
|
||
End { | ||
if ($PSBoundParameters.ContainsKey("Icon")) { | ||
$IconName = [UniversalDashboard.Models.FontAwesomeIconsExtensions]::GetIconName($Icon) | ||
} | ||
|
||
if ($PSBoundParameters.ContainsKey("ExpandedIcon")) { | ||
$ExpandedIconName = [UniversalDashboard.Models.FontAwesomeIconsExtensions]::GetIconName($ExpandedIcon) | ||
} | ||
|
||
$ChildrenArray = $null | ||
if ($PSBoundParameters.ContainsKey("Children")) | ||
{ | ||
$ChildrenArray = & $Children | ||
} | ||
|
||
@{ | ||
name = $Name | ||
id = $Id | ||
children = $ChildrenArray | ||
icon = $IconName | ||
expandedIcon = $ExpandedIconName | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 0 additions & 51 deletions
51
src/UniversalDashboard.UITest/Integration/TreeView.Tests.ps1
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters