ui view Channels: LastUpdate

pull/1/head
Edouard Paris 5 years ago
parent e853349da2
commit 5d535bea0f

@ -60,30 +60,40 @@ func (c *Channels) Set(g *gocui.Gui, x0, y0, x1, y1 int) error {
func displayChannelsColumns(v *gocui.View) { func displayChannelsColumns(v *gocui.View) {
v.Clear() v.Clear()
fmt.Fprintln(v, fmt.Sprintf("%-9s %-26s %12s %12s %5s", fmt.Fprintln(v, fmt.Sprintf("%-9s %-26s %12s %12s %5s %16s",
"Status", "Status",
"Gauge", "Gauge",
"Local", "Local",
"Capacity", "Capacity",
"pHTLC", "pHTLC",
"Last Update",
)) ))
} }
func (c *Channels) display(v *gocui.View) { func (c *Channels) display(v *gocui.View) {
v.Clear() v.Clear()
for _, item := range c.channels.List() { for _, item := range c.channels.List() {
line := fmt.Sprintf("%s %s %s %12d %5d %500s", line := fmt.Sprintf("%s %s %s %12d %5d %16s %500s",
active(item), active(item),
gauge(item), gauge(item),
color.Cyan(fmt.Sprintf("%12d", item.LocalBalance)), color.Cyan(fmt.Sprintf("%12d", item.LocalBalance)),
item.Capacity, item.Capacity,
len(item.PendingHTLC), len(item.PendingHTLC),
lastUpdate(item),
"", "",
) )
fmt.Fprintln(v, line) fmt.Fprintln(v, line)
} }
} }
func lastUpdate(c *netmodels.Channel) string {
if c.LastUpdate != nil {
return c.LastUpdate.Format("15:04:05 Jan _2")
}
return ""
}
func active(c *netmodels.Channel) string { func active(c *netmodels.Channel) string {
if c.Active { if c.Active {
return color.Green(fmt.Sprintf("%-9s", "active")) return color.Green(fmt.Sprintf("%-9s", "active"))

Loading…
Cancel
Save