Skip to content

fix: decouple UI layout from admin routes #961

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

Merged
merged 23 commits into from
May 28, 2025

Conversation

jescalada
Copy link
Contributor

@jescalada jescalada commented Mar 28, 2025

Fixes #918, along with #917.

This PR aims to make route access more intuitive. All /admin routes have been replaced with /dashboard, and relevant files have been renamed. Actual admin-only routes, such as the list of users, are displayed with the /admin/ prefix. For example: /dashboard/admin/user.

Unit tests execute the same way as before, and E2E tests have been expanded and amended to work with the new setup.

I also changed the login flow to redirect to the repo list (which seems more intuitive than one's profile), and the username update flow to redirect to one's own profile instead of the "user view" admin route (which would error out for non-admins).

Finally, I added a config entry to define what routes have a specific auth requirement. The rules are shown by default but not enabled.

"uiRouteAuth": {
    "enabled": false,
    "rules": [
      {
        "pattern": "/dashboard/*",
        "adminOnly": false,
        "loginRequired": true
      },
      {
        "pattern": "/admin/*",
        "adminOnly": true,
        "loginRequired": true
      }
    ]
  }

Changelog

  • Add optional route redirection (admin-only, login required)
    • Can be configured through proxy.config.json
    • Configuration allows multiple regex rules
  • Refactor "admin" layout/routes into "dashboard"
  • Fix error handling on repo page
    • Catches GitHub repo retrieval error and makes it more descriptive
  • Add new E2E test for basic login flow (with admin/admin account) and redirect
  • Fix login Cypress command
    • Existing repo E2E test now logs in first

@github-actions github-actions bot added the fix label Mar 28, 2025
Copy link

netlify bot commented Mar 28, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 67d4155
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/682d77d042cbab00082a3f3d

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.

Project coverage is 48.49%. Comparing base (fc6f166) to head (67d4155).

Files with missing lines Patch % Lines
src/config/index.ts 40.00% 3 Missing ⚠️
src/service/routes/auth.js 50.00% 1 Missing ⚠️
src/service/routes/config.js 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #961      +/-   ##
==========================================
- Coverage   48.51%   48.49%   -0.02%     
==========================================
  Files          51       51              
  Lines        2092     2099       +7     
  Branches      241      242       +1     
==========================================
+ Hits         1015     1018       +3     
- Misses       1040     1044       +4     
  Partials       37       37              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JamieSlome
Copy link
Member

@jescalada - can you resolve conflicts and we will get this merged? 👏

@jescalada
Copy link
Contributor Author

Sure! As you mentioned in #917, I'll implement the optional check first, then it should be ready to review. 😃

@jescalada
Copy link
Contributor Author

Hi @JamieSlome, it should be good to review now! I added the config entry, new RouteGuard logic, and updated the PR description.

@JamieSlome
Copy link
Member

Do we agree that this would be considered a minor bump? @jescalada

@jescalada
Copy link
Contributor Author

@JamieSlome Yes, it should be backward compatible, so minor bump is fine!

Also, #963 which is related is ready for a final look/merge. Thank you!

Copy link

@sam-holmes2 sam-holmes2 left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for your contribution 🥳

@JamieSlome JamieSlome merged commit a03b1e0 into finos:main May 28, 2025
14 checks passed
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.

Add UI route authorization and decouple admin routes
3 participants