[REV] Optimizing the display of node state in grctl

This commit is contained in:
zhoujunhao 2018-08-08 13:07:49 +08:00
parent dace6adc33
commit 398d8c4d45
2 changed files with 8 additions and 4 deletions

View File

@ -104,10 +104,13 @@ func handleStatus(serviceTable *termtables.Table, ready bool, v *client.HostNode
status = "\033[0;32;32m running(healthy) \033[0m" status = "\033[0;32;32m running(healthy) \033[0m"
} }
if v.Unschedulable == true { if v.Unschedulable == true {
status = "\033[0;32;32m running(unschedulable) \033[0m" status = "\033[0;33;33m running(unschedulable) \033[0m"
} }
if ready == false { if ready == false {
status = "\033[0;32;32m running(unhealthy) \033[0m" status = "\033[0;33;33m running(unhealthy) \033[0m"
}
if ready == false && v.Unschedulable == true {
status = "\033[0;33;33m running(unhealthy,unschedulable) \033[0m"
} }
if v.Status == "unknown" { if v.Status == "unknown" {
status = "\033[0;31;31m unknown \033[0m" status = "\033[0;31;31m unknown \033[0m"

View File

@ -4,7 +4,6 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
"github.com/goodrain/rainbond/grctl/clients" "github.com/goodrain/rainbond/grctl/clients"
"fmt" "fmt"
"errors"
"github.com/apcera/termtables" "github.com/apcera/termtables"
"time" "time"
"strconv" "strconv"
@ -48,8 +47,10 @@ func NewCmdNotificationEvent() cli.Command {
serviceTable.AddRow(v.ServiceName, v.TenantName, v.Type, v.Message, v.Reason, v.Count, v.LastTime, v.FirstTime, v.IsHandle, v.HandleMessage) serviceTable.AddRow(v.ServiceName, v.TenantName, v.Type, v.Message, v.Reason, v.Count, v.LastTime, v.FirstTime, v.IsHandle, v.HandleMessage)
} }
fmt.Println(serviceTable.Render()) fmt.Println(serviceTable.Render())
return nil
} }
return errors.New("StartTime not null") fmt.Println("StartTime not null")
return nil
}, },
}, },
}, },