Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task/DSAPP-77, task/WA-363: Remote Job Id & Interactive Session Modal handling #1487

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -135,7 +135,7 @@
),
outputs: outputs.defaults,
}),
[definition, jobData]

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

React Hook useMemo has missing dependencies: 'appId', 'appVersion', 'configuration.defaults', 'fileInputs.defaults', 'outputs.defaults', and 'parameterSet.defaults'. Either include them or remove the dependency array
);

let missingAllocation: string | undefined;
Expand Down Expand Up @@ -228,7 +228,7 @@
const initialSteps = useMemo(() => {
const steps = getSteps();
return Object.keys(steps).length > 0 ? steps : {};
}, [

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

React Hook useMemo has a missing dependency: 'getSteps'. Either include it or remove the dependency array
fileInputs.fields,
parameterSet.fields,
configuration.fields,
Expand All @@ -249,7 +249,7 @@
const newSteps = getSteps();
setSteps(newSteps);
setCurrent(getInitialCurrentStep(newSteps));
}, [initialValues]);

Check warning on line 252 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: 'getInitialCurrentStep', 'getSteps', and 'reset'. Either include them or remove the dependency array

// Queue dependency handler.
const queueValue = watch('configuration.execSystemLogicalQueue');
Expand Down Expand Up @@ -297,7 +297,7 @@
configuration: updatedFields,
}));
}
}, [queueValue, setValue]);

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

React Hook React.useEffect has missing dependencies: 'allocations', 'definition', 'execSystems', and 'getValues'. Either include them or remove the dependency array

// TODO: DES-2916: Use Zod's superRefine feature instead of manually updating schema and tracking schema changes.
React.useEffect(() => {
Expand Down Expand Up @@ -338,7 +338,7 @@

setSteps(updatedSteps);
}
}, [fields]);

Check warning on line 341 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: 'configuration.fields' and 'steps'. Either include them or remove the dependency array

// next step transition does not block on invalid fields
const handleNextStep = useCallback(async () => {
Expand All @@ -348,11 +348,11 @@
await methods.trigger(stepFields);
const nextPage = steps[current].nextPage;
nextPage && setCurrent(nextPage);
}, [current, methods]);

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

React Hook useCallback has missing dependencies: 'fieldValues' and 'steps'. Either include them or remove the dependency array
const handlePreviousStep = useCallback(() => {
const prevPage = steps[current].prevPage;
prevPage && setCurrent(prevPage);
}, [current]);

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

React Hook useCallback has a missing dependency: 'steps'. Either include it or remove the dependency array
const {
mutate: submitJob,
isPending,
Expand All @@ -379,10 +379,14 @@
} 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

const submitJobCallback = (submitData: TFormValues) => {
const jobData: Omit<TJobBody, 'job'> & { job: TJobSubmit } = {
Expand Down Expand Up @@ -411,7 +415,7 @@
Object.entries(submitData.inputs)
.map(([k, v]) => {
// filter out read only inputs. 'FIXED' inputs are tracked as readOnly
if (fileInputs.fields?.[k].readOnly) return;

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

Array.prototype.map() expects a return value from arrow function
return {
name: k,
sourceUrl: !isTargetPathField(k) ? v : null,
Expand Down Expand Up @@ -450,7 +454,7 @@
return {
[sParameterSet]: Object.entries(sParameterValue)
.map(([k, v]) => {
if (!v) return;

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

View workflow job for this annotation

GitHub Actions / React_NX_linting

Array.prototype.map() expects a return value from arrow function
const field = parameterSet.fields?.[sParameterSet]?.[k];
// filter read only parameters. 'FIXED' parameters are tracked as readOnly
if (field?.readOnly) return;
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
Loading