Skip to content

Commit

Permalink
fix: session visibility in detail panel for < v24.12.0 manager (#2887)
Browse files Browse the repository at this point in the history
Resolve #2886

Please read the #2886 first.

Added a warning message when viewing a session that belongs to a different project. The message is displayed at the top of the session detail page and has been localized across all supported languages.

![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/XqC2uNFuj0wg8I60sMUh/d9d9e168-edf1-4afc-8871-c60a835c3b22.png)
  • Loading branch information
yomybaby committed Nov 26, 2024
1 parent c285c0c commit f2a1217
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 21 deletions.
24 changes: 23 additions & 1 deletion react/src/components/SessionDetailContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<SessionDetailContentLegacyQuery>(
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<SessionDetailContentQuery>(
// In compute_session_node, there are missing fields. We need to use `compute_session` to get the missing fields.
Expand Down Expand Up @@ -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',
Expand All @@ -106,6 +125,9 @@ const SessionDetailContent: React.FC<{
legacy_session.image + '@' + legacy_session.architecture;
return session ? (
<Flex direction="column" gap={'sm'} align="stretch">
{session_for_project_id?.group_id !== currentProject.id && (
<Alert message={t('session.NotInProject')} type="warning" showIcon />
)}
<Flex
direction="row"
justify="between"
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Nur ausführen, wenn sich der Zustand über einen unangemessen langen Zeitraum nicht ändert.",
"ForceTerminateWarningMsg3": "Durch diese Aktion werden die tatsächlichen Container auf dem/den Agent(en) nicht gelöscht. \nMöglicherweise ist eine manuelle Bereinigung erforderlich.",
"ContainerToCleanUp": "Behälter zum Aufräumen",
"SessionNotFound": "Sie haben keine Zugriffsberechtigung für diese Sitzung oder die Sitzung existiert nicht."
"SessionNotFound": "Sie haben keine Zugriffsberechtigung für diese Sitzung oder die Sitzung existiert nicht.",
"NotInProject": "Diese Sitzung gehört zu einem anderen Projekt."
},
"button": {
"Cancel": "Stornieren",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Εκτελέστε μόνο όταν η κατάσταση δεν αλλάζει για αδικαιολόγητα μεγάλο χρονικό διάστημα.",
"ForceTerminateWarningMsg3": "Αυτή η ενέργεια δεν διαγράφει τα πραγματικά κοντέινερ στους πράκτορες. \nΕνδέχεται να απαιτείται χειροκίνητος καθαρισμός.",
"ContainerToCleanUp": "Δοχείο(α) για καθαρισμό",
"SessionNotFound": "Δεν έχετε δικαίωμα πρόσβασης σε αυτή τη συνεδρία ή η συνεδρία δεν υπάρχει."
"SessionNotFound": "Δεν έχετε δικαίωμα πρόσβασης σε αυτή τη συνεδρία ή η συνεδρία δεν υπάρχει.",
"NotInProject": "Αυτή η συνεδρία ανήκει σε διαφορετικό έργο."
},
"button": {
"Cancel": "Ματαίωση",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@
"ForceTerminateWarningMsg2": "Execute only when the state does not change for an unreasonably long period of time.",
"ForceTerminateWarningMsg3": "This action does not delete the actual containers on the agent(s). Manual cleanup may be required.",
"ContainerToCleanUp": "Container(s) to clean up",
"SessionNotFound": "You do not have permission to access this session or the session does not exist."
"SessionNotFound": "You do not have permission to access this session or the session does not exist.",
"NotInProject": "This session belongs to a different project"
},
"modelService": {
"Services": "Services",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,8 @@
"ForceTerminateWarningMsg2": "Ejecutar solo cuando el estado no cambie durante un período de tiempo excesivamente largo.",
"ForceTerminateWarningMsg3": "Esta acción no elimina los contenedores reales de los agentes. \nEs posible que se requiera una limpieza manual.",
"ContainerToCleanUp": "Contenedor(es) para limpiar",
"SessionNotFound": "No tiene permiso para acceder a esta sesión o la sesión no existe."
"SessionNotFound": "No tiene permiso para acceder a esta sesión o la sesión no existe.",
"NotInProject": "Esta sesión pertenece a un proyecto diferente."
},
"settings": {
"ATOMsupport": "ATOM",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,8 @@
"ForceTerminateWarningMsg2": "Suorita vain, kun tila ei muutu kohtuuttoman pitkään.",
"ForceTerminateWarningMsg3": "Tämä toiminto ei poista agenttien varsinaisia ​​säilöjä. \nManuaalinen puhdistus saattaa olla tarpeen.",
"ContainerToCleanUp": "Säiliö(t) puhdistettava(t).",
"SessionNotFound": "Sinulla ei ole oikeuksia käyttää tätä istuntoa tai istuntoa ei ole olemassa."
"SessionNotFound": "Sinulla ei ole oikeuksia käyttää tätä istuntoa tai istuntoa ei ole olemassa.",
"NotInProject": "Tämä istunto kuuluu eri hankkeeseen."
},
"settings": {
"ATOMsupport": "ATOM",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Exécuter uniquement lorsque l’état ne change pas pendant une période de temps déraisonnablement longue.",
"ForceTerminateWarningMsg3": "Cette action ne supprime pas les conteneurs réels sur le ou les agents. \nUn nettoyage manuel peut être nécessaire.",
"ContainerToCleanUp": "Conteneur(s) à nettoyer",
"SessionNotFound": "Vous n'avez pas la permission d'accéder à cette session ou la session n'existe pas."
"SessionNotFound": "Vous n'avez pas la permission d'accéder à cette session ou la session n'existe pas.",
"NotInProject": "Cette session fait partie d'un autre projet."
},
"button": {
"Cancel": "Annuler",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@
"ForceTerminateWarningMsg2": "Jalankan hanya ketika keadaan tidak berubah dalam jangka waktu yang terlalu lama.",
"ForceTerminateWarningMsg3": "Tindakan ini tidak menghapus penampung sebenarnya pada agen. \nPembersihan manual mungkin diperlukan.",
"ContainerToCleanUp": "Wadah yang harus dibersihkan",
"SessionNotFound": "Anda tidak memiliki izin untuk mengakses sesi ini atau sesi tersebut tidak ada."
"SessionNotFound": "Anda tidak memiliki izin untuk mengakses sesi ini atau sesi tersebut tidak ada.",
"NotInProject": "Sesi ini merupakan bagian dari proyek yang berbeda."
},
"button": {
"Cancel": "Batalkan",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@
"ForceTerminateWarningMsg2": "Eseguire solo quando lo stato non cambia per un periodo di tempo irragionevolmente lungo.",
"ForceTerminateWarningMsg3": "Questa azione non elimina i contenitori effettivi sugli agenti. \nPotrebbe essere necessaria la pulizia manuale.",
"ContainerToCleanUp": "Contenitori da pulire",
"SessionNotFound": "Non si ha il permesso di accedere a questa sessione o la sessione non esiste."
"SessionNotFound": "Non si ha il permesso di accedere a questa sessione o la sessione non esiste.",
"NotInProject": "Questa sessione appartiene a un progetto diverso."
},
"button": {
"Cancel": "Annulla",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "状態が不当に長時間変化しない場合にのみ実行してください。",
"ForceTerminateWarningMsg3": "このアクションでは、エージェント上の実際のコンテナは削除されません。\n手動によるクリーンアップが必要な場合があります。",
"ContainerToCleanUp": "クリーンアップするコンテナ",
"SessionNotFound": "このセッションにアクセスする権限がないか、セッションが存在しません。"
"SessionNotFound": "このセッションにアクセスする権限がないか、セッションが存在しません。",
"NotInProject": "このセッションは別のプロジェクトに属しています。"
},
"button": {
"Cancel": "キャンセル",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@
"ForceTerminateWarningMsg2": "세션을 생성하거나 종료했는데 비정상적으로 오랫동안 상태가 변하지 않을 경우에만 사용하십시오.",
"ForceTerminateWarningMsg3": "연산노드에 컨테이너가 남아있는 경우 수동으로 컨테이너 삭제가 필요할 수 있습니다.",
"ContainerToCleanUp": "확인할 컨테이너 목록",
"SessionNotFound": "해당 세션에 접근할 권한이 없거나 세션이 존재하지 않습니다."
"SessionNotFound": "해당 세션에 접근할 권한이 없거나 세션이 존재하지 않습니다.",
"NotInProject": "이 세션은 다른 프로젝트에 속해 있습니다."
},
"modelService": {
"Services": "모델 서비스",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/mn.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@
"ForceTerminateWarningMsg2": "Үндэслэлгүй удаан хугацаанд төр өөрчлөгдөөгүй үед л гүйцэтгэнэ.",
"ForceTerminateWarningMsg3": "Энэ үйлдэл нь агент(үүд) дээрх бодит савыг устгахгүй. \nГараар цэвэрлэх шаардлагатай байж болно.",
"ContainerToCleanUp": "Цэвэрлэх сав(ууд).",
"SessionNotFound": "Танд энэ сессэд хандах зөвшөөрөл байхгүй эсвэл сесс байхгүй байна."
"SessionNotFound": "Танд энэ сессэд хандах зөвшөөрөл байхгүй эсвэл сесс байхгүй байна.",
"NotInProject": "Энэ хуралдаан нь өөр төсөлд хамаарна."
},
"button": {
"Cancel": "Цуцлах",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Laksanakan hanya apabila keadaan tidak berubah untuk tempoh masa yang tidak munasabah.",
"ForceTerminateWarningMsg3": "Tindakan ini tidak memadamkan bekas sebenar pada ejen. \nPembersihan manual mungkin diperlukan.",
"ContainerToCleanUp": "Bekas untuk dibersihkan",
"SessionNotFound": "Anda tidak mempunyai kebenaran untuk mengakses sesi ini atau sesi tidak wujud."
"SessionNotFound": "Anda tidak mempunyai kebenaran untuk mengakses sesi ini atau sesi tidak wujud.",
"NotInProject": "Sesi ini tergolong dalam projek yang berbeza"
},
"button": {
"Cancel": "Batal",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Wykonaj tylko wtedy, gdy stan nie zmienia się przez nieracjonalnie długi okres czasu.",
"ForceTerminateWarningMsg3": "Ta akcja nie usuwa rzeczywistych kontenerów agentów. \nMoże być konieczne ręczne czyszczenie.",
"ContainerToCleanUp": "Pojemnik(i) do oczyszczenia",
"SessionNotFound": "Nie masz uprawnień dostępu do tej sesji lub sesja nie istnieje."
"SessionNotFound": "Nie masz uprawnień dostępu do tej sesji lub sesja nie istnieje.",
"NotInProject": "Ta sesja należy do innego projektu."
},
"button": {
"Cancel": "Anuluj",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Execute somente quando o estado não mudar por um período de tempo excessivamente longo.",
"ForceTerminateWarningMsg3": "Esta ação não exclui os contêineres reais do(s) agente(s). \nA limpeza manual pode ser necessária.",
"ContainerToCleanUp": "Recipiente(s) para limpar",
"SessionNotFound": "Não tem permissão para aceder a esta sessão ou a sessão não existe."
"SessionNotFound": "Não tem permissão para aceder a esta sessão ou a sessão não existe.",
"NotInProject": "Esta sessão pertence a um projeto diferente."
},
"button": {
"Cancel": "Cancelar",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Execute somente quando o estado não mudar por um período de tempo excessivamente longo.",
"ForceTerminateWarningMsg3": "Esta ação não exclui os contêineres reais do(s) agente(s). \nA limpeza manual pode ser necessária.",
"ContainerToCleanUp": "Recipiente(s) para limpar",
"SessionNotFound": "Não tem permissão para aceder a esta sessão ou a sessão não existe."
"SessionNotFound": "Não tem permissão para aceder a esta sessão ou a sessão não existe.",
"NotInProject": "Esta sessão pertence a um projeto diferente."
},
"button": {
"Cancel": "Cancelar",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Выполнять только тогда, когда состояние не меняется в течение неоправданно длительного периода времени.",
"ForceTerminateWarningMsg3": "Это действие не удаляет фактические контейнеры на агенте(ах). \nМожет потребоваться ручная очистка.",
"ContainerToCleanUp": "Контейнер(ы) для очистки",
"SessionNotFound": "У вас нет разрешения на доступ к этому сеансу или сеанс не существует."
"SessionNotFound": "У вас нет разрешения на доступ к этому сеансу или сеанс не существует.",
"NotInProject": "Эта сессия принадлежит другому проекту."
},
"button": {
"Cancel": "Отмена",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@
"ForceTerminateWarningMsg2": "ดำเนินการเฉพาะเมื่อสถานะไม่เปลี่ยนแปลงเป็นระยะเวลานานเกินไปเท่านั้น",
"ForceTerminateWarningMsg3": "การกระทำนี้ไม่ได้ลบคอนเทนเนอร์จริงบนตัวแทน อาจต้องทำความสะอาดด้วยตนเอง",
"ContainerToCleanUp": "คอนเทนเนอร์ที่ต้องทำความสะอาด",
"SessionNotFound": "คุณไม่ได้รับอนุญาตให้เข้าถึงเซสชันนี้หรือไม่มีเซสชันนี้"
"SessionNotFound": "คุณไม่ได้รับอนุญาตให้เข้าถึงเซสชันนี้หรือไม่มีเซสชันนี้",
"NotInProject": "เซสชันนี้เป็นของโปรเจ็กต์อื่น"
},
"modelService": {
"Services": "บริการ",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "Chỉ thực hiện khi trạng thái không thay đổi trong một khoảng thời gian dài không hợp lý.",
"ForceTerminateWarningMsg3": "Hành động này không xóa các vùng chứa thực tế trên (các) tác nhân. \nCó thể cần phải dọn dẹp thủ công.",
"ContainerToCleanUp": "(Các) thùng chứa để dọn dẹp",
"SessionNotFound": "Bạn không có quyền truy cập phiên này hoặc phiên không tồn tại."
"SessionNotFound": "Bạn không có quyền truy cập phiên này hoặc phiên không tồn tại.",
"NotInProject": "Phiên này thuộc về một dự án khác."
},
"button": {
"Cancel": "Huỷ bỏ",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "仅当状态在不合理的长时间内没有发生变化时才执行。",
"ForceTerminateWarningMsg3": "此操作不会删除代理上的实际容器。\n可能需要手动清理。",
"ContainerToCleanUp": "需要清理的容器",
"SessionNotFound": "您没有访问该会话的权限或该会话不存在。"
"SessionNotFound": "您没有访问该会话的权限或该会话不存在。",
"NotInProject": "本次会议属于另一个项目。"
},
"button": {
"Cancel": "取消",
Expand Down
3 changes: 2 additions & 1 deletion resources/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@
"ForceTerminateWarningMsg2": "僅當狀態在不合理的長時間內沒有發生變化時才執行。",
"ForceTerminateWarningMsg3": "此操作不會刪除代理程式上的實際容器。\n可能需要手動清潔。",
"ContainerToCleanUp": "需要清理的容器",
"SessionNotFound": "您没有访问该会话的权限或该会话不存在。"
"SessionNotFound": "您没有访问该会话的权限或该会话不存在。",
"NotInProject": "本次会议属于另一个项目。"
},
"button": {
"Cancel": "取消",
Expand Down

0 comments on commit f2a1217

Please sign in to comment.