mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 11:44:18 +02:00
also fix color status in ccr status
This commit is contained in:
@@ -75,14 +75,15 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
|
|||||||
status[cluster] = st
|
status[cluster] = st
|
||||||
}
|
}
|
||||||
|
|
||||||
table := printer.NewTable(conf, 3, 5)
|
table := printer.NewTable(conf, 3, 6)
|
||||||
|
|
||||||
table.Addheaders("setting", "leader:"+leader, "follower:"+follower)
|
table.Addheaders("setting", "leader:"+leader, "follower:"+follower)
|
||||||
|
|
||||||
table.Entries = [][]string{
|
table.Entries = [][]string{
|
||||||
{"Cluster Name",
|
{"Cluster Name", status[leader].ClusterName, status[follower].ClusterName},
|
||||||
printer.Colorize(conf, status[leader].Status.Name, status[leader].ClusterName),
|
{"Cluster Status",
|
||||||
printer.Colorize(conf, status[follower].Status.Name, status[follower].ClusterName),
|
printer.Colorize(conf, status[leader].Status.Name, status[leader].Status.Name),
|
||||||
|
printer.Colorize(conf, status[follower].Status.Name, status[follower].Status.Name),
|
||||||
},
|
},
|
||||||
{"Active Shards",
|
{"Active Shards",
|
||||||
fmt.Sprintf("%d", status[leader].ActiveShards),
|
fmt.Sprintf("%d", status[leader].ActiveShards),
|
||||||
@@ -107,6 +108,8 @@ func checkClusterStatus(conf *cfg.Config, leader, follower string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println()
|
||||||
|
|
||||||
if status[leader].Status.Name == "green" && status[follower].Status.Name == "green" {
|
if status[leader].Status.Name == "green" && status[follower].Status.Name == "green" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
green = color.New(color.BgGreen, color.FgHiWhite).SprintFunc()
|
green = color.New(color.BgGreen, color.FgHiWhite).SprintFunc()
|
||||||
|
yellow = color.New(color.BgYellow, color.FgHiWhite).SprintFunc()
|
||||||
orange = color.BgRGB(255, 128, 0).AddRGB(0, 0, 0).SprintFunc()
|
orange = color.BgRGB(255, 128, 0).AddRGB(0, 0, 0).SprintFunc()
|
||||||
red = color.New(color.BgRed, color.FgHiWhite).SprintFunc()
|
red = color.New(color.BgRed, color.FgHiWhite).SprintFunc()
|
||||||
bold = color.New(color.Bold).SprintFunc()
|
bold = color.New(color.Bold).SprintFunc()
|
||||||
@@ -42,6 +43,8 @@ func Colorize(conf *cfg.Config, col, what string) string {
|
|||||||
what = orange(what)
|
what = orange(what)
|
||||||
case "red":
|
case "red":
|
||||||
what = red(what)
|
what = red(what)
|
||||||
|
case "yellow":
|
||||||
|
what = yellow(what)
|
||||||
}
|
}
|
||||||
|
|
||||||
return what
|
return what
|
||||||
|
|||||||
Reference in New Issue
Block a user