Skip to content

feat(ui-react): add admin sessions list and detail pages#6107

Open
luannmoreira wants to merge 1 commit intomasterfrom
feature/admin-session-list-tests
Open

feat(ui-react): add admin sessions list and detail pages#6107
luannmoreira wants to merge 1 commit intomasterfrom
feature/admin-session-list-tests

Conversation

@luannmoreira
Copy link
Copy Markdown
Member

What

Adds paginated admin sessions list and per-session detail pages to the
React console, accessible at /admin/sessions and
/admin/sessions/:uid.

Why

The admin console lacked visibility into sessions across all namespaces.
The Vue admin already exposed this data; this brings parity to the React
console.

Changes

  • pages/admin/Sessions: table with active indicator, auth shield,
    device chip, IP, and timestamps; clicking a row navigates to the
    detail page; error banner uses role="alert" for accessibility
  • pages/admin/SessionDetails: per-session detail view
  • hooks/useAdminSessionsList: React Query hook wrapping
    getSessionsAdmin; transforms SdkHttpError (which carries
    status/headers but no message) into a human-readable Error
    before surfacing it — without this, error.message was undefined
    at runtime despite TypeScript typing it as Error | null
  • hooks/useAdminSessionDetail: hook for the detail page
  • App.tsx: registers the two new routes inside the admin guard

Testing

27 new unit tests covering the hook (disabled when non-admin, success
mapping, all error-transformation branches) and the page (loading,
empty, error banner, row rendering, navigation, auth indicators, device
fallback, pagination).

npx vitest run src/hooks/__tests__/useAdminSessionsList.test.ts \
              src/pages/admin/__tests__/Sessions.test.tsx

@luannmoreira luannmoreira requested a review from a team as a code owner April 2, 2026 15:41
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Claude finished @luannmoreira's task in 7m 16s —— View job


Code Review Complete

Reviewed 7 files across code quality, security, testing, TypeScript/React patterns, and architecture — no issues found. The code looks good as-is.

The implementation is well-structured: hooks correctly gate on admin state, error transformation in useAdminSessionsList properly handles SDK errors, routes are placed inside the existing admin guard, pagination handles edge cases, and the test suite covers loading/empty/error states plus row rendering and navigation.


If you push additional changes and want a new review, tag @shellhub-io/admin and a team member can trigger it.

@luannmoreira luannmoreira self-assigned this Apr 2, 2026
@luannmoreira luannmoreira force-pushed the feature/admin-session-list-tests branch from 98697c8 to 52a9f92 Compare April 2, 2026 18:26
@gustavosbarreto
Copy link
Copy Markdown
Member

/review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

- Add AdminSessions page with table, pagination, auth indicators,
  and per-row navigation to session detail
- Add AdminSessionDetails page
- Add useAdminSessionsList and useAdminSessionDetail hooks; transform
  SdkHttpError to a human-readable Error before surfacing to the UI
- Register /admin/sessions and /admin/sessions/:uid routes in App.tsx
- Add unit tests for the hook (error transformation, disabled state,
  success mapping) and the page (loading, empty, error, row rendering,
  navigation, auth indicators)
@luannmoreira luannmoreira force-pushed the feature/admin-session-list-tests branch from 52a9f92 to d8aa6ed Compare April 7, 2026 18:35
@gustavosbarreto
Copy link
Copy Markdown
Member

/review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Claude finished @gustavosbarreto's task in 7m 18s —— View job


Code Review Complete

Reviewed 7 files across code quality, security, testing, TypeScript/React patterns, and architecture — no issues found. The code looks good as-is.

The implementation follows established patterns well: hooks correctly gate on admin state, error transformation in useAdminSessionsList properly handles SDK errors, routes are placed inside the existing AdminRoute + LicenseGuard guard, the new paginated hook coexists cleanly with the dashboard-scoped useAdminSessions, and the test suite covers loading/empty/error states plus row rendering and navigation.


If you've addressed the feedback and want a new review, tag @shellhub-io/admin and a team member can trigger it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ui kind/feature New feature or request product/enterprise Issue/PR related to Enterprise Edition status/good-to-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants