Skip to content

Commit

Permalink
task/DSAPP-77, task/WA-363: Remote Job Id & Interactive Session Modal…
Browse files Browse the repository at this point in the history
… handling (#1487)

* add remote job id to job detail modal

* close interactive modal if job ends
  • Loading branch information
rstijerina authored Nov 15, 2024
1 parent d056bb2 commit 7faea1b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type TInteractiveModalDetails = {
interactiveSessionLink?: string;
message?: string;
openedBySubmit?: boolean;
uuid?: string;
};

export type TInteractiveModalContext = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Check warning on line 389 in client/modules/workspace/src/AppsSubmissionForm/AppsSubmissionForm.tsx

View workflow job for this annotation

GitHub Actions / React_NX_linting

React Hook useEffect has missing dependencies: 'definition.notes.isInteractive', 'initialValues', 'isSuccess', 'reset', and 'setInteractiveModalDetails'. Either include them or remove the dependency array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const JobsDetailModalBody: React.FC<{
></Collapse>
),
...(jobData.remoteOutcome && { 'Remote Outcome': jobData.remoteOutcome }),
...(jobData.remoteJobId && { 'Remote Job ID': jobData.remoteJobId }),
};

if (jobData.remoteOutcome) {
Expand Down
1 change: 1 addition & 0 deletions client/modules/workspace/src/JobsListing/JobsListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const InteractiveSessionButtons: React.FC<{
show: true,
interactiveSessionLink,
message,
uuid: uuid,
})
}
>
Expand Down
13 changes: 12 additions & 1 deletion client/modules/workspace/src/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7faea1b

Please sign in to comment.