-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui-study): add button to display display 'digest' file on succes…
…sful tasks in task list (#2101)
- Loading branch information
Showing
3 changed files
with
128 additions
and
33 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.../src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/DigestDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Skeleton } from "@mui/material"; | ||
import OkDialog, { | ||
OkDialogProps, | ||
} from "../../../../../common/dialogs/OkDialog"; | ||
import EditableMatrix from "../../../../../common/EditableMatrix"; | ||
import UsePromiseCond from "../../../../../common/utils/UsePromiseCond"; | ||
import type { LaunchJob } from "../../../../../../common/types"; | ||
import { getStudyData } from "../../../../../../services/api/study"; | ||
import usePromise from "../../../../../../hooks/usePromise"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
interface Props extends Pick<OkDialogProps, "open" | "onOk" | "onClose"> { | ||
studyId: LaunchJob["studyId"]; | ||
outputId: LaunchJob["outputId"]; | ||
} | ||
|
||
function DigestDialog({ studyId, outputId, ...dialogProps }: Props) { | ||
const { t } = useTranslation(); | ||
|
||
const synthesisRes = usePromise( | ||
() => | ||
getStudyData(studyId, `output/${outputId}/economy/mc-all/grid/digest`), | ||
{ | ||
deps: [studyId, outputId], | ||
}, | ||
); | ||
|
||
return ( | ||
<OkDialog | ||
{...dialogProps} | ||
title="Digest" | ||
okButtonText={t("global.close")} | ||
fullScreen | ||
sx={{ m: 5 }} | ||
> | ||
<UsePromiseCond | ||
response={synthesisRes} | ||
ifPending={() => <Skeleton sx={{ height: 1, transform: "none" }} />} | ||
ifResolved={(matrix) => | ||
matrix && ( | ||
<EditableMatrix | ||
matrix={matrix} | ||
columnsNames={matrix.columns} | ||
matrixTime={false} | ||
readOnly | ||
/> | ||
) | ||
} | ||
/> | ||
</OkDialog> | ||
); | ||
} | ||
|
||
export default DigestDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters