Skip to content

Commit

Permalink
show link info in dag tree
Browse files Browse the repository at this point in the history
  • Loading branch information
treethought committed Sep 11, 2021
1 parent 30114a3 commit fc66339
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ui/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,22 @@ type DagData struct {
}

func (i *DagInfo) Update() {
fileNode := i.app.state.currentItem
i.GetRoot().ClearChildren()
fileNode := i.app.state.currentFile

// new file was selected, show dag for that
if i.currentEntry.path != fileNode.path {
i.currentEntry = fileNode
i.currentHash = fileNode.entry.Hash
}

current := i.GetCurrentNode()
if current == nil {
current = cview.NewTreeNode(fileNode.entry.Hash)
}

i.GetRoot().ClearChildren()
i.SetRoot(i.GetCurrentNode())

go i.app.ui.QueueUpdateDraw(func() {

Expand All @@ -97,6 +104,10 @@ func (i *DagInfo) Update() {
for _, l := range dag.Links {
node := cview.NewTreeNode(l.Cid.String())
node.SetReference(l)
size := cview.NewTreeNode(byteCount(l.Size))
name := cview.NewTreeNode(l.Name)
node.AddChild(name)
node.AddChild(size)
i.GetRoot().AddChild(node)
}

Expand Down

0 comments on commit fc66339

Please sign in to comment.