Salesforcedx-vscode: Org Picker UI

Created on 7 Sep 2018  ·  14Comments  ·  Source: forcedotcom/salesforcedx-vscode

A developer will be working with two different orgs for development. This means that they will have to switch the org they are running commands against. In the CLI this is already easily done by specifying the targetUsername argument, however, there is no such capability in VS Code. As such, we should allow a developer to specify a default org to run commands against, similar to the above proposal about default package directory.

The bottom toolbar would show the currently selected org that operations are performed against.

image

Clicking on the org name would bring up a selection dialog that would present the user with the following options:

  • Authorize new Org
  • Create new Scratch Org
  • List of the rest of the authorized orgs...

image

They could then either select an org they have already authorized or authorize a new org or create a scratch org. The results of all of these operations would change the currently selected org.

Similar to the default package directory setting for VS Code, we would not want to store this in a file that is stored in source control (i.e. sfdx-project.json). This is a setting specific to the local developer and as such, the currently selected org would be stored in the .sfdx directory.

VS Code Command
In addition to allowing users to set the current org via UI we should expose the same functionality via the command “SFDX: Set Default Org”

Doc Impact
Current functionality opens the org in the browser. Make sure to alert the user of the new functionality & properly deprecate/remove current behavior from docs.

feature

Most helpful comment

This looks good. It would be very helpful to me and others

All 14 comments

This looks good. It would be very helpful to me and others

Note: we will likely have to implement something like sfdx force:orgs:list --norefresh to use when displaying the list as the contents take a long time to load.

This also means though that we will need to have some capability of refreshing the org list such as a command SFDX: Refresh Org List

Would it be possible to implement the list functionality but leave the refresh functionality to be manually run via the CLI?

@vmarasow You will be able to refresh via the CLI, we will also add a command in VSCode.

@ntotten I've done something similar for a desktop app to manage sfdx users. Instead of sfdx force:orgs:list --norefresh I just run once at activation and then cache the results. There is an option to manually refresh.

I think something similar would work (although the --norefresh flag would be nice for more than just this).

@ntotten,

Is this feature coming anytime soon?

With 'develop against any org feature', I think this makes more sense now.

Thank you for thinking about all the devops headaches ahead of us.

@venkatpolisetti It's on our roadmap

@ntotten could this functionality be when the user Right Clicks? and keep standard left click functionality? Clicking the org to launch it is a lovely convenience, and saves a lot of time. Thanks for writing this up.

I don't believe the extensibility allows right/left clicks on that area. We could consider keeping both options, but I am inclined to change this behavior as it aligns with what vscode does for git branches. We could maybe add a new button specifically for "open org". But there is a command "SFDX: Open Default Org", its a few extra clicks. You can also map a keyboard shortcut for this command.

both are not things i seem to have to change frequently. Every morning to start work I click on the org to launch it. and i wouldn't frequently change orgs unless doing some deploying. So maybe it doesn't matter. Have Org management be intuitive in vscode would certainly be great, and is probably harder to learn on the CLI than launching the default org.

Extra Buttons might be better spent for frequent things like force:source:push

Delivered in version45.1.0

So is there a way to easily open the scratch org?

I think this is a loss of functionality. Right now, getting a list of the orgs to display in the command palette takes few seconds (>5) so it looks like the button is broken. I keep clicking the button and nothing happens, few seconds later, a whole buch of menus show up on the command palette. I do not change Orgs often, but I do have to open them frequently so for me this is loss of behaviour.

I know it's hard to make everybody happy, but I think we can get to a happy middle. Some ideas to
put back the opening of an org could be...

  • Possibly with a right click / Shift + click?

  • Have a pop-up sub-menu that pops up and allows you to select between opening or changing the default org.

  • Can we have a small button next to the existing one to open the Org? I believe there is a new icon for the connector, so what if clicking on the name opens the org but clicking on the connector allows you to change the default org?

  • Could we at least have a setting that allows you to configure if you want to open or change the Org?

The delay is something we are fixing.

The ability to open an org is still there. The icon is the same. We just removed the text. See: https://twitter.com/ch_sz_knapp/status/1095600887094018048?s=21

Thanks @ntotten

Was this page helpful?
0 / 5 - 0 ratings