From 825086aef02124a78f81ee476e091957318122b9 Mon Sep 17 00:00:00 2001 From: Sal Tijerina Date: Thu, 14 Nov 2024 11:16:44 -0600 Subject: [PATCH 1/2] add remote job id to job detail modal --- client/modules/workspace/src/JobsDetailModal/JobsDetailModal.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/modules/workspace/src/JobsDetailModal/JobsDetailModal.tsx b/client/modules/workspace/src/JobsDetailModal/JobsDetailModal.tsx index dc29a3d517..9fa9ff0cd0 100644 --- a/client/modules/workspace/src/JobsDetailModal/JobsDetailModal.tsx +++ b/client/modules/workspace/src/JobsDetailModal/JobsDetailModal.tsx @@ -80,6 +80,7 @@ export const JobsDetailModalBody: React.FC<{ > ), ...(jobData.remoteOutcome && { 'Remote Outcome': jobData.remoteOutcome }), + ...(jobData.remoteJobId && { 'Remote Job ID': jobData.remoteJobId }), }; if (jobData.remoteOutcome) { From 3526a1124edb57d7b0dc08a760e147bbe886aa66 Mon Sep 17 00:00:00 2001 From: Sal Tijerina Date: Thu, 14 Nov 2024 11:38:49 -0600 Subject: [PATCH 2/2] close interactive modal if job ends --- .../src/workspace/useInteractiveModalContext.ts | 1 + .../src/AppsSubmissionForm/AppsSubmissionForm.tsx | 6 +++++- .../workspace/src/JobsListing/JobsListing.tsx | 1 + client/modules/workspace/src/Toast/Toast.tsx | 13 ++++++++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/client/modules/_hooks/src/workspace/useInteractiveModalContext.ts b/client/modules/_hooks/src/workspace/useInteractiveModalContext.ts index c28b542548..f896c28bf4 100644 --- a/client/modules/_hooks/src/workspace/useInteractiveModalContext.ts +++ b/client/modules/_hooks/src/workspace/useInteractiveModalContext.ts @@ -5,6 +5,7 @@ type TInteractiveModalDetails = { interactiveSessionLink?: string; message?: string; openedBySubmit?: boolean; + uuid?: string; }; export type TInteractiveModalContext = [ diff --git a/client/modules/workspace/src/AppsSubmissionForm/AppsSubmissionForm.tsx b/client/modules/workspace/src/AppsSubmissionForm/AppsSubmissionForm.tsx index 737ff9479e..92eda37da7 100644 --- a/client/modules/workspace/src/AppsSubmissionForm/AppsSubmissionForm.tsx +++ b/client/modules/workspace/src/AppsSubmissionForm/AppsSubmissionForm.tsx @@ -379,7 +379,11 @@ export const AppsSubmissionForm: React.FC = () => { } else if (isSuccess) { reset(initialValues); if (definition.notes.isInteractive) { - setInteractiveModalDetails({ show: true, openedBySubmit: true }); + setInteractiveModalDetails({ + show: true, + openedBySubmit: true, + uuid: submitResult.uuid, + }); } } }, [submitResult]); diff --git a/client/modules/workspace/src/JobsListing/JobsListing.tsx b/client/modules/workspace/src/JobsListing/JobsListing.tsx index 36b4d637db..398d69cf4a 100644 --- a/client/modules/workspace/src/JobsListing/JobsListing.tsx +++ b/client/modules/workspace/src/JobsListing/JobsListing.tsx @@ -75,6 +75,7 @@ const InteractiveSessionButtons: React.FC<{ show: true, interactiveSessionLink, message, + uuid: uuid, }) } > diff --git a/client/modules/workspace/src/Toast/Toast.tsx b/client/modules/workspace/src/Toast/Toast.tsx index f45292c9ac..b8941eb95c 100644 --- a/client/modules/workspace/src/Toast/Toast.tsx +++ b/client/modules/workspace/src/Toast/Toast.tsx @@ -11,7 +11,7 @@ import { useInteractiveModalContext, TInteractiveModalContext, } from '@client/hooks'; -import { getToastMessage } from '../utils'; +import { getToastMessage, isTerminalState } from '../utils'; import styles from './Notifications.module.css'; const Notifications = () => { @@ -63,6 +63,17 @@ const Notifications = () => { navigate('/history'); }, }); + + // close interactive session modal if job is ended + if ( + isTerminalState(notification.extra.status) && + notification.extra.uuid === interactiveModalDetails.uuid + ) { + setInteractiveModalDetails({ + show: false, + }); + } + break; case 'markAllNotificationsAsRead': // update unread count state