Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddlet2666 committed May 10, 2024
1 parent 594f149 commit cb016c8
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions pkg/cmd/monitor_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var (
selectedCache string
selectedTopic string
allBaseData []string
heightAdjust int
)

var validPanels = []panelImpl{
Expand Down Expand Up @@ -285,20 +286,25 @@ func increaseMaxHeight() {
for i := range validPanels {
validPanels[i].MaxHeight++
}
heightAdjust++
}

func decreaseMaxHeight() {
for i := range validPanels {
if validPanels[i].MaxHeight > validPanels[i].OriginalMaxHeight {
validPanels[i].MaxHeight--
if heightAdjust > 0 {
for i := range validPanels {
if validPanels[i].MaxHeight > validPanels[i].OriginalMaxHeight {
validPanels[i].MaxHeight--
}
}
heightAdjust--
}
}

func resetMaxHeight() {
for i := range validPanels {
validPanels[i].MaxHeight = validPanels[i].OriginalMaxHeight
}
heightAdjust = 0
}

func refresh(screen tcell.Screen, dataFetcher fetcher.Fetcher, parsedLayout []string, refresh bool) error {
Expand Down Expand Up @@ -1183,17 +1189,25 @@ func trimBlankContent(content []string) []string {

// drawHeader draws the screen header with cluster information.
func drawHeader(screen tcell.Screen, w, h int, cluster config.Cluster, dataFetcher fetcher.Fetcher) {
var title string
var (
title string
padding = " "
height = "0"
)
if cluster.ClusterName == "" && ignoreRESTErrors {
title = errorContent + " from " + dataFetcher.GetURL()
} else {
version := strings.Split(cluster.Version, " ")
padding := " "
if padMaxHeightParam {
padding = "P"
}
title = fmt.Sprintf("Coherence CLI: %s - Monitoring cluster %s (%s) ESC to quit %s. %s (%v)",
time.Now().Format(time.DateTime), cluster.ClusterName, version[0], additionalMonitorMsg, padding, lastDuration)
if heightAdjust <= 0 {
height = " 0 "
} else if heightAdjust > 0 {
height = fmt.Sprintf("+%v ", heightAdjust)
}
title = fmt.Sprintf("Coherence CLI: %s - Monitoring cluster %s (%s) ESC to quit %s. %s%s(%v)",
time.Now().Format(time.DateTime), cluster.ClusterName, version[0], additionalMonitorMsg, padding, height, lastDuration)
}
drawText(screen, 1, 0, w-1, h-1, tcell.StyleDefault.Reverse(true), title)
}
Expand Down

0 comments on commit cb016c8

Please sign in to comment.