Added health row to Info Single mode.

Change color status logic.

Highlight health status for Name column:
- starting - yellow
- healthy - green
- unhealthy - magenta

reformat

Fixed misprint

Removed unused colors of state widget.

Moved changes to another branch

Removed unused colors of state widget.

Remove swarm changes from master

Remove swarm changes from master

Remove swarm changes from master
This commit is contained in:
Alexandr Kozlenkov
2017-08-23 22:38:14 +03:00
committed by Bradley Cicenas
parent eaa7ad85f8
commit 626d50d3e9
4 changed files with 41 additions and 4 deletions

View File

@ -85,6 +85,7 @@ func (cm *Docker) refresh(c *container.Container) {
c.SetMeta("image", insp.Config.Image)
c.SetMeta("ports", portsFormat(insp.NetworkSettings.Ports))
c.SetMeta("created", insp.Created.Format("Mon Jan 2 15:04:05 2006"))
c.SetMeta("health", insp.State.Health.Status)
c.SetState(insp.State.Status)
}
@ -110,6 +111,7 @@ func (cm *Docker) refreshAll() {
c := cm.MustGet(i.ID)
c.SetMeta("name", shortName(i.Names[0]))
c.SetState(i.State)
cm.HealthCheck(i.ID)
cm.needsRefresh <- c.Id
}
}
@ -158,7 +160,11 @@ func (cm *Docker) All() (containers container.Containers) {
cm.lock.Lock()
for _, c := range cm.containers {
containers = append(containers, c)
cm.lock.Unlock()
cm.HealthCheck(c.Id)
cm.lock.Lock()
}
containers.Sort()
containers.Filter()
cm.lock.Unlock()
@ -169,3 +175,9 @@ func (cm *Docker) All() (containers container.Containers) {
func shortName(name string) string {
return strings.Replace(name, "/", "", 1)
}
func (cm *Docker) HealthCheck(id string){
insp := cm.inspect(id)
c := cm.MustGet(id)
c.SetMeta("health", insp.State.Health.Status)
}