-
Notifications
You must be signed in to change notification settings - Fork 55
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
DXCDT-403: Separate rendering for logs tail and logs list #672
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
fb73785
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd da6a932
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd 0d62b4c
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd a4aed9e
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd fc50ba9
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd 054ab9e
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd 1aa695c
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd da03c9e
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd 358f05c
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd edb118a
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd eaba3cc
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd d28a33f
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd 6496148
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd f945c87
Merge branch 'main' of https://github.com/auth0/auth0-cli
willvedd c749530
Separating view for log tail and log list
willvedd 0d0fe16
Merge branch 'main' into DXCDT-403-logs-tail-no-results-view
Widcket 04085e3
Merge branch 'main' into DXCDT-403-logs-tail-no-results-view
Widcket 040c74b
Merge branch 'main' into DXCDT-403-logs-tail-no-results-view
willvedd 6ad8cb6
Merge branch 'main' into DXCDT-403-logs-tail-no-results-view
willvedd e60804d
Merge branch 'main' into DXCDT-403-logs-tail-no-results-view
willvedd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ func (v *logView) typeDesc() (typ, desc string) { | |
return typ, desc | ||
} | ||
|
||
func (r *Renderer) LogList(logs []*management.Log, ch <-chan []*management.Log, silent bool) { | ||
func (r *Renderer) LogList(logs []*management.Log, silent bool) { | ||
resource := "logs" | ||
|
||
r.Heading(resource) | ||
|
@@ -158,23 +158,28 @@ func (r *Renderer) LogList(logs []*management.Log, ch <-chan []*management.Log, | |
res = append(res, &logView{Log: l, silent: silent, raw: l}) | ||
} | ||
|
||
var viewChan chan View | ||
r.Results(res) | ||
} | ||
|
||
func (r *Renderer) LogTail(logs []*management.Log, ch <-chan []*management.Log, silent bool) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The LogTail doesn't seem to attach at the top the table headers like the auth0 logs list does:
|
||
r.Heading("logs") | ||
|
||
var res []View | ||
for _, l := range logs { | ||
res = append(res, &logView{Log: l, silent: silent, raw: l}) | ||
} | ||
|
||
if ch != nil { | ||
viewChan = make(chan View) | ||
viewChan := make(chan View) | ||
|
||
go func() { | ||
defer close(viewChan) | ||
go func() { | ||
defer close(viewChan) | ||
|
||
for list := range ch { | ||
for _, l := range list { | ||
viewChan <- &logView{Log: l, silent: silent, raw: l} | ||
} | ||
for list := range ch { | ||
for _, l := range list { | ||
viewChan <- &logView{Log: l, silent: silent, raw: l} | ||
} | ||
}() | ||
|
||
r.Stream(res, viewChan) // streams results for `auth0 logs tail` | ||
} | ||
} | ||
}() | ||
|
||
r.Results(res) // Includes headers for `auth0 logs list` | ||
r.Stream(res, viewChan) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're separating them, if we run
auth0 logs list
with a filter and we get back no log messages of that type we'll post a message that "No logs are available.", although that's slightly incorrect.There probably are log messages just not any that satistfy the filter. So maybe we can improve the output with something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior you're describing is not caused by this change, it existed prior. Though I do agree with the general sentiment.
Implementing isn't exactly trivial because the render functions are abstracted away from knowing the filters and other arguments. The best we could do here is to provide a generalized message that would apply to alls situations regardless of provided criteria.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we can still leave the codebase a bit better than it was, and also improve DX considering we're now touching this part, but I'm also okay if we wanna do this in a separate PR.
To implement this we can check inside
listLogsCmd()
if we have any filters selected and pass it to theLogList()
func.then inside the
LogList()
we can tweak the iflen(logs) == 0
check as follows:This will have the desired behavior as described above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's address in a follow-up PR that's more focused.