From f5c8bc05dea4e31a00a74817e1109afffa3612bb Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Fri, 5 Mar 2021 22:33:56 -0300 Subject: [PATCH] Display all single views as list of key values --- internal/display/actions.go | 14 +++++++------- internal/display/apis.go | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/display/actions.go b/internal/display/actions.go index 63bc64d72..8d79eaa2f 100644 --- a/internal/display/actions.go +++ b/internal/display/actions.go @@ -22,12 +22,12 @@ func (v *actionView) AsTableHeader() []string { } func (v *actionView) AsTableRow() []string { - return []string{v.ID, v.Name, v.Type, v.CreatedAt} + return []string{ansi.Faint(v.ID), v.Name, v.Type, v.CreatedAt} } func (v *actionView) KeyValues() [][]string { return [][]string{ - []string{"ID", v.ID}, + []string{"ID", ansi.Faint(v.ID)}, []string{"NAME", v.Name}, []string{"TYPE", v.Type}, []string{"CREATED AT", v.CreatedAt}, @@ -49,7 +49,7 @@ func (v *triggerView) AsTableHeader() []string { } func (v *triggerView) AsTableRow() []string { - return []string{v.ID, v.ActionID, v.DisplayName} + return []string{ansi.Faint(v.ID), v.ActionID, v.DisplayName} } type actionVersionView struct { @@ -70,13 +70,13 @@ func (v *actionVersionView) AsTableHeader() []string { } func (v *actionVersionView) AsTableRow() []string { - return []string{v.Number, v.getID(), v.ActionID, v.ActionName, v.Runtime, v.Status, v.CreatedAt, v.Deployed} + return []string{v.Number, ansi.Faint(v.getID()), v.ActionID, v.ActionName, v.Runtime, v.Status, v.CreatedAt, v.Deployed} } func (v *actionVersionView) KeyValues() [][]string { return [][]string{ []string{"Number", v.Number}, - []string{"ID", v.getID()}, + []string{"ID", ansi.Faint(v.getID())}, []string{"ActionID", v.ActionID}, []string{"ActionName", v.ActionName}, []string{"RUNTIME", v.ActionName}, @@ -142,7 +142,7 @@ func (r *Renderer) Action(action *management.Action) { raw: action, } - r.Results([]View{v}) + r.Result(v) } func (r *Renderer) ActionTriggersList(bindings []*management.ActionBinding) { @@ -185,7 +185,7 @@ func (r *Renderer) ActionVersion(version *management.ActionVersion) { v := ActionVersionView(version) - r.Results([]View{v}) + r.Result(v) } func (r *Renderer) ActionVersionList(list []*management.ActionVersion) { diff --git a/internal/display/apis.go b/internal/display/apis.go index 2ffe42518..c6b91642a 100644 --- a/internal/display/apis.go +++ b/internal/display/apis.go @@ -28,7 +28,7 @@ func (v *apiView) AsTableRow() []string { func (v *apiView) KeyValues() [][]string { return [][]string{ - []string{"ID", v.ID}, + []string{"ID", ansi.Faint(v.ID)}, []string{"NAME", v.Name}, []string{"IDENTIFIER", v.Identifier}, []string{"SCOPES", strconv.Itoa(v.Scopes)}, @@ -58,12 +58,12 @@ func (r *Renderer) ApiShow(api *management.ResourceServer) { func (r *Renderer) ApiCreate(api *management.ResourceServer) { r.Heading(ansi.Bold(r.Tenant), "API created\n") - r.Results([]View{makeApiView(api)}) + r.Result(makeApiView(api)) } func (r *Renderer) ApiUpdate(api *management.ResourceServer) { r.Heading(ansi.Bold(r.Tenant), "API updated\n") - r.Results([]View{makeApiView(api)}) + r.Result(makeApiView(api)) } func makeApiView(api *management.ResourceServer) *apiView {