views channels: column SENT and RECEIVED

pull/10/head
Edouard Paris 5 years ago
parent acb181ebed
commit 80fff31770

@ -51,6 +51,8 @@ pool_capacity = 3
# GAUGE ascii bar with percent local/capacity
# LOCAL the local amount of the channel
# CAP the total capacity of the channel
# SENT the total amount sent
# RECEIVED the total amount received
# HTLC the number of pending HTLC
# UNSETTLED the amount unsettled in the channel
# CFEE the commit fee
@ -64,6 +66,8 @@ columns = [
"GAUGE",
"LOCAL",
"CAP",
"SENT",
"RECEIVED",
"HTLC",
"UNSETTLED",
"CFEE",

@ -34,6 +34,8 @@ pool_capacity = %[11]d
# GAUGE ascii bar with percent local/capacity
# LOCAL the local amount of the channel
# CAP the total capacity of the channel
# SENT the total amount sent
# RECEIVED the total amount received
# HTLC the number of pending HTLC
# UNSETTLED the amount unsettled in the channel
# CFEE the commit fee
@ -47,6 +49,8 @@ columns = [
"GAUGE",
"LOCAL",
"CAP",
"SENT",
"RECEIVED",
"HTLC",
"UNSETTLED",
"CFEE",

@ -26,6 +26,8 @@ var DefaultChannelsColumns = []string{
"GAUGE",
"LOCAL",
"CAP",
"SENT",
"RECEIVED",
"HTLC",
"UNSETTLED",
"CFEE",
@ -354,6 +356,32 @@ func NewChannels(cfg *config.View, chans *models.Channels) *Channels {
return color.White(opts...)(printer.Sprintf("%12d", c.Capacity))
},
}
case "SENT":
channels.columns[i] = channelsColumn{
width: 12,
name: fmt.Sprintf("%12s", columns[i]),
sort: func(order models.Order) models.ChannelsSort {
return func(c1, c2 *netmodels.Channel) bool {
return models.Int64Sort(c1.TotalAmountSent, c2.TotalAmountSent, order)
}
},
display: func(c *netmodels.Channel, opts ...color.Option) string {
return color.Cyan(opts...)(printer.Sprintf("%12d", c.TotalAmountSent))
},
}
case "RECEIVED":
channels.columns[i] = channelsColumn{
width: 12,
name: fmt.Sprintf("%12s", columns[i]),
sort: func(order models.Order) models.ChannelsSort {
return func(c1, c2 *netmodels.Channel) bool {
return models.Int64Sort(c1.TotalAmountReceived, c2.TotalAmountReceived, order)
}
},
display: func(c *netmodels.Channel, opts ...color.Option) string {
return color.Cyan(opts...)(printer.Sprintf("%12d", c.TotalAmountReceived))
},
}
case "HTLC":
channels.columns[i] = channelsColumn{
width: 5,

Loading…
Cancel
Save