From e5d26da89b497b21841fa1c97e8846917b49f705 Mon Sep 17 00:00:00 2001 From: Sam DeLuca Date: Thu, 14 Mar 2019 16:18:02 -0700 Subject: [PATCH 1/3] update node --- cmd/argo/commands/common.go | 6 ++++++ cmd/argo/commands/get.go | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/cmd/argo/commands/common.go b/cmd/argo/commands/common.go index d415089642fb..8994353b7ebe 100644 --- a/cmd/argo/commands/common.go +++ b/cmd/argo/commands/common.go @@ -46,6 +46,12 @@ const ( FgDefault = 39 ) +//shorthands +var ( + YellowWarning = ansiFormat("⚠", FgYellow) + RedError = ansiFormat("✖", FgRed) +) + func initializeSession() { jobStatusIconMap = map[wfv1.NodePhase]string{ wfv1.NodePending: ansiFormat("◷", FgYellow), diff --git a/cmd/argo/commands/get.go b/cmd/argo/commands/get.go index d24e3543463d..c0e34aa90702 100644 --- a/cmd/argo/commands/get.go +++ b/cmd/argo/commands/get.go @@ -114,6 +114,27 @@ func printWorkflowHelper(wf *wfv1.Workflow, outFmt string) { } } } + + errorWriter := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) + + if wf.Status.Errors != nil || wf.Status.Warnings != nil { + + fmt.Fprint(errorWriter, " STEP\tPODNAME\tCODE\tMESSAGE\n") + } + + if wf.Status.Errors != nil { + for _, errorResult := range wf.Status.Errors { + fmt.Fprintf(errorWriter, "%s %s\t%s\t%s\t%s\n", RedError, errorResult.StepName, errorResult.PodId, errorResult.Name, errorResult.Message) + } + } + + if wf.Status.Warnings != nil { + for _, warningResult := range wf.Status.Warnings { + fmt.Fprintf(errorWriter, "%s %s\t%s\t%s\t%s\n", YellowWarning, warningResult.StepName, warningResult.PodId, warningResult.Name, warningResult.Message) + } + } + _ = errorWriter.Flush() + printTree := true if wf.Status.Nodes == nil { printTree = false From 4281a39e679dfc142908b523c38a4a1856885790 Mon Sep 17 00:00:00 2001 From: Sam DeLuca Date: Thu, 14 Mar 2019 16:35:56 -0700 Subject: [PATCH 2/3] UI tweaks --- cmd/argo/commands/get.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/argo/commands/get.go b/cmd/argo/commands/get.go index c0e34aa90702..7dbb7dc09f9c 100644 --- a/cmd/argo/commands/get.go +++ b/cmd/argo/commands/get.go @@ -119,7 +119,8 @@ func printWorkflowHelper(wf *wfv1.Workflow, outFmt string) { if wf.Status.Errors != nil || wf.Status.Warnings != nil { - fmt.Fprint(errorWriter, " STEP\tPODNAME\tCODE\tMESSAGE\n") + fmt.Printf("\nErrors and Warnings:\n") + fmt.Fprintf(errorWriter, "%s\tPODNAME\tCODE\tMESSAGE\n", ansiFormat("STEP", FgDefault)) } if wf.Status.Errors != nil { From 49bc9ccdb0efffbeac0a34ae4cde295a89e6b3cf Mon Sep 17 00:00:00 2001 From: Sam DeLuca Date: Thu, 14 Mar 2019 16:36:52 -0700 Subject: [PATCH 3/3] fixing a comment --- cmd/argo/commands/common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/argo/commands/common.go b/cmd/argo/commands/common.go index 8994353b7ebe..fb46d173da31 100644 --- a/cmd/argo/commands/common.go +++ b/cmd/argo/commands/common.go @@ -46,7 +46,7 @@ const ( FgDefault = 39 ) -//shorthands +//useful icons var ( YellowWarning = ansiFormat("⚠", FgYellow) RedError = ansiFormat("✖", FgRed)