Add pendColor option for Pending pods
parent
99ad32ba98
commit
9f9812b897
|
|
@ -69,6 +69,7 @@ type (
|
|||
NewColor Color `yaml:"newColor"`
|
||||
ModifyColor Color `yaml:"modifyColor"`
|
||||
AddColor Color `yaml:"addColor"`
|
||||
PendingColor Color `yaml:"pendingColor"`
|
||||
ErrorColor Color `yaml:"errorColor"`
|
||||
HighlightColor Color `yaml:"highlightColor"`
|
||||
KillColor Color `yaml:"killColor"`
|
||||
|
|
@ -258,6 +259,7 @@ func newStatus() Status {
|
|||
NewColor: "lightskyblue",
|
||||
ModifyColor: "greenyellow",
|
||||
AddColor: "dodgerblue",
|
||||
PendingColor: "orangered",
|
||||
ErrorColor: "orangered",
|
||||
HighlightColor: "aqua",
|
||||
KillColor: "mediumpurple",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ var (
|
|||
// AddColor row added color.
|
||||
AddColor tcell.Color
|
||||
|
||||
// PendingColor row added color.
|
||||
PendingColor tcell.Color
|
||||
|
||||
// ErrColor row err color.
|
||||
ErrColor tcell.Color
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,25 @@ type ContainerWithMetrics interface {
|
|||
// Container renders a K8s Container to screen.
|
||||
type Container struct{}
|
||||
|
||||
// ColorGet returns a color for a state
|
||||
func ColorGet(s string,ns string, h Header, re RowEvent) tcell.Color {
|
||||
switch s {
|
||||
case Pending:
|
||||
return PendingColor
|
||||
case ContainerCreating, PodInitializing:
|
||||
return AddColor
|
||||
case Terminating, Initialized:
|
||||
return HighlightColor
|
||||
case Completed:
|
||||
return CompletedColor
|
||||
case Running:
|
||||
return DefaultColorer(ns, h, re)
|
||||
default:
|
||||
return ErrColor
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ColorerFunc colors a resource row.
|
||||
func (c Container) ColorerFunc() ColorerFunc {
|
||||
return func(ns string, h Header, re RowEvent) tcell.Color {
|
||||
|
|
@ -48,18 +67,7 @@ func (c Container) ColorerFunc() ColorerFunc {
|
|||
if stateCol == -1 {
|
||||
return DefaultColorer(ns, h, re)
|
||||
}
|
||||
switch strings.TrimSpace(re.Row.Fields[stateCol]) {
|
||||
case ContainerCreating, PodInitializing:
|
||||
return AddColor
|
||||
case Terminating, Initialized:
|
||||
return HighlightColor
|
||||
case Completed:
|
||||
return CompletedColor
|
||||
case Running:
|
||||
return DefaultColorer(ns, h, re)
|
||||
default:
|
||||
return ErrColor
|
||||
}
|
||||
return ColorGet(strings.TrimSpace(re.Row.Fields[stateCol]), ns, h, re)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ func (p Pod) ColorerFunc() ColorerFunc {
|
|||
}
|
||||
status := strings.TrimSpace(re.Row.Fields[statusCol])
|
||||
switch status {
|
||||
case Pending:
|
||||
c = PendingColor
|
||||
case ContainerCreating, PodInitializing:
|
||||
c = AddColor
|
||||
case Initialized:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ const (
|
|||
|
||||
// PodInitializing represents a pod initializing status.
|
||||
PodInitializing = "PodInitializing"
|
||||
|
||||
// Pending represents a pod pending status.
|
||||
Pending = "Pending"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ func (c *Configurator) updateStyles(f string) {
|
|||
render.AddColor = c.Styles.Frame().Status.AddColor.Color()
|
||||
render.ErrColor = c.Styles.Frame().Status.ErrorColor.Color()
|
||||
render.StdColor = c.Styles.Frame().Status.NewColor.Color()
|
||||
render.PendingColor = c.Styles.Frame().Status.PendingColor.Color()
|
||||
render.HighlightColor = c.Styles.Frame().Status.HighlightColor.Color()
|
||||
render.KillColor = c.Styles.Frame().Status.KillColor.Color()
|
||||
render.CompletedColor = c.Styles.Frame().Status.CompletedColor.Color()
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ k9s:
|
|||
modifyColor: greenyellow
|
||||
addColor: white
|
||||
errorColor: orangered
|
||||
pendingColor: orangered
|
||||
highlightcolor: aqua
|
||||
killColor: mediumpurple
|
||||
completedColor: gray
|
||||
|
|
|
|||
Loading…
Reference in New Issue