refactor!: upgrade/rollback vertical render / ui fixes
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
See toolshed/organising#658
This commit is contained in:
parent
7ec61c6d03
commit
356e527f1f
@ -250,7 +250,6 @@ beforehand.`,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if showReleaseNotes {
|
if showReleaseNotes {
|
||||||
fmt.Println()
|
|
||||||
fmt.Print(releaseNotes)
|
fmt.Print(releaseNotes)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -42,13 +42,13 @@ func NewVersionOverview(
|
|||||||
app appPkg.App,
|
app appPkg.App,
|
||||||
warnMessages []string,
|
warnMessages []string,
|
||||||
kind,
|
kind,
|
||||||
currentVersion,
|
deployedVersion,
|
||||||
chaosVersion,
|
deployedChaosVersion,
|
||||||
newVersion,
|
toDeployVersion,
|
||||||
releaseNotes string) error {
|
releaseNotes string) error {
|
||||||
deployConfig := "compose.yml"
|
deployConfig := "compose.yml"
|
||||||
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
||||||
deployConfig = strings.Join(strings.Split(composeFiles, ":"), "\n")
|
deployConfig = composeFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
server := app.Server
|
server := app.Server
|
||||||
@ -61,32 +61,30 @@ func NewVersionOverview(
|
|||||||
domain = config.NO_DOMAIN_DEFAULT
|
domain = config.NO_DOMAIN_DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
body := strings.Builder{}
|
rows := [][]string{
|
||||||
body.WriteString(
|
[]string{"APP", domain},
|
||||||
borderStyle.Render(
|
[]string{"RECIPE", app.Recipe.Name},
|
||||||
lipgloss.JoinVertical(
|
[]string{"SERVER", server},
|
||||||
lipgloss.Center,
|
[]string{"DEPLOYED", deployedVersion},
|
||||||
headerStyle.Render(fmt.Sprintf("%s OVERVIEW", strings.ToUpper(kind))),
|
[]string{"CURRENT CHAOS ", deployedChaosVersion},
|
||||||
lipgloss.JoinVertical(
|
[]string{fmt.Sprintf("TO %s", strings.ToUpper(kind)), toDeployVersion},
|
||||||
lipgloss.Left,
|
[]string{"CONFIG", deployConfig},
|
||||||
horizontal(leftStyle.Render("SERVER"), " ", rightStyle.Render(server)),
|
}
|
||||||
horizontal(leftStyle.Render("DOMAIN"), " ", rightStyle.Render(domain)),
|
|
||||||
horizontal(leftStyle.Render("RECIPE"), " ", rightStyle.Render(app.Recipe.Name)),
|
|
||||||
horizontal(leftStyle.Render("CONFIG"), " ", rightStyle.Render(deployConfig)),
|
|
||||||
horizontal(leftStyle.Render("VERSION"), " ", rightStyle.Render(currentVersion)),
|
|
||||||
horizontal(leftStyle.Render("CHAOS"), " ", rightStyle.Render(chaosVersion)),
|
|
||||||
horizontal(leftStyle.Render("DEPLOY"), " ", rightStyle.Padding(0).Render(newVersion)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
fmt.Println(body.String())
|
|
||||||
|
|
||||||
if releaseNotes != "" && newVersion != "" {
|
overview := formatter.CreateOverview(
|
||||||
fmt.Println()
|
fmt.Sprintf("%s OVERVIEW", strings.ToUpper(kind)),
|
||||||
|
rows,
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt.Println(overview)
|
||||||
|
|
||||||
|
if releaseNotes != "" && toDeployVersion != "" {
|
||||||
fmt.Print(releaseNotes)
|
fmt.Print(releaseNotes)
|
||||||
} else {
|
} else {
|
||||||
warnMessages = append(warnMessages, fmt.Sprintf("no release notes available for %s", newVersion))
|
warnMessages = append(
|
||||||
|
warnMessages,
|
||||||
|
fmt.Sprintf("no release notes available for %s", toDeployVersion),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, msg := range warnMessages {
|
for _, msg := range warnMessages {
|
||||||
@ -120,7 +118,7 @@ func DeployOverview(
|
|||||||
toDeployChaosVersion string) error {
|
toDeployChaosVersion string) error {
|
||||||
deployConfig := "compose.yml"
|
deployConfig := "compose.yml"
|
||||||
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
||||||
deployConfig = strings.Join(strings.Split(composeFiles, ":"), "\n")
|
deployConfig = composeFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
server := app.Server
|
server := app.Server
|
||||||
@ -176,7 +174,7 @@ func UndeployOverview(
|
|||||||
chaosVersion string) error {
|
chaosVersion string) error {
|
||||||
deployConfig := "compose.yml"
|
deployConfig := "compose.yml"
|
||||||
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
if composeFiles, ok := app.Env["COMPOSE_FILE"]; ok {
|
||||||
deployConfig = strings.Join(strings.Split(composeFiles, ":"), "\n")
|
deployConfig = composeFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
server := app.Server
|
server := app.Server
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
|
|
||||||
"coopcloud.tech/abra/pkg/envfile"
|
"coopcloud.tech/abra/pkg/envfile"
|
||||||
|
"coopcloud.tech/abra/pkg/formatter"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r Recipe) SampleEnv() (map[string]string, error) {
|
func (r Recipe) SampleEnv() (map[string]string, error) {
|
||||||
@ -29,7 +30,10 @@ func (r Recipe) GetReleaseNotes(version string) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
withTitle := fmt.Sprintf("%s release notes:\n%s", version, string(releaseNotes))
|
|
||||||
|
title := formatter.BoldStyle.Render(fmt.Sprintf("%s release notes:", version))
|
||||||
|
withTitle := fmt.Sprintf("%s\n%s\n", title, releaseNotes)
|
||||||
|
|
||||||
return withTitle, nil
|
return withTitle, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user