diff --git a/optuna_dashboard/ts/components/TrialList.tsx b/optuna_dashboard/ts/components/TrialList.tsx index e117f8da..5611000c 100644 --- a/optuna_dashboard/ts/components/TrialList.tsx +++ b/optuna_dashboard/ts/components/TrialList.tsx @@ -6,6 +6,9 @@ import { IconButton, Menu, MenuItem, + Card, + CardContent, + CardMedia, } from "@mui/material" import Chip from "@mui/material/Chip" import Divider from "@mui/material/Divider" @@ -21,6 +24,8 @@ import CheckBoxIcon from "@mui/icons-material/CheckBox" import { TrialNote } from "./Note" import { useHistory, useLocation } from "react-router-dom" import ListItemIcon from "@mui/material/ListItemIcon" +import { useRecoilValue } from "recoil" +import { artifactIsAvailable } from "../state" const states: TrialState[] = [ "Complete", @@ -120,10 +125,12 @@ const useIsBestTrial = ( } const TrialListDetail: FC<{ + studyId: number trial: Trial isBestTrial: (trialId: number) => boolean -}> = ({ trial, isBestTrial }) => { +}> = ({ studyId, trial, isBestTrial }) => { const theme = useTheme() + const artifactEnabled = useRecoilValue(artifactIsAvailable) const startMs = trial.datetime_start?.getTime() const completeMs = trial.datetime_complete?.getTime() let duration = "" @@ -250,6 +257,66 @@ const TrialListDetail: FC<{ latestNote={trial.note} cardSx={{ marginBottom: theme.spacing(2) }} /> + {artifactEnabled && ( + <> + + Artifacts + + + {trial.artifacts.map((a) => { + if (a.mimetype.startsWith("image")) { + return ( + + + + {a.filename} + + + ) + } else { + return ( + + + {a.filename} + + + ) + } + })} + + + Upload a new artifact + + + + + )} ) } @@ -440,11 +507,12 @@ export const TrialList: FC<{ studyDetail: StudyDetail | null }> = ({ }} > - {showDetailTrials.length === 0 + {studyDetail === null || showDetailTrials.length === 0 ? null : showDetailTrials.map((t) => (