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
Conversation
932f17e
to
ab0aae5
Compare
@@ -152,7 +152,7 @@ func Login(domain string, oAuthOnly bool) error { | |||
|
|||
workspaces := wsResp.Data.GetWorkspaces | |||
|
|||
if len(workspaces) == 1 && len(c.Workspace) == 0 { |
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.
this TRUE only when you current workspace is "" and you have only 1 workspace in cluster.
len(workspaces) == 1 && len(c.Workspace) == 0
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.
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)
}
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 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 { |
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.
✗ 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 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? |
@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. |
d7244d7
to
dec01ec
Compare
…n show the menu to select.
dec01ec
to
91c11ff
Compare
Works great! |
Fix #178