Skip to content

fix: remove admin from sidebar + add PATCH to CORS#274

Merged
DevanshuNEU merged 1 commit into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/cors-patch-method
Mar 2, 2026
Merged

fix: remove admin from sidebar + add PATCH to CORS#274
DevanshuNEU merged 1 commit into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/cors-patch-method

Conversation

@DevanshuNEU

@DevanshuNEU DevanshuNEU commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator

Hotfix for two issues found in production after PR #273 merge:

  1. Admin link visible to ALL users in sidebar -- removed. Admin only accessible via direct URL /dashboard/admin now.
  2. PATCH missing from CORS allow_methods -- tier update endpoint was failing preflight.
  3. Added retry:false to admin query so non-admin users dont retry 403s.

3 files, 2 insertions, 3 deletions.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for PATCH requests in backend API calls.
  • Changes

    • Reorganized admin section navigation (removed from sidebar, now accessible as a standalone page with protected access).
    • Modified admin page error handling to disable automatic retry behavior on request failures.

@vercel

vercel Bot commented Mar 2, 2026

Copy link
Copy Markdown

@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Mar 2, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7654641 and 10fb80d.

📒 Files selected for processing (5)
  • backend/main.py
  • frontend/src/App.tsx
  • frontend/src/components/Dashboard.tsx
  • frontend/src/components/dashboard/Sidebar.tsx
  • frontend/src/pages/AdminPage.tsx
💤 Files with no reviewable changes (2)
  • frontend/src/components/Dashboard.tsx
  • frontend/src/components/dashboard/Sidebar.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/src/App.tsx
  • frontend/src/pages/AdminPage.tsx

📝 Walkthrough

Walkthrough

The Admin page route is relocated from the Dashboard component to a standalone /admin route in the main App component, protected by authentication middleware. The Sidebar's Admin navigation link is removed. Backend CORS middleware is updated to allow PATCH requests, and AdminPage query retries are disabled.

Changes

Cohort / File(s) Summary
Backend CORS Configuration
backend/main.py
Extended CORSMiddleware allowed methods to include PATCH alongside GET, POST, PUT, DELETE, and OPTIONS.
Frontend Routing Restructuring
frontend/src/App.tsx, frontend/src/components/Dashboard.tsx
Moved Admin route from Dashboard's nested routing to top-level App routing at /admin, wrapped with ProtectedRoute for access control.
Frontend Navigation & Admin Page
frontend/src/components/dashboard/Sidebar.tsx, frontend/src/pages/AdminPage.tsx
Removed Admin link from main navigation sidebar; configured AdminPage useQuery with retry: false to disable automatic failure retries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #273: Introduces admin dashboard functionality with modifications to App.tsx, Dashboard.tsx, Sidebar.tsx, and backend/main.py—the same core files affected by this routing and CORS restructuring.

Poem

🐰 Hop, hop, the admin route takes flight,
From nested depths to standalone height,
With PATCH requests now allowed to roam,
And retries disabled in their new home,
A cleaner path for those in control!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: removing the Admin link from the sidebar and adding PATCH to CORS allowed methods.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DevanshuNEU DevanshuNEU force-pushed the fix/cors-patch-method branch from bcc3085 to 7654641 Compare March 2, 2026 05:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/vercel.json`:
- Around line 9-13: The rewrite rule in vercel.json using "source": "/(.*)" with
"has": [{"type":"host","value":"admin.opencodeintel.com"}] currently rewrites to
"/admin", which preserves the browser pathname and prevents React Router
BrowserRouter from seeing "/admin"; change the rule so its "destination" points
to "/index.html" (so the SPA can handle routing) or convert it to a 3xx redirect
that changes the browser URL to "/admin" instead—update the rule that contains
"source", "has" and "destination" accordingly.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bcc3085 and 7654641.

📒 Files selected for processing (6)
  • backend/main.py
  • frontend/src/App.tsx
  • frontend/src/components/Dashboard.tsx
  • frontend/src/components/dashboard/Sidebar.tsx
  • frontend/src/pages/AdminPage.tsx
  • frontend/vercel.json
💤 Files with no reviewable changes (2)
  • frontend/src/components/Dashboard.tsx
  • frontend/src/components/dashboard/Sidebar.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/main.py

Comment thread frontend/vercel.json Outdated
Admin completely removed from user dashboard:
- Removed from Dashboard.tsx (no /dashboard/admin route)
- Removed from Sidebar.tsx (no admin link, no Shield icon)
- Zero admin traces in any user-facing component

Admin is now a standalone route:
- /admin in App.tsx -- no DashboardLayout, no sidebar, no topnav
- ProtectedRoute wraps it (must be logged in)
- Backend 403 enforces ADMIN_EMAILS check
- retry:false prevents non-admins from hammering 403

Vercel rewrite added:
- admin.opencodeintel.com -> /admin (add domain in Vercel dashboard)

Also: PATCH added to CORS allow_methods for tier update endpoint.
@DevanshuNEU DevanshuNEU force-pushed the fix/cors-patch-method branch from 7654641 to 10fb80d Compare March 2, 2026 17:00
@vercel

vercel Bot commented Mar 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opencodeintel Ready Ready Preview, Comment Mar 2, 2026 5:08pm

@DevanshuNEU DevanshuNEU merged commit 5535521 into OpenCodeIntel:main Mar 2, 2026
7 checks passed
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.

1 participant