Skip to content

fix organization switcher selection and permission typo - #19933

Merged
leecalcote merged 5 commits into
meshery:masterfrom
rishiraj38:fix/org-switcher
Jun 8, 2026
Merged

leecalcote merged 5 commits into
meshery:masterfrom
rishiraj38:fix/org-switcher

Conversation

@rishiraj38

Copy link
Copy Markdown
Contributor

Description

This PR fixes #19931 and addresses a few issues related to organization switching.

  • Persist the selected organization before reloading the application.
  • Fix the permission check in DeployConfirmationModal.
  • Fix RTK Query imports in OrgSwitcher that were causing build issues.

Approach

I found that the organization dropdown on the Oops page was not always showing the correct active organization. Since the global layout is not mounted on that page, the Redux organization state can be unavailable. To address this, OrgSwitcher now uses the organization returned by the backend when Redux state is missing, ensuring the correct organization is displayed and other organizations remain selectable.

I also updated the organization switch flow to save the selected organization on the backend before reloading the application. If the update fails, the reload is skipped and an error message is shown to prevent the UI from getting out of sync with the backend state.

Additionally, this PR fixes the permission check in DeployConfirmationModal and updates RTK Query imports to use the correct path alias, resolving build issues.

Verification

  • Tested organization switching from both regular pages and the Oops page.
  • Verified that the selected organization persists correctly after switching.
  • Ran make ui-build successfully.

Demo: Added a video demonstrating the fix.

Screen.Recording.2026-06-08.at.9.46.41.PM.mov

Signed commits

  • Yes, I signed my commits.

@github-actions github-actions Bot added the component/ui User Interface label Jun 8, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates the organization switching logic in both OrgSwitcher and SpaceSwitcher to use RTK Query mutations asynchronously with error handling, and corrects a disabled check in DeployConfirmationModal. However, in both switchers, the RTK Query mutation trigger updateSelectedOrg needs to call .unwrap() to ensure that errors are actually thrown and caught by the catch blocks, preventing the UI from reloading on a failed backend update.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

rishiraj38 and others added 2 commits June 8, 2026 21:54
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Rishi Raj <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Rishi Raj <[email protected]>

Copilot AI left a comment

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.

Pull request overview

This PR aims to improve organization switching reliability in the Meshery UI by persisting the selected organization to the backend before reloading, ensuring the correct org is shown/used on the permission-denied (Oops) page, and correcting a permission check in the deploy confirmation flow.

Changes:

  • Persist selected organization via the user preferences update flow before triggering an app reload.
  • Make the Oops page org switcher fall back to backend-selected org when Redux org state is missing.
  • Fix the DeployConfirmationModal ability check to use the correct permission “subject” field.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ui/components/workspaces/SpacesSwitcher/SpaceSwitcher.tsx Adds notification-backed error handling around org selection persistence prior to reloading.
ui/components/general/error-404/OrgSwitcher.tsx Uses backend-selected organization when Redux org is unavailable and persists selection before reload.
ui/components/designs/lifecycle/DeployConfirmationModal.tsx Fixes the permission check to use subject for VALIDATE_DESIGN.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Commit SHA: da76b7a13b62f46ba882cd7d60fbb65f3a8657f7

END-TO-END TESTS

  • Testing started at: June 8th 2026, 6:34:51 pm

📦 Test Result Summary

  • ✅ 58 passed
  • ❌ 2 failed
  • ⚠️ 0 flaked
  • ⏩ 11 skipped

⌛ Duration: 11 minutes and 36 seconds

Overall Result: 👎 Some tests failed.

