From 05bf5565583b68e8d8e1f15aca5ba718edf5cd93 Mon Sep 17 00:00:00 2001 From: Jong Eun Lee Date: Wed, 27 Nov 2024 06:51:38 +0800 Subject: [PATCH] fix: session visibility in detail panel for < v24.12.0 manager --- react/src/components/SessionDetailContent.tsx | 24 ++++++++++++++++++- resources/i18n/de.json | 3 ++- resources/i18n/el.json | 3 ++- resources/i18n/en.json | 3 ++- resources/i18n/es.json | 3 ++- resources/i18n/fi.json | 3 ++- resources/i18n/fr.json | 3 ++- resources/i18n/id.json | 3 ++- resources/i18n/it.json | 3 ++- resources/i18n/ja.json | 3 ++- resources/i18n/ko.json | 3 ++- resources/i18n/mn.json | 3 ++- resources/i18n/ms.json | 3 ++- resources/i18n/pl.json | 3 ++- resources/i18n/pt-BR.json | 3 ++- resources/i18n/pt.json | 3 ++- resources/i18n/ru.json | 3 ++- resources/i18n/th.json | 3 ++- resources/i18n/vi.json | 3 ++- resources/i18n/zh-CN.json | 3 ++- resources/i18n/zh-TW.json | 3 ++- 21 files changed, 63 insertions(+), 21 deletions(-) diff --git a/react/src/components/SessionDetailContent.tsx b/react/src/components/SessionDetailContent.tsx index 98f2664bf0..fb7d4cfd67 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 && ( + + )}