Skip to content

Commit

Permalink
Display all single views as list of key values
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket committed Mar 6, 2021
1 parent 05b5507 commit f5c8bc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions internal/display/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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 {
Expand All @@ -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},
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions internal/display/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f5c8bc0

Please sign in to comment.