Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apps: improve UX on create and show screens #137

Merged
merged 1 commit into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion internal/display/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,14 @@ func (r *Renderer) ApplicationCreate(client *management.Client, revealSecrets bo

r.Result(v)

r.Infof("\nQuickstarts: %s", quickstartsURIFor(client.AppType))
r.Newline()
r.Infof("Quickstarts: %s", quickstartsURIFor(client.AppType))

// TODO(cyx): possibly guard this with a --no-hint flag.
r.Infof("%s: You might wanna try `auth0 test login --client-id %s`",
ansi.Faint("Hint"),
client.GetClientID(),
)
}

func (r *Renderer) ApplicationUpdate(client *management.Client, revealSecrets bool) {
Expand Down
16 changes: 15 additions & 1 deletion internal/display/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func NewRenderer() *Renderer {
}
}

func (r *Renderer) Newline() {
fmt.Fprintln(r.MessageWriter)
}

func (r *Renderer) Infof(format string, a ...interface{}) {
fmt.Fprint(r.MessageWriter, aurora.Green(" ▸ "))
fmt.Fprintf(r.MessageWriter, format+"\n", a...)
Expand Down Expand Up @@ -105,7 +109,17 @@ func (r *Renderer) Result(data View) {
// many changes in other places. In the future we should
// enforce `KeyValues` on all `View` types.
if v, ok := data.(interface{ KeyValues() [][]string }); ok {
writeTable(r.ResultWriter, nil, v.KeyValues())
var kvs [][]string
for _, pair := range v.KeyValues() {
k := pair[0]
v := pair[1]

// NOTE(cyx): We can either nuke it or annotate with `<none>`. For now we're choosing to nuke it.
if v != "" {
kvs = append(kvs, []string{k, v})
}
}
writeTable(r.ResultWriter, nil, kvs)
}
Comment on lines +112 to 123
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Widcket worth noting that given we have so many empty values, I went with nuking out the empty ones to start. We can play with alternative approaches to avoiding a list of kv pairs with many null values (such as ) later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea 👍🏻

}
}
Expand Down