feat(FR-2576): add Project Admin Sessions page using projectSessionsV2#6696
feat(FR-2576): add Project Admin Sessions page using projectSessionsV2#6696
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🔴 | Statements | 8.52% (-0.06% 🔻) |
1757/20618 |
| 🔴 | Branches | 7.82% (-0.05% 🔻) |
1131/14456 |
| 🔴 | Functions | 5.09% (-0.04% 🔻) |
285/5594 |
| 🔴 | Lines | 8.25% (-0.05% 🔻) |
1649/19997 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🔴 | ... / ProjectSessionV2Nodes.tsx |
0% | 0% | 0% | 0% |
| 🔴 | ... / ProjectAdminSessionsPage.tsx |
0% | 0% | 0% | 0% |
Test suite run success
856 tests passing in 39 suites.
Report generated by 🧪jest coverage report action from 749274a
There was a problem hiding this comment.
Pull request overview
Adds a new Project Admin → Sessions page to the Backend.AI WebUI, backed by the projectSessionsV2 GraphQL API, and wires it into routing + the admin menu so project admins can browse and manage sessions in the current project.
Changes:
- Add
webui.menu.ProjectSessionsi18n key (English). - Add
/project-admin-sessionsroute + admin menu entry for project admins. - Introduce
ProjectAdminSessionsPage(query/filter/sort/paginate + terminate action) and reusableProjectSessionV2Nodestable component for SessionV2 lists.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/i18n/en.json | Adds the new menu label for “Project Sessions”. |
| react/src/routes.tsx | Registers the /project-admin-sessions route and lazy-loads the page. |
| react/src/pages/ProjectAdminSessionsPage.tsx | Implements the new Project Admin Sessions page using projectSessionsV2 + termination mutation. |
| react/src/hooks/useWebUIMenuItems.tsx | Adds the “Project Sessions” admin menu item and includes it in project-admin page keys. |
| react/src/components/ProjectSessionV2Nodes.tsx | Adds a SessionV2 table component with sorting and per-row actions (terminate, etc.). |
| { | ||
| key: 'terminate', | ||
| title: t('session.TerminateSession'), | ||
| icon: <PowerOffIcon />, | ||
| type: 'danger' as const, | ||
| disabled: isTerminated, | ||
| onClick: () => onClickTerminate?.(session), | ||
| }, |
There was a problem hiding this comment.
The "Terminate" row action is always rendered even when onClickTerminate is not provided, which makes the action clickable but a no-op in consumers that omit the handler. Consider only including the terminate action when onClickTerminate is defined (or set disabled: true when it's undefined) to avoid misleading UX.
| { | |
| key: 'terminate', | |
| title: t('session.TerminateSession'), | |
| icon: <PowerOffIcon />, | |
| type: 'danger' as const, | |
| disabled: isTerminated, | |
| onClick: () => onClickTerminate?.(session), | |
| }, | |
| onClickTerminate | |
| ? { | |
| key: 'terminate', | |
| title: t('session.TerminateSession'), | |
| icon: <PowerOffIcon />, | |
| type: 'danger' as const, | |
| disabled: isTerminated, | |
| onClick: () => onClickTerminate(session), | |
| } | |
| : undefined, |
| "ProfileUpdated": "Profile has been successfully updated.", | ||
| "Project": "Project", | ||
| "ProjectMembers": "Users", | ||
| "ProjectSessions": "Project Sessions", |
There was a problem hiding this comment.
This new menu label key is added only to en.json. Other locale files under resources/i18n/ do not define webui.menu.ProjectSessions, so non-English locales will fall back to the raw key at runtime. Please add the same key to all supported locale JSON files (even if temporarily copying the English string) and then provide proper translations.
| filterProperties={[ | ||
| { | ||
| key: 'id', | ||
| propertyLabel: 'ID', |
There was a problem hiding this comment.
propertyLabel: 'ID' is user-facing text in the filter UI but is hard-coded. Please use an existing i18n key (e.g., a session/general ID label) via t(...) so this label is translated like the other filter property labels.
| propertyLabel: 'ID', | |
| propertyLabel: t('general.ID'), |
Security & Performance ReviewComprehensive review of the 717 added lines across Summary: 0 Critical, 0 High, 1 Medium, 3 Low. 2 fixed in Findings
Areas explicitly checked and found cleanSecurity
Performance
Relay/GraphQL correctness
Verification
Additional commit: |
58a5757 to
749274a
Compare

Resolves #6695(FR-2576)
Summary
Adds a new Project Admin Sessions page at
/project-admin-sessionsthat lets project admins view and manage compute sessions within their current project, backed by the newprojectSessionsV2GraphQL query andterminateProjectSessionsV2mutation.react/src/pages/ProjectAdminSessionsPage.tsxmirroringProjectAdminUsersPage(BAICard + BAIErrorBoundary + Suspense + gated oncurrentProject.id).react/src/components/ProjectSessionV2Nodes.tsxrendering a Relay plural fragment onSessionV2. Does not modify the existing v1SessionNodes.useWebUIMenuItems.tsxunder theadmin-operationsgroup withBAISessionsIconand thewebui.menu.ProjectSessionsi18n label. Added toVALID_MENU_KEYS,ALL_ADMIN_PAGE_KEYS, andPROJECT_ADMIN_PAGE_KEYS.routes.tsxand English i18n keywebui.menu.ProjectSessionsadded toresources/i18n/en.json(translations follow/i18n).BAIGraphQLPropertyFilterwithid,name,userUuid,domainName+ a Running/FinishedBAIRadioGroupthat maps toSessionV2Statusbuckets.SessionV2OrderBywith fieldsCREATED_AT,TERMINATED_AT,STATUS,ID,NAME. DefaultCREATED_AT DESC.useBAIPaginationOptionStateOnSearchParam+BAIFetchKeyButtonwith 15s auto-refresh.Modal.confirm→terminateProjectSessionsV2with{ scope: { projectId }, sessionIds: [id], forced: false }→ toast + fetch key bump. Disabled forTERMINATED/TERMINATING/CANCELLEDsessions.sessionDetailsearch param (v1 drawer compatibility caveat inline-commented — full v2 drawer wiring is out of scope).Column mapping
SessionV2metadata.namelifecycle.statusresource.allocation.{used,requested}.entries(non-cpu/mem)resource.allocation.{used,requested}.entries(cpu)resource.allocation.{used,requested}.entries(mem, formatted)lifecycle.createdAt→lifecycle.terminatedAt ?? nowimages.edges[0].node.identityresource.resourceGroupNamemetadata.sessionTypemetadata.clusterModelifecycle.createdAtuser.basicInfo.emailDefault-visible: name, status, cpu, mem, accelerator, elapsedTime, owner (superadmin only). Default-hidden: environment, resourceGroup, sessionType, clusterMode, createdAt.
Intentionally omitted:
dependenciesandagent_idscolumns — these fields do not exist on the v2SessionV2schema.Verification
bash scripts/verify.shoutput tail:Checklist
projectSessionsV2/terminateProjectSessionsV2availability/project-admin-sessionsScreenshots
Skipped. The running local dev server belongs to another worktree and the
projectSessionsV2/terminateProjectSessionsV2APIs this page depends on may not be deployed to the shared test server yet. Capture manually after backend v2 support is available in the target environment.