diff --git a/daemon/domain/node.go b/daemon/domain/node.go index 6cb485f5..9fa4e248 100644 --- a/daemon/domain/node.go +++ b/daemon/domain/node.go @@ -4,6 +4,7 @@ package domain type Node struct { ID string `json:"id"` Label string `json:"label"` - Leaf bool `json:"leaf"` Parent string `json:"parent"` + Leaf bool `json:"leaf"` + Dir bool `json:"dir"` } diff --git a/daemon/services/core/array.go b/daemon/services/core/array.go index 48598d30..23ee9235 100644 --- a/daemon/services/core/array.go +++ b/daemon/services/core/array.go @@ -243,6 +243,7 @@ func (c *Core) GetTree(path, id string) domain.Branch { node.Label = element.Name() if element.IsDir() { + node.Dir = true // let's check if the folder is empty // we can still get an i/o error, if that's the case // we assume the folder's empty @@ -252,11 +253,7 @@ func (c *Core) GetTree(path, id string) domain.Branch { // mlog.Warning("GetTree - Unable to determine if folder is empty: %s", folder) node.Leaf = true } else { - if empty { - node.Leaf = true - } else { - node.Leaf = false - } + node.Leaf = empty } } else { node.Leaf = true diff --git a/ui/src/shared/tree/node.tsx b/ui/src/shared/tree/node.tsx index e66b31c7..d7875dde 100644 --- a/ui/src/shared/tree/node.tsx +++ b/ui/src/shared/tree/node.tsx @@ -44,7 +44,11 @@ export const TreeNode: React.FunctionComponent = ({ - {node.leaf ? icons.leafIcon : icons.parentIcon} + {node.leaf + ? node.dir + ? icons.parentIcon + : icons.leafIcon + : icons.parentIcon} {node.label} diff --git a/ui/src/state/gather.tsx b/ui/src/state/gather.tsx index 8b007219..560b0340 100644 --- a/ui/src/state/gather.tsx +++ b/ui/src/state/gather.tsx @@ -27,6 +27,7 @@ const rootNode = { id: 'root', label: '/', leaf: false, + dir: false, parent: '', }; @@ -70,6 +71,7 @@ export const useGatherStore = create()( id: 'loader', label: 'loading ...', leaf: false, + dir: false, parent: node.id, children: [], checked: false, diff --git a/ui/src/state/scatter.tsx b/ui/src/state/scatter.tsx index 67d84de7..db0f2440 100644 --- a/ui/src/state/scatter.tsx +++ b/ui/src/state/scatter.tsx @@ -25,6 +25,7 @@ const rootNode = { id: 'root', label: '/', leaf: false, + dir: false, parent: '', }; @@ -32,6 +33,7 @@ const loaderNode = { id: 'loader', label: 'loading ...', leaf: false, + dir: false, parent: 'root', }; @@ -90,6 +92,7 @@ export const useScatterStore = create()( id: 'loader', label: 'loading ...', leaf: false, + dir: false, parent: node.id, children: [], checked: false, diff --git a/ui/src/types.tsx b/ui/src/types.tsx index 965025d5..f872180e 100644 --- a/ui/src/types.tsx +++ b/ui/src/types.tsx @@ -145,6 +145,7 @@ export interface Node { id: string; label: string; leaf: boolean; + dir: boolean; parent: string; checked?: boolean; expanded?: boolean;