fix(app): fix app list chaos field
continuous-integration/drone/push Build is passing Details

show only the chaos version if the app is a chaos deploy
This commit is contained in:
Moritz 2023-04-14 18:01:08 +02:00
parent 31ec322c55
commit 27cac81830
1 changed files with 10 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"sort" "sort"
"strconv"
"strings" "strings"
"coopcloud.tech/abra/cli/internal" "coopcloud.tech/abra/cli/internal"
@ -249,11 +250,15 @@ can take some time.
for _, appStat := range serverStat.Apps { for _, appStat := range serverStat.Apps {
tableRow := []string{appStat.Recipe, appStat.Domain} tableRow := []string{appStat.Recipe, appStat.Domain}
if status { if status {
chaosStatus := "unknown" chaosStatus := appStat.Chaos
if appStat.ChaosVersion != "unknown" { if chaosStatus != "unknown" {
chaosStatus = appStat.ChaosVersion chaosEnabled, err := strconv.ParseBool(chaosStatus)
} else { if err != nil {
chaosStatus = appStat.Chaos logrus.Fatal(err)
}
if chaosEnabled && appStat.ChaosVersion != "unknown" {
chaosStatus = appStat.ChaosVersion
}
} }
tableRow = append(tableRow, []string{appStat.Status, chaosStatus, appStat.Version, appStat.Upgrade, appStat.AutoUpdate}...) tableRow = append(tableRow, []string{appStat.Status, chaosStatus, appStat.Version, appStat.Upgrade, appStat.AutoUpdate}...)
} }