diff --git a/react/src/components/SessionDetailContent.tsx b/react/src/components/SessionDetailContent.tsx index 98f2664bf..fb7d4cfd6 100644 --- a/react/src/components/SessionDetailContent.tsx +++ b/react/src/components/SessionDetailContent.tsx @@ -10,6 +10,7 @@ import SessionStatusTag from './ComputeSessionNodeItems/SessionStatusTag'; import SessionTypeTag from './ComputeSessionNodeItems/SessionTypeTag'; import Flex from './Flex'; import ImageMetaIcon from './ImageMetaIcon'; +import { SessionDetailContentLegacyQuery } from './__generated__/SessionDetailContentLegacyQuery.graphql'; import { SessionDetailContentQuery } from './__generated__/SessionDetailContentQuery.graphql'; import { Alert, @@ -35,6 +36,24 @@ const SessionDetailContent: React.FC<{ const userRole = useCurrentUserRole(); const { md } = Grid.useBreakpoint(); + // TODO: remove and refactor this waterfall request after v24.12.0 + // get the project id of the session for <= v24.12.0. + const { session_for_project_id } = + useLazyLoadQuery( + graphql` + query SessionDetailContentLegacyQuery($uuid: UUID!) { + session_for_project_id: compute_session(id: $uuid) { + group_id + } + } + `, + { + uuid: id, + }, + { + fetchPolicy: 'network-only', + }, + ); const { session, legacy_session } = useLazyLoadQuery( // In compute_session_node, there are missing fields. We need to use `compute_session` to get the missing fields. @@ -92,7 +111,7 @@ const SessionDetailContent: React.FC<{ { id: toGlobalId('ComputeSessionNode', id), uuid: id, - project_id: currentProject.id, + project_id: session_for_project_id?.group_id || currentProject.id, }, { fetchPolicy: 'network-only', @@ -106,6 +125,9 @@ const SessionDetailContent: React.FC<{ legacy_session.image + '@' + legacy_session.architecture; return session ? ( + {session_for_project_id?.group_id !== currentProject.id && ( + + )}