-
Notifications
You must be signed in to change notification settings - Fork 78
feat(FR-2209): scope admin serving by project for project admins #6652
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ import EndpointList from '../components/EndpointList'; | |
| import { useWebUINavigate } from '../hooks'; | ||
| import { useCurrentUserRole } from '../hooks/backendai'; | ||
| import { useBAIPaginationOptionStateOnSearchParamLegacy } from '../hooks/reactPaginationQueryOptions'; | ||
| import { useCurrentProjectValue } from '../hooks/useCurrentProject'; | ||
| import { useEffectiveAdminRole } from '../hooks/useCurrentUserProjectRoles'; | ||
| import { Skeleton } from 'antd'; | ||
| import { | ||
| BAICard, | ||
|
|
@@ -32,6 +34,16 @@ const AdminModelCardListPage = React.lazy( | |
| const ServingTabContent: React.FC = () => { | ||
| 'use memo'; | ||
| const { t } = useTranslation(); | ||
| const effectiveRole = useEffectiveAdminRole(); | ||
| const currentProject = useCurrentProjectValue(); | ||
|
|
||
| // Path B (interim): legacy `endpoint_list(project: UUID)` for project admins. | ||
| // Domain-admin scope cannot be precisely matched via the current schema — | ||
| // `endpoint_list` has no `scope_id` argument and there is no `endpoint_nodes` | ||
| // Relay node. Leave unfiltered for domainAdmin until backend support lands. | ||
| // TODO(needs-backend): FR-2313 — domain-scope RBAC for endpoint_list | ||
| const projectFilter = | ||
| effectiveRole === 'projectAdmin' ? (currentProject.id ?? null) : null; | ||
|
Comment on lines
+45
to
+46
|
||
|
|
||
| const [queryParam, setQueryParam] = useQueryStates( | ||
| { | ||
|
|
@@ -71,8 +83,9 @@ const ServingTabContent: React.FC = () => { | |
| limit: baiPaginationOption.limit, | ||
| filter: mergeFilterValues([lifecycleStageFilter, queryParam.filter]), | ||
| order: queryParam.order, | ||
| project: projectFilter, | ||
| }), | ||
| [baiPaginationOption, lifecycleStageFilter, queryParam], | ||
| [baiPaginationOption, lifecycleStageFilter, queryParam, projectFilter], | ||
| ); | ||
|
|
||
| const deferredQueryVariables = useDeferredValue(queryVariables); | ||
|
|
@@ -85,12 +98,14 @@ const ServingTabContent: React.FC = () => { | |
| $limit: Int! | ||
| $filter: String | ||
| $order: String | ||
| $project: UUID | ||
| ) { | ||
| endpoint_list( | ||
| offset: $offset | ||
| limit: $limit | ||
| filter: $filter | ||
| order: $order | ||
| project: $project | ||
| ) { | ||
| total_count | ||
| items { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
projectFilterusesnullfor the “no project filter” case, which means$projectis always sent to GraphQL as an explicit null. Elsewhere in the codebase,endpoint_listoptional project scoping is typically omitted by leaving the variableundefined(e.g.,react/src/components/Chat/EndpointSelect.tsx:137-140passes only{limit: 10}), which avoids any backend behavior differences between “arg omitted” vs “arg provided as null”. Consider changing the non-projectAdmin branch toundefined(and keeping the variable optional) so Relay omits$projectentirely when unscoped.