Skip to content

Improve Login to DevSandbox button workflow#2985

Merged
mohitsuman merged 1 commit intoredhat-developer:mainfrom
JessicaJHee:2977-login-DevSandbox
Jun 28, 2023
Merged

Improve Login to DevSandbox button workflow#2985
mohitsuman merged 1 commit intoredhat-developer:mainfrom
JessicaJHee:2977-login-DevSandbox

Conversation

@JessicaJHee
Copy link
Copy Markdown
Member

Fixes #2977

Peek 2023-06-21 17-05

Comment thread src/openshift/cluster.ts Outdated

static async validateLoginToken(userClusterUrl: string, userToken: string): Promise<boolean> {
try {
await Cluster.cli.executeTool(Command.odoLoginWithToken(userClusterUrl, userToken.trim()), undefined, true);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure if there is a better way to check whether the token is valid or not

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the regular expression check should be enough. I think that logging in and out of the cluster isn't necessary, and might slow down the extension. If the contents of the clipboard match the regex, but the token isn't valid, then we could show a popup when they hit the "Login to DevSandbox" button

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 21, 2023

Codecov Report

Patch coverage: 5.26% and project coverage change: -0.15 ⚠️

Comparison is base (48ed462) 37.59% compared to head (80a9054) 37.44%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2985      +/-   ##
==========================================
- Coverage   37.59%   37.44%   -0.15%     
==========================================
  Files          62       62              
  Lines        3937     3955      +18     
  Branches      755      758       +3     
==========================================
+ Hits         1480     1481       +1     
- Misses       2457     2474      +17     
Impacted Files Coverage Δ
src/openshift/cluster.ts 10.06% <0.00%> (-0.11%) ⬇️
src/webview/cluster/clusterViewLoader.ts 9.41% <6.25%> (-0.18%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment thread src/webview/cluster/app/sandboxView.tsx Outdated
Comment thread src/webview/cluster/app/sandboxView.tsx Outdated
Comment thread src/webview/cluster/clusterViewLoader.ts Outdated
Copy link
Copy Markdown
Contributor

@mohitsuman mohitsuman left a comment

Choose a reason for hiding this comment

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

Change around active status of the Login button.

@JessicaJHee JessicaJHee force-pushed the 2977-login-DevSandbox branch from 500bd9b to 2022a87 Compare June 22, 2023 16:13
@datho7561 datho7561 self-requested a review June 22, 2023 18:05
Comment thread src/openshift/cluster.ts Outdated

static async validateLoginToken(userClusterUrl: string, userToken: string): Promise<boolean> {
try {
await Cluster.cli.executeTool(Command.odoLoginWithToken(userClusterUrl, userToken.trim()), undefined, true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the regular expression check should be enough. I think that logging in and out of the cluster isn't necessary, and might slow down the extension. If the contents of the clipboard match the regex, but the token isn't valid, then we could show a popup when they hit the "Login to DevSandbox" button

Comment thread src/webview/cluster/app/clusterView.scss
@JessicaJHee JessicaJHee force-pushed the 2977-login-DevSandbox branch from 2022a87 to a613a15 Compare June 22, 2023 20:45
@JessicaJHee
Copy link
Copy Markdown
Member Author

Updated:

Peek 2023-06-22 16-57

Comment thread src/openshift/cluster.ts Outdated
await new Promise(r => setTimeout(r, 500));
const currentContent = await vscode.env.clipboard.readText();
if (previousContent && previousContent !== currentContent) {
const oauthInfo = await sandboxAPI.getOauthServerInfo(signupStatus.apiEndpoint);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since sending and receiving the response from the auth server takes some time, the user could copy the token in this time. That means the change in content won't be detected.

I ran into this. As a result, I can't click the button unless I already have the token in my clipboard when I open the cluster view.

@JessicaJHee JessicaJHee force-pushed the 2977-login-DevSandbox branch from a613a15 to 249da31 Compare June 23, 2023 14:46
@mohitsuman mohitsuman self-requested a review June 24, 2023 18:39
mohitsuman
mohitsuman previously approved these changes Jun 24, 2023
Copy link
Copy Markdown
Contributor

@mohitsuman mohitsuman left a comment

Choose a reason for hiding this comment

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

lgtm

@mohitsuman mohitsuman requested a review from datho7561 June 26, 2023 20:25
@datho7561
Copy link
Copy Markdown
Contributor

One more quick comment (sorry it's so late, but hopefully it's easy to address). The tooltip for the login button slightly covers up the bottom of the button:

image

This is inconsistent with the rest of the buttons in this row, and makes it hard to click on the bottom part of the button.

If this is too difficult to address, then don't worry about it.

datho7561
datho7561 previously approved these changes Jun 27, 2023
Copy link
Copy Markdown
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

Other than the issue I mentioned with the tooltip, this looks good. Feel free to merge. Thanks, Jessica!

Signed-off-by: Jessica He <jhe@redhat.com>
@JessicaJHee JessicaJHee dismissed stale reviews from datho7561 and mohitsuman via 80a9054 June 27, 2023 19:44
@JessicaJHee JessicaJHee force-pushed the 2977-login-DevSandbox branch from 249da31 to 80a9054 Compare June 27, 2023 19:44
@mohitsuman mohitsuman merged commit 78d0933 into redhat-developer:main Jun 28, 2023
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.

Login to Devsandbox button workflow improvement

3 participants