From d70f6577ec0bc03012012ffaf485c9c38aa6d8da Mon Sep 17 00:00:00 2001 From: Adam Driscoll Date: Fri, 2 Aug 2019 17:32:02 -0600 Subject: [PATCH] Fixes #1002 --- src/.vscode/settings.json | 3 +++ .../Components/ud-treeview.jsx | 10 +++++++--- .../Tests/treeview.tests.ps1 | 7 ++++--- src/UniversalDashboard/Cmdlets/NewTreeNodeCommand.cs | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 src/.vscode/settings.json diff --git a/src/.vscode/settings.json b/src/.vscode/settings.json new file mode 100644 index 00000000..56422821 --- /dev/null +++ b/src/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "workbench.colorCustomizations": {} +} \ No newline at end of file diff --git a/src/UniversalDashboard.Materialize/Components/ud-treeview.jsx b/src/UniversalDashboard.Materialize/Components/ud-treeview.jsx index cd5ea118..0cc92d8a 100644 --- a/src/UniversalDashboard.Materialize/Components/ud-treeview.jsx +++ b/src/UniversalDashboard.Materialize/Components/ud-treeview.jsx @@ -45,14 +45,18 @@ export default class UDTreeView extends React.Component { decorators.Header = ({style, node}) => { const iconType = node.icon; - const iconClass = `fa fa-${iconType}`; const iconStyle = {marginRight: '5px'}; + + var icon = UniversalDashboard.renderComponent({ + type: 'icon', + icon: iconType, + style: iconStyle + }) return (
- - + {icon} {node.name}
diff --git a/src/UniversalDashboard.Materialize/Tests/treeview.tests.ps1 b/src/UniversalDashboard.Materialize/Tests/treeview.tests.ps1 index cb95f657..94cb6ee4 100644 --- a/src/UniversalDashboard.Materialize/Tests/treeview.tests.ps1 +++ b/src/UniversalDashboard.Materialize/Tests/treeview.tests.ps1 @@ -1,7 +1,8 @@ Describe "New-UDTreeView" { + Context "TreeView" { Set-TestDashboard { - $DomainNode = New-UDTreeNode -Name "Domain" -Id "domain" + $DomainNode = New-UDTreeNode -Name "Domain" -Id "domain" -Icon user New-UDTreeView -Node $DomainNode -OnNodeClicked { param($Body) $Obj = $Body | ConvertFrom-Json @@ -9,14 +10,14 @@ Describe "New-UDTreeView" { if ($Obj.NodeId -eq 'domain') { 1..10 | % { - New-UDTreeNode -Name $_ -Id $_ + New-UDTreeNode -Name $_ -Id $_ -Icon user } } else { 1..10 | % { $Name = $Obj.NodeId * $_ - New-UDTreeNode -Name $Name -Id $Name + New-UDTreeNode -Name $Name -Id $Name -Icon user } } } diff --git a/src/UniversalDashboard/Cmdlets/NewTreeNodeCommand.cs b/src/UniversalDashboard/Cmdlets/NewTreeNodeCommand.cs index ec2f8303..e57bce60 100644 --- a/src/UniversalDashboard/Cmdlets/NewTreeNodeCommand.cs +++ b/src/UniversalDashboard/Cmdlets/NewTreeNodeCommand.cs @@ -28,7 +28,7 @@ protected override void EndProcessing() Id = Id, Name = Name, Children = Children?.Invoke().Select(m => m.BaseObject).Cast(), - Icon = Icon.ToString().Replace("_", "-") + Icon = Icon.GetIconName() }); } }