Skip to content

Commit

Permalink
Merge pull request #592 from ianmcorvidae/periodic-notifications-il
Browse files Browse the repository at this point in the history
Make periodic notifications work properly with instant launches
  • Loading branch information
ianmcorvidae authored Sep 27, 2024
2 parents 7838a12 + 78b00ad commit 77e8b40
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/apps/launch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const Launch = ({
);

const preferences = bootstrapInfo?.preferences;
const notify = preferences?.enableAnalysisEmailNotification || false;
const notify = !!preferences?.enableAnalysisEmailNotification;
const notifyPeriodic = !!preferences?.enablePeriodicEmailNotification;
const periodicPeriod = preferences?.periodicNotificationPeriod || 14400;

Expand Down
9 changes: 8 additions & 1 deletion src/components/instantlaunches/InstantLaunchButtonWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import VicePendingRequestDlg from "components/vice/VicePendingRequestDlg";

import constants from "constants.js";
import { useUserProfile } from "contexts/userProfile";
import { useBootstrapInfo } from "contexts/bootstrap";
import ids from "./ids";
import { InstantLaunchSubmissionDialog } from "./index";
import { instantlyLaunch } from "serviceFacades/instantlaunches";
Expand All @@ -38,6 +39,7 @@ function InstantLaunchButtonWrapper(props) {
} = props;
const output_dir = useDefaultOutputDir();
const [userProfile] = useUserProfile();
const [bootstrapInfo] = useBootstrapInfo();

const [open, setOpen] = React.useState(false);
const [signInDlgOpen, setSignInDlgOpen] = React.useState(false);
Expand Down Expand Up @@ -105,7 +107,12 @@ function InstantLaunchButtonWrapper(props) {
showErrorAnnouncer(t("computeLimitExceededMsg"));
} else {
setOpen(true);
launch({ instantLaunch, resource, output_dir });
launch({
instantLaunch,
resource,
output_dir,
preferences: bootstrapInfo?.preferences,
});
}
} else {
setSignInDlgOpen(true);
Expand Down
13 changes: 12 additions & 1 deletion src/serviceFacades/instantlaunches.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ export const deleteInstantLaunchHandler = async (id) => {
* @param {Object} instantLaunch - The instant launch object returned by defaultInstantLaunch().
* @param {Object} resource - An array of resources to use as inputs to the instantly launched app.
*/
export const instantlyLaunch = ({ instantLaunch, resource, output_dir }) => {
export const instantlyLaunch = ({
instantLaunch,
resource,
output_dir,
preferences,
}) => {
let savedLaunchId; // The saved launch ID, used to get app information.
let savedLaunchPromise; // The promise used to get saved launch information.

Expand Down Expand Up @@ -436,6 +441,12 @@ export const instantlyLaunch = ({ instantLaunch, resource, output_dir }) => {
submission.output_dir = output_dir;
return submission;
})
.then((submission) => ({
...submission,
notify: !!preferences?.enableAnalysisEmailNotification,
notify_periodic: !!preferences?.enablePeriodicEmailNotification,
periodic_period: preferences?.periodicNotificationPeriod || 14400,
}))
.then((submission) => submitAnalysis(submission)) // submit the analysis
.then((analysisResp) => getAnalysis(analysisResp.id));
};
Expand Down

0 comments on commit 77e8b40

Please sign in to comment.