Skip to content

Commit

Permalink
Fixes #1002
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdriscoll committed Aug 2, 2019
1 parent 9f4a193 commit d70f657
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"workbench.colorCustomizations": {}
}
10 changes: 7 additions & 3 deletions src/UniversalDashboard.Materialize/Components/ud-treeview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div style={style.base} id={node.id}>
<div style={style.title}>
<i className={iconClass} style={iconStyle}/>

{icon}
{node.name}
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/UniversalDashboard.Materialize/Tests/treeview.tests.ps1
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
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

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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/UniversalDashboard/Cmdlets/NewTreeNodeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected override void EndProcessing()
Id = Id,
Name = Name,
Children = Children?.Invoke().Select(m => m.BaseObject).Cast<TreeNode>(),
Icon = Icon.ToString().Replace("_", "-")
Icon = Icon.GetIconName()
});
}
}
Expand Down

0 comments on commit d70f657

Please sign in to comment.