Skip to content

Commit

Permalink
refactor: remove callbacks from app list
Browse files Browse the repository at this point in the history
  • Loading branch information
as-herzog committed Feb 25, 2021
1 parent 9cce8a8 commit 7ca3218
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/cli/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ func TestClientsListCmd(t *testing.T) {
}

expectTable(t, stdout.String(),
[]string{"NAME", "TYPE", "CLIENT ID", "CALLBACKS"},
[]string{"NAME", "TYPE", "CLIENT ID"},
[][]string{
{"some-name", "generic", "some-id", "http://localhost"},
{"some-name", "generic", "some-id"},
},
)
}
38 changes: 36 additions & 2 deletions internal/display/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,53 @@ func (v *clientView) AsTableRow() []string {

}

// listClientView is a slimmed down view of a client for displaying
// larger numbers of clients
type listClientView struct {
Name string
Type string
ClientID string
ClientSecret string
revealSecret bool
}

func (v *listClientView) AsTableHeader() []string {
if v.revealSecret {
return []string{"Name", "Type", "ClientID", "Client Secret"}
}
return []string{"Name", "Type", "Client ID"}

}

func (v *listClientView) AsTableRow() []string {
if v.revealSecret {
return []string{
v.Name,
v.Type,
ansi.Faint(v.ClientID),
ansi.Italic(v.ClientSecret),
}
}
return []string{
v.Name,
v.Type,
ansi.Faint(v.ClientID),
}

}

func (r *Renderer) ClientList(clients []*management.Client) {
r.Heading(ansi.Bold(r.Tenant), "clients\n")
var res []View
for _, c := range clients {
if auth0.StringValue(c.Name) == deprecatedAppName {
continue
}
res = append(res, &clientView{
res = append(res, &listClientView{
Name: auth0.StringValue(c.Name),
Type: appTypeFor(c.AppType),
ClientID: auth0.StringValue(c.ClientID),
ClientSecret: auth0.StringValue(c.ClientSecret),
Callbacks: callbacksFor(c.Callbacks),
})
}

Expand Down

0 comments on commit 7ca3218

Please sign in to comment.