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

feat: switch organization context in coder organizations#12265

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 10 commits intomainfromstevenmasley/org_switch
Feb 26, 2024

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedFeb 21, 2024
edited
Loading

Closes#11927:

Adds acoder org set to switch the org context.

coder org set

$ coder org set "steven-org"Current organization context set to steven-org (9616b384-38bb-4284-861b-8db4fc337d6d)$ coder org set not-real-orgEncountered an error running "coder organizations switch"Organization "not-real-org" not found. Is the name correct, and are you a member of it?Valid organizations you can switch to: "admin, steven-org, other-org"$ coder org switchType to search    --Deselect--    admin    bia-org  > steven-org

@EmyrkGraphite App
Copy link
MemberAuthor

Emyrk commentedFeb 21, 2024
edited
Loading

This stack of pull requests is managed by Graphite.Learn more about stacking.

Join@Emyrk and the rest of your teammates onGraphiteGraphite

@EmyrkEmyrkforce-pushed thestevenmasley/org_switch branch from3106518 to9a7aba6CompareFebruary 22, 2024 14:23
@EmyrkEmyrkforce-pushed thestevenmasley/select-org branch fromd4d20af to1ac16cfCompareFebruary 22, 2024 14:57
@EmyrkEmyrkforce-pushed thestevenmasley/org_switch branch 2 times, most recently from7142630 tob8ba53eCompareFebruary 22, 2024 17:18
@EmyrkEmyrk marked this pull request as ready for reviewFebruary 22, 2024 19:37
@EmyrkEmyrk requested a review frommafredriFebruary 22, 2024 19:37
@EmyrkEmyrk changed the titlefeat: add coder organizations switch to change org contextfeat: switch organization context in coder organizationsFeb 23, 2024
@EmyrkEmyrk mentioned this pull requestFeb 23, 2024
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.

I wouldn't say any of my comments are blockers, so I'm approving this.

This is a set of nice additions to the CLI!

if len(inv.Args) == 0 {
// Pull switchToOrg from a prompt selector, rather than command line
// args.
switchToOrg, err = promptUserSelectOrg(inv, conf, orgs)
Copy link
Member

Choose a reason for hiding this comment

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

It'd be nice if the currently selected one is highlighted in the list, perhaps? 🤔

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It is! But I read it only from the config file. I ignore theCurrentOrganization because that takes into account the-z flag andis_default.

If a user has nothing set, I want the reset option to be selected.

return org.Name == switchToOrg || org.ID.String() == switchToOrg
})
if index < 0 {
// Using this error for better error message formatting
Copy link
Member

Choose a reason for hiding this comment

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

We should really have one for CLI errors too. (PS. There isexitError, but you might still prefer this approach.)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Yea we really should. I did not want to make a new one for this.

exitError is a single line, this error format will display the helper text on a new line.

}

// Verify it worked.
current, err := CurrentOrganization(r, inv, client)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to do this, considering we've fetched orgs and are writing the UUID, what could go wrong?

I mostly worry about increased execution time for the CLI command by additional API roundtrip.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I mainly added it because if you delete your selection, then this finds what the default is.

defaultOrg = orgs[index].Name
}

const deselectOption = "--Deselect--"
Copy link
Member

Choose a reason for hiding this comment

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

This could also be[Default] or the default could be highlighted (kylecarbs (Default)). The latter would have a semantic difference, though, as it would never deselect. Not sure we need to teach users the concept of deselecting an org vs using the default which is essentially what we're doing 🤔

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I like[Default] better than--Deselect--. It is an annoying concept to include, but it felt wrong to not add the option of "Idc, let it choose for me".

My fear was someone runs this command to see what it does, then they are locked into a decision and unable to revert.

@EmyrkEmyrkforce-pushed thestevenmasley/org_switch branch 3 times, most recently from6b3367a to98666fdCompareFebruary 23, 2024 17:12
Base automatically changed fromstevenmasley/select-org tomainFebruary 26, 2024 16:03
@EmyrkEmyrkforce-pushed thestevenmasley/org_switch branch from1ac5298 tob34cdfeCompareFebruary 26, 2024 16:30
@EmyrkEmyrk merged commit70ccefc intomainFeb 26, 2024
@EmyrkEmyrk deleted the stevenmasley/org_switch branchFebruary 26, 2024 17:39
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 26, 2024
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.

CLI Org support
2 participants
@Emyrk@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp