Skip to content
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

Fix workspace switch workflow #188

Merged
merged 4 commits into from Mar 11, 2019
Merged

Fix workspace switch workflow #188

merged 4 commits into from Mar 11, 2019

Conversation

andriisoldatenko
Copy link
Contributor

@andriisoldatenko andriisoldatenko commented Mar 5, 2019

Fix #178

@@ -152,7 +152,7 @@ func Login(domain string, oAuthOnly bool) error {

workspaces := wsResp.Data.GetWorkspaces

if len(workspaces) == 1 && len(c.Workspace) == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this TRUE only when you current workspace is "" and you have only 1 workspace in cluster.
len(workspaces) == 1 && len(c.Workspace) == 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

near line 162, we are do same mistake only when you current workspace is ""

if len(workspaces) != 1 && len(c.Workspace) == 0 {
		fmt.Printf(messages.CLI_SET_WORKSPACE_EXAMPLE)
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would suggest, we need to show message or switch every time when you relogin.

@@ -152,7 +152,7 @@ func Login(domain string, oAuthOnly bool) error {

workspaces := wsResp.Data.GetWorkspaces

if len(workspaces) == 1 && len(c.Workspace) == 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

✗ go run main.go auth login localhost
 CLUSTER                             WORKSPACE
 localhost                           cjsp2qct2000x0838cmbll6t3

 Switched cluster
Default "Andrii Soldatenko's Workspace" (cjsp2qct2000x0838cmbll6t3) workspace found, setting default workspace.

@andriisoldatenko andriisoldatenko marked this pull request as ready for review March 7, 2019 15:48
@schnie
Copy link
Member

schnie commented Mar 7, 2019

@andriisoldatenko what happens when you switch a cluster or re-login to a cluster now if they belong to multiple workspaces? Do you think we should show a workspace selection menu?

@schnie
Copy link
Member

schnie commented Mar 7, 2019

@andriisoldatenko do you think we could have it so we keep track of the workspace you were last using, per cluster and use that when you switch between them? If we can query for fresh data, I'd say we use the last-used workspace, and if it is now missing, them prompt them with a menu / list to choose from.

@schnie schnie merged commit f5cdab8 into master Mar 11, 2019
@schnie
Copy link
Member

schnie commented Mar 11, 2019

Works great!

@ryw ryw deleted the fix-workspace-switch-workflow branch March 22, 2019 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants