-
Notifications
You must be signed in to change notification settings - Fork 888
chore: remove organization requirement from convertGroup() #12195
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
Conversation
Removing role information from some users in the api. This info is excessive and not required. It is costly to always include
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.
Looks alright, but how is default sort order decided now that it's removed from the struct?
@@ -0,0 +1,3 @@ | |||
USERNAME EMAIL CREATED AT STATUS | |||
testuser testuser@coder.com [timestamp] active |
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.
Can we replace it with the same length string? Worried someone might think this is a bug. 😄
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.
I can pad the timestamp in the replace function?
I could do something like this here:
Line 123 in 89645b1
func NormalizeGoldenFile(t *testing.T, byt []byte) []byte { |
// Replace any timestamps with a placeholder.
byt = timestampRegex.ReplaceAllFunc(byt, func(source []byte) []byte {
// Pad the timestamps to maintain the same length. This is mainly for tabled
// output where the padding is important for alignment.
lenSrc := len(source)
rpl := "timestamp"
required := lenSrc - len(rpl) - 2
return []byte("[" + fmt.Sprintf("%-*s", required, rpl) + "]")
})
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.
It then looks like this:
USERNAME EMAIL CREATED AT STATUS
testuser testuser@coder.com [timestamp ] active
testuser2 testuser2@coder.com [timestamp ] dormant
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.
And in json
"created_at": "[timestamp ]",
"last_seen_at": "[timestamp ]",
Default order is not removed, it's fixed. Prior to this PR you had to have |
timestamp padding moved here: #12256 |
Removed role and org information from the Group's api. This information was always excessive (I even had a TODO comment to remove it). It was kept in because dealing with nested structs on the cli was difficult.
Cli table formatter fixed
The cli table formatter used to not work well with nested structs. I fixed the
default_sort
bug which allows the User struct to be defined in the way this PR does.I added the golden file for users list to track this change.