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

Clear active role if no longer in available roles #7345

Merged

Conversation

scottbell
Copy link
Contributor

@scottbell scottbell commented Jan 8, 2024

Closes #7280

Describe your changes:

When the active role is no longer contained in the available roles for a user, clear it. This triggers the normal logic to either prompt the user for a role selection (if more than 1 available role), or simply selecting a single role (if we only have one possible available role).

Screen.Recording.2024-01-08.at.1.00.39.PM.mov

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Is this a breaking change to be called out in the release notes?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

@scottbell scottbell linked an issue Jan 8, 2024 that may be closed by this pull request
7 tasks
Copy link

deploysentinel bot commented Jan 8, 2024

Current Playwright Test Results Summary

✅ 176 Passing - ⚠️ 3 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 01/11/2024 10:34:31am UTC)

Run Details

Running Job e2e-stable on CircleCI

Commit: 8bd08a9

Started: 01/11/2024 10:29:29am UTC

⚠️ Flakes

📄   functional/plugins/notebook/restrictedNotebook.e2e.spec.js • 2 Flakes

Top 1 Common Error Messages

null

2 Test Cases Affected

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Restricted Notebook with a page locked and with an embed @addinit Allows embeds to be deleted if page unlocked @addinit
Retry 1Initial Attempt
3.85% (3) 3 / 78 runs
failed over last 7 days
38.46% (30) 30 / 78 runs
flaked over last 7 days
Restricted Notebook with a page locked and with an embed @addinit Disallows embeds to be deleted if page locked @addinit
Retry 1Initial Attempt
5.63% (4) 4 / 71 runs
failed over last 7 days
50.70% (36) 36 / 71 runs
flaked over last 7 days

📄   functional/plugins/imagery/exampleImagery.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Example Imagery Object Can use Mouse Wheel to zoom in and out of latest image
Retry 1Initial Attempt
0% (0) 0 / 63 runs
failed over last 7 days
26.98% (17) 17 / 63 runs
flaked over last 7 days

View Detailed Build Results


Current Playwright Test Results Summary

✅ 15 Passing

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 01/11/2024 10:34:31am UTC)

Run Details

Running Workflow e2e-couchdb on Github Actions

Commit: 8bd08a9

Started: 01/10/2024 05:03:56pm UTC

View Detailed Build Results


Copy link

codecov bot commented Jan 8, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (11f3ce9) 55.89% compared to head (f221549) 55.83%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7345      +/-   ##
==========================================
- Coverage   55.89%   55.83%   -0.07%     
==========================================
  Files         659      659              
  Lines       26243    26247       +4     
  Branches     2549     2550       +1     
==========================================
- Hits        14669    14654      -15     
- Misses      10869    10884      +15     
- Partials      705      709       +4     
Flag Coverage Δ
e2e-full 41.06% <ø> (-0.04%) ⬇️
e2e-stable 59.04% <100.00%> (-0.05%) ⬇️
unit 48.86% <50.00%> (-0.06%) ⬇️
Files Coverage Δ
src/api/user/UserAPI.js 91.89% <100.00%> (+0.46%) ⬆️
...plugins/userIndicator/components/UserIndicator.vue 42.85% <20.00%> (+2.85%) ⬆️

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11f3ce9...f221549. Read the comment docs.

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 8, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 8, 2024
@scottbell scottbell added this to the Target:3.3.0 milestone Jan 8, 2024
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 8, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 8, 2024
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 8, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 8, 2024
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 10, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 10, 2024
// change active role in local storage to "apple_role", a bogus role not in the list of available roles
await page.evaluate(() => {
const openmct = window.openmct;
openmct.user.setActiveRole('apple_role');
Copy link
Collaborator

Choose a reason for hiding this comment

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

super cool

@michaelrogers
Copy link
Contributor

When testing locally by setting localStorage.setItem('ACTIVE_USER_ROLE', 'potato') in the console. I receive the following error and are the overlay is never rendered that would prompt the user to select a role. On initial investigation, I couldn't determine what had changed that might be causing the rendering error. Specifically it is failing on document.body.appendChild, so it might be a load order issue but it wasn't obvious to me why the prompt would be failing now.

Screenshot 2024-01-12 at 5 12 15 PM

@scottbell
Copy link
Contributor Author

scottbell commented Jan 16, 2024

When testing locally by setting localStorage.setItem('ACTIVE_USER_ROLE', 'potato') in the console. I receive the following error and are the overlay is never rendered that would prompt the user to select a role. On initial investigation, I couldn't determine what had changed that might be causing the rendering error. Specifically it is failing on document.body.appendChild, so it might be a load order issue but it wasn't obvious to me why the prompt would be failing now.

@michaelrogers Ah, I tested this with YAMCS, which gives a longer delay for the UserAPI to load due to network delays. If using ExampleUserProvider, it looks there's a race condition between MCT loading and the UserIndicator. Waiting to check MCT to load resolves this:

Screen.Recording.2024-01-16.at.12.45.40.PM.mov

@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 16, 2024
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Jan 16, 2024
Copy link
Contributor

@michaelrogers michaelrogers left a comment

Choose a reason for hiding this comment

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

These changes look great. Ready for merging. 🤖

@scottbell scottbell merged commit 70f5ba9 into master Jan 16, 2024
21 checks passed
@scottbell scottbell deleted the 7280-user-is-sometimes-unable-to-switch-operator-roles branch January 16, 2024 16:57
@unlikelyzero unlikelyzero modified the milestones: Target:3.3.0, Target:4.0.0 Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User is sometimes unable to switch operator roles
3 participants