Skip to content

Commit

Permalink
Additional columns
Browse files Browse the repository at this point in the history
  • Loading branch information
stokito committed Dec 11, 2020
1 parent 9545dfb commit 491cd85
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
20 changes: 20 additions & 0 deletions config/columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ var defaultColumns = []Column{
Label: "Container ID",
Enabled: true,
},
{
Name: "image",
Label: "Image name",
Enabled: false,
},
{
Name: "ports",
Label: "Exposed ports",
Enabled: false,
},
{
Name: "IPs",
Label: "Exposed IPs",
Enabled: false,
},
{
Name: "created",
Label: "Date created",
Enabled: false,
},
{
Name: "cpu",
Label: "CPU Usage",
Expand Down
22 changes: 13 additions & 9 deletions cwidgets/compact/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ import (

var (
allCols = map[string]NewCompactColFn{
"status": NewStatus,
"name": NewNameCol,
"id": NewCIDCol,
"cpu": NewCPUCol,
"cpus": NewCpuScaledCol,
"mem": NewMemCol,
"net": NewNetCol,
"io": NewIOCol,
"pids": NewPIDCol,
"status": NewStatus,
"name": NewNameCol,
"id": NewCIDCol,
"image": NewImageCol,
"ports": NewPortsCol,
"IPs": NewIpsCol,
"created": NewCreatedCol,
"cpu": NewCPUCol,
"cpus": NewCpuScaledCol,
"mem": NewMemCol,
"net": NewNetCol,
"io": NewIOCol,
"pids": NewPIDCol,
}
)

Expand Down
18 changes: 18 additions & 0 deletions cwidgets/compact/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@ func NewCIDCol() CompactCol {
return c
}

func NewImageCol() CompactCol {
return &MetaCol{NewTextCol("IMAGE"), "image"}
}

func NewPortsCol() CompactCol {
return &MetaCol{NewTextCol("PORTS"), "ports"}
}

func NewIpsCol() CompactCol {
return &MetaCol{NewTextCol("IPs"), "IPs"}
}

func NewCreatedCol() CompactCol {
c := &MetaCol{NewTextCol("CREATED"), "created"}
c.fWidth = 19 // Year will be stripped e.g. "Thu Nov 26 07:44:03" without 2020 at end
return c
}

type NetCol struct {
*TextCol
}
Expand Down

0 comments on commit 491cd85

Please sign in to comment.