Skip to content

Conversation

@blva
Copy link
Collaborator

@blva blva commented Jun 1, 2022

Proposed changes

Jira ticket:CLOUDP-120254

Improve the flow experience when user types invalid project id. Previously we were setting the profile and later failing with

Error: POST https://cloud.mongodb.com/api/atlas/v1.0/groups/62320b60e45547389db3e9de/databaseUsers: 401 (request "USER_CANNOT_ACCESS_ORG") User cannot access this organization.
➜  mongocli git:(master) ✗ atlas setup

This command will help you
1. Create and verify your MongoDB Atlas account in your browser.
2. Return to the terminal to create your first free MongoDB database in Atlas.

To verify your account, copy your one-time verification code:
KRVW-HXGF

Paste the code in the browser when prompted to activate your Atlas CLI. Your code will expire after 10 minutes.

To continue, go to https://account.mongodb.com/account/register/cli?n=/account/connect&nRegister=/account/connect
Successfully logged in as bianca.vianadeaguiar+test2@mongodb.com.
You don't seem to have access to any project
? Do you want to enter the Project ID manually? Yes
? Default Project ID: 62320b60e45547389db3e9de
Error: you don't have access to the project id you provided or it does not exist

Closes #[issue number]

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated e2e/E2E-TESTS.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Further comments

@blva blva requested a review from a team June 1, 2022 11:19
@blva blva marked this pull request as ready for review June 1, 2022 11:19
@blva blva requested a review from a team June 1, 2022 11:19
Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

@blva blva changed the base branch from master to onboarding_improvements June 1, 2022 13:31
Copy link
Contributor

@melissamahoney-mongodb melissamahoney-mongodb left a comment

Choose a reason for hiding this comment

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

A few suggestions to make it a little shorter and cleaner. :)

// Only make references to profile if user was asked about org or projects
if opts.AskedOrgsOrProjects && opts.ProjectID != "" && opts.OrgID != "" {
if !opts.ProjectExists(config.ProjectID()) {
return fmt.Errorf("you don't have access to the project id you provided or it does not exist")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("you don't have access to the project id you provided or it does not exist")
return fmt.Errorf("You don't have access to this project ID or it doesn't exist.")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, addressed most of them except the upper case and the period because for error messages we cannot add this (linter doesn't allow)

}

if !opts.OrgExists(config.OrgID()) {
return fmt.Errorf("you don't have access to the organization id you provided or it does not exist")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("you don't have access to the organization id you provided or it does not exist")
return fmt.Errorf("You don't have access to this organization ID or it doesn't exist.")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, addressed most of them except the upper case and the period because for error messages we cannot add this (linter doesn't allow)

@blva blva requested a review from fmenezes June 1, 2022 15:46
@blva blva requested a review from fmenezes June 1, 2022 16:05
@fmenezes
Copy link
Collaborator

fmenezes commented Jun 1, 2022

@blva thanks for the changes

@blva blva merged commit f6ba7d8 into onboarding_improvements Jun 1, 2022
@blva blva deleted the CLOUDP-120254 branch June 1, 2022 16:24
ciprian-tibulca added a commit that referenced this pull request Jun 10, 2022
* CLOUDP-120254: Address advocate experience feedback (#1281)

* CLOUDP-124560: Add login to quickstart (#1284)

* CLOUDP-118914: Clean up after tests that set config (#1285)

* CLOUDP-118914: Save selected values and ask setup in a loop (#1297)

* license header

Co-authored-by: Bianca <40155621+blva@users.noreply.github.com>
Co-authored-by: Bianca <bianca.vianadeaguiar@mongodb.com>
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.

5 participants