Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 12 commits intomainfromstevenmasley/convert_group
Feb 21, 2024

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedFeb 16, 2024
edited
Loading

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 thedefault_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.

Removing role information from some users in the api. This info isexcessive and not required. It is costly to always include
@EmyrkEmyrk requested a review frommafredriFebruary 21, 2024 17:59
Copy link
Member

@mafredrimafredri left a 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
Copy link
Member

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. 😄

Copy link
MemberAuthor

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:

funcNormalizeGoldenFile(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)-2return []byte("["+fmt.Sprintf("%-*s",required,rpl)+"]")})

Copy link
MemberAuthor

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

Copy link
MemberAuthor

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                ]",

@Emyrk
Copy link
MemberAuthor

Looks alright, but how is default sort order decided now that it's removed from the struct?

Default order is not removed, it's fixed. Prior to this PR you had to havedefault_sort set on nested structures because our code had an issue. With the fix,default_sort is set on theusername inMinimalUser. So it's sorted by username

@EmyrkEmyrk merged commitc3a7b13 intomainFeb 21, 2024
@EmyrkEmyrk deleted the stevenmasley/convert_group branchFebruary 21, 2024 21:58
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 21, 2024
@Emyrk
Copy link
MemberAuthor

timestamp padding moved here:#12256

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp