From dbbb59cdfcd3b8fc9de252071f5a2f75d63084e2 Mon Sep 17 00:00:00 2001 From: c-bata Date: Thu, 29 Dec 2022 13:24:17 +0900 Subject: [PATCH] Add Trial List --- .../ts/components/StudyDetailBeta.tsx | 249 +++++++++++------- 1 file changed, 149 insertions(+), 100 deletions(-) diff --git a/optuna_dashboard/ts/components/StudyDetailBeta.tsx b/optuna_dashboard/ts/components/StudyDetailBeta.tsx index 139658aa..51de1519 100644 --- a/optuna_dashboard/ts/components/StudyDetailBeta.tsx +++ b/optuna_dashboard/ts/components/StudyDetailBeta.tsx @@ -1,40 +1,39 @@ import React, { FC, useEffect } from "react" -import { useRecoilValue } from "recoil" +import { useRecoilState, useRecoilValue } from "recoil" import { Link, useParams } from "react-router-dom" +import Drawer from "@mui/material/Drawer" +import Divider from "@mui/material/Divider" +import List from "@mui/material/List" +import ListItem from "@mui/material/ListItem" +import ListItemButton from "@mui/material/ListItemButton" +import ListItemIcon from "@mui/material/ListItemIcon" +import ListItemText from "@mui/material/ListItemText" import { - AppBar, Card, Typography, CardContent, - Container, Toolbar, Box, - IconButton, useTheme, + Switch, } from "@mui/material" -import { Home, Settings } from "@mui/icons-material" -import Brightness4Icon from "@mui/icons-material/Brightness4" +import Cached from "@mui/icons-material/Cached" +import Home from "@mui/icons-material/Home" +import Settings from "@mui/icons-material/Settings" import Brightness7Icon from "@mui/icons-material/Brightness7" +import TableViewIcon from "@mui/icons-material/TableView" +import VisibilityIcon from '@mui/icons-material/Visibility'; -import { GraphParallelCoordinate } from "./GraphParallelCoordinate" -import { GraphHyperparameterImportances } from "./GraphHyperparameterImportances" -import { Edf } from "./GraphEdf" -import { Contour } from "./GraphContour" -import { GraphIntermediateValues } from "./GraphIntermediateValues" -import { GraphSlice } from "./GraphSlice" import { GraphHistory } from "./GraphHistory" -import { GraphParetoFront } from "./GraphParetoFront" import { Note } from "./Note" import { actionCreator } from "../action" import { - graphVisibilityState, reloadIntervalState, studyDetailsState, studySummariesState, } from "../state" import { usePreferenceDialog } from "./PreferenceDialog" -import { ReloadIntervalSelect } from "./ReloadIntervalSelect" -import { TrialTable } from "./TrialTable" +import {Web} from "@mui/icons-material"; interface ParamTypes { studyId: string @@ -59,9 +58,10 @@ export const StudyDetailBeta: FC<{ const studyIdNumber = parseInt(studyId, 10) const studyDetail = useStudyDetailValue(studyIdNumber) const studySummary = useStudySummaryValue(studyIdNumber) - const directions = studyDetail?.directions || studySummary?.directions || null - const graphVisibility = useRecoilValue(graphVisibilityState) - const reloadInterval = useRecoilValue(reloadIntervalState) + const [openPreferenceDialog, renderPreferenceDialog] = + usePreferenceDialog(studyDetail) + const [reloadInterval, updateReloadInterval] = + useRecoilState(reloadIntervalState) useEffect(() => { action.updateStudyDetail(studyIdNumber) @@ -78,100 +78,149 @@ export const StudyDetailBeta: FC<{ }, [reloadInterval, studyDetail]) // TODO(chenghuzi): Reduce the number of calls to setInterval and clearInterval. - const title = studyDetail !== null ? studyDetail.name : `Study #${studyId}` + const title = studyDetail?.name || `Study #${studyId}` const trials: Trial[] = studyDetail !== null ? studyDetail.trials : [] + const drawerWidth = 240 + const trialListWidth = 240 + return ( -
- - - - {APP_BAR_TITLE} - - - + {renderPreferenceDialog()} + + + + + + + + + + + + + + + + + + + + + + + + + + { + updateReloadInterval(reloadInterval === -1 ? 10 : -1) + }} + > + + + + + + + + + { toggleColorMode() }} - color="inherit" - title={ - theme.palette.mode === "dark" - ? "Switch to light mode" - : "Switch to dark mode" - } > - {theme.palette.mode === "dark" ? ( + - ) : ( - - )} - - + + + + + + { openPreferenceDialog(true) }} - title="Open preference panel" > - - - + + + + + + + - - - - - - + + + + + + + + + + { trials.map((trial, i) => { + return ( + + + + + + + State={trial.state} + } + /> + + + ) + })} + + + -
- - {title} - - - - - - - - - - {studyDetail !== null ? ( - - ) : null} -
-
-
+ + + + + + {studyDetail !== null ? ( + + ) : null} + + ) }