[Show/Hide] Test Result Details
Test Provider Browser Test Case Tags Result
1 Local chromium-local-provider Action buttons on adapters tab ✅
2 Local chromium-local-provider Aggregation Charts are displayed ✅
3 Local chromium-local-provider alias resolution relationship ✅
4 Local chromium-local-provider alias resolution relationship ✅
5 Local chromium-local-provider alias resolution relationship ✅
6 Local chromium-local-provider alias resolution relationship ✅
7 Local chromium-local-provider alias resolution relationship ✅
8 Local chromium-local-provider alias resolution relationship ✅
9 Local chromium-local-provider alias resolution relationship ✅
10 Local chromium-local-provider alias resolution relationship ✅
11 Local chromium-local-provider alias resolution relationship ✅
12 Local chromium-local-provider All settings tabs ✅
13 Local chromium-local-provider Common UI elements ✅
14 Local chromium-local-provider config patching correctness relationship ✅
15 Local chromium-local-provider config patching correctness relationship ✅
16 Local chromium-local-provider config patching correctness relationship ✅
17 Local chromium-local-provider config patching correctness relationship ✅
18 Local chromium-local-provider config patching correctness relationship ✅
19 Local chromium-local-provider config patching correctness relationship ✅
20 Local chromium-local-provider config patching correctness relationship ✅
21 Local chromium-local-provider config patching correctness relationship ✅
22 Local chromium-local-provider config patching correctness relationship ✅
23 Local chromium-local-provider Configure Existing Istio adapter through Mesh Adapter URL from Management page unstable ⚠️
24 Local chromium-local-provider Connect to Meshery Istio Adapter and configure it ➖
25 Local chromium-local-provider Create a Model ❌
26 Local chromium-local-provider Delete Kubernetes cluster connections ➖
27 Local chromium-local-provider evaluation idempotency relationship ✅
28 Local chromium-local-provider evaluation idempotency relationship ✅
29 Local chromium-local-provider evaluation idempotency relationship ✅
30 Local chromium-local-provider evaluation idempotency relationship ✅
31 Local chromium-local-provider evaluation idempotency relationship ✅
32 Local chromium-local-provider evaluation idempotency relationship ✅
33 Local chromium-local-provider evaluation idempotency relationship ✅
34 Local chromium-local-provider evaluation idempotency relationship ✅
35 Local chromium-local-provider evaluation idempotency relationship ✅
36 Local chromium-local-provider Grafana elements on metrics tab ❌
37 Local chromium-local-provider Import a Model via CSV Import ➖
38 Local chromium-local-provider Import a Model via File Import ➖
39 Local chromium-local-provider Import a Model via Url Import ➖
40 Local chromium-local-provider Logout from current user session ✅
41 Local chromium-local-provider Ping Istio Adapter unstable ⚠️
42 Local chromium-local-provider Search a Model and Export it ➖
43 Local chromium-local-provider should edit design in Design Configurator ✅
44 Local chromium-local-provider should identify relationships for All Relationships relationship ✅
45 Local chromium-local-provider should identify relationships for Container-Hierarchical-Parent-Alias-Relationship relationship ✅
46 Local chromium-local-provider should identify relationships for deployment-configmap-reference-relationship relationship ✅
47 Local chromium-local-provider should identify relationships for Hierarchical-Parent-Namespace-Relationship relationship ✅
48 Local chromium-local-provider should identify relationships for meshery-design relationship ✅
49 Local chromium-local-provider should identify relationships for pv-pvc-edge-non-binding-reference-relationship relationship ✅
50 Local chromium-local-provider should identify relationships for Service-To-Deployment-Network relationship ✅
51 Local chromium-local-provider should verify Design Configurator page elements ✅
52 Local chromium-local-provider structural integrity relationship ✅
53 Local chromium-local-provider structural integrity relationship ✅
54 Local chromium-local-provider structural integrity relationship ✅
55 Local chromium-local-provider structural integrity relationship ✅
56 Local chromium-local-provider structural integrity relationship ✅
57 Local chromium-local-provider structural integrity relationship ✅
58 Local chromium-local-provider structural integrity relationship ✅
59 Local chromium-local-provider structural integrity relationship ✅
60 Local chromium-local-provider structural integrity relationship ✅
61 Local chromium-local-provider Test if Left Navigation Panel is displayed ✅
62 Local chromium-local-provider Test if Notification button is displayed ✅
63 Local chromium-local-provider Test if Profile button is displayed ✅
64 Local chromium-local-provider Toggle "Send Anonymous Performance Results" ✅
65 Local chromium-local-provider Toggle "Send Anonymous Usage Statistics" ✅
66 Local chromium-local-provider Verify extension nav items use top-level layout ➖
67 Local chromium-local-provider Verify Meshery Adapter for Istio Section ✅
68 Local chromium-local-provider Verify Meshery Catalog Section Details ➖
69 Local chromium-local-provider Verify Meshery Design Embed Details ➖
70 Local chromium-local-provider Verify Meshery Docker Extension Details ➖
71 Local chromium-local-provider Verify Performance Analysis Details ➖
72 Local chromium-local-provider Verify that UI components are displayed ✅
73 Local local-setup authenticate as Local provider ✅

❌ Failed Test Details

The following tests failed. Click on each to see the failure reason:

❌ Grafana elements on metrics tab (Local - chromium-local-provider)

File Location: /home/runner/work/meshery/meshery/ui/tests/e2e/performance.spec.ts

Error Message:

Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoBeVisible�[2m(�[22m�[2m)�[22m failed

Locator: getByTestId('meshery-metrics')
Expected: visible
Timeout: 60000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toBeVisible" with timeout 60000ms�[22m
�[2m  - waiting for getByTestId('meshery-metrics')�[22m

Code Snippet:

�[0m �[90m 38 |�[39m     �[36mawait�[39m dashboardPage�[33m.�[39mnavigateToDashboard()�[33m;�[39m
 �[90m 39 |�[39m     �[36mawait�[39m dashboardPage�[33m.�[39mnavigateToPerformance()�[33m;�[39m
�[31m�[1m>�[22m�[39m�[90m 40 |�[39m     �[36mawait�[39m expect(page�[33m.�[39mgetByTestId(�[32m'meshery-metrics'�[39m))�[33m.�[39mtoBeVisible()�[33m;�[39m
 �[90m    |�[39m                                                       �[31m�[1m^�[22m�[39m
 �[90m 41 |�[39m   })�[33m;�[39m
 �[90m 42 |�[39m
 �[90m 43 |�[39m   test(�[32m'Common UI elements'�[39m�[33m,�[39m �[36masync�[39m ({ page }�[33m:�[39m { page�[33m:�[39m �[33mPage�[39m }) �[33m=>�[39m {�[0m
❌ Create a Model (Local - chromium-local-provider)

File Location: Not Found

Error Message:

�[31mTest timeout of 600000ms exceeded.�[39m

🔗 Relationship Tests

[Show/Hide] Relationship Test Details (18 tests)
Kind Type SubType From To Model Design Name Status
edge binding permission ClusterRole ServiceAccount kubernetes Understanding Relationships ❌
edge binding permission Role ServiceAccount kubernetes Understanding Relationships ❌
edge non-binding network Service Deployment kubernetes service-to-deployment-network ✅
edge non-binding network Service Deployment kubernetes meshery-design-fixture.json ✅
edge non-binding reference ClusterRoleBinding ClusterRole kubernetes meshery-design-fixture.json ❌
hierarchical parent alias Container Deployment kubernetes container-hierarchical-parent-alias-relationship ✅
hierarchical parent alias Container Deployment kubernetes deployment-configmap-reference-relationship ❌
hierarchical parent alias Container Deployment kubernetes service-to-deployment-network ✅
hierarchical parent alias Container Deployment kubernetes meshery-design-fixture.json ✅
hierarchical parent alias Container Deployment kubernetes Understanding Relationships ✅
hierarchical parent alias Container Pod kubernetes container-hierarchical-parent-alias-relationship ✅
hierarchical parent inventory * Namespace kubernetes hierarchical-parent-namespace-relationship ✅
hierarchical parent inventory * Namespace kubernetes service-to-deployment-network ✅
hierarchical parent inventory * Namespace kubernetes pv-pvc-edge-non-binding-reference-relationship ✅
hierarchical parent inventory * Namespace kubernetes Understanding Relationships ✅
hierarchical sibling matchlabels ClusterRole ClusterRole kubernetes meshery-design-fixture.json ✅
hierarchical sibling matchlabels Deployment Deployment kubernetes meshery-design-fixture.json ✅
hierarchical sibling matchlabels Service Service kubernetes meshery-design-fixture.json ✅

@leecalcote
leecalcote merged commit 38b4cb1 into meshery:master Jun 8, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/ui User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Org Switcher: Dashboard fails to refresh dynamically & Oops page switcher does not persist

4 participants