diff --git a/optuna_dashboard/ts/components/StudyDetail.tsx b/optuna_dashboard/ts/components/StudyDetail.tsx index ae37f699..b71d8591 100644 --- a/optuna_dashboard/ts/components/StudyDetail.tsx +++ b/optuna_dashboard/ts/components/StudyDetail.tsx @@ -232,7 +232,7 @@ export const StudyDetail: FC<{ ) : null} - + {studyDetail !== null ? ( diff --git a/optuna_dashboard/ts/components/StudyDetailBeta.tsx b/optuna_dashboard/ts/components/StudyDetailBeta.tsx index 75a2eedd..f9b5ea93 100644 --- a/optuna_dashboard/ts/components/StudyDetailBeta.tsx +++ b/optuna_dashboard/ts/components/StudyDetailBeta.tsx @@ -189,7 +189,11 @@ export const StudyDetailBeta: FC<{ content = ( - + ) diff --git a/optuna_dashboard/ts/components/TrialTable.tsx b/optuna_dashboard/ts/components/TrialTable.tsx index b936ee71..ba271bf1 100644 --- a/optuna_dashboard/ts/components/TrialTable.tsx +++ b/optuna_dashboard/ts/components/TrialTable.tsx @@ -1,12 +1,15 @@ import React, { FC } from "react" -import { Typography, Grid, Box } from "@mui/material" +import { Typography, Grid, Box, IconButton } from "@mui/material" +import LinkIcon from "@mui/icons-material/Link" import { DataGridColumn, DataGrid } from "./DataGrid" +import { Link } from "react-router-dom" export const TrialTable: FC<{ studyDetail: StudyDetail | null + isBeta: boolean initialRowsPerPage?: number -}> = ({ studyDetail, initialRowsPerPage }) => { +}> = ({ studyDetail, isBeta, initialRowsPerPage }) => { const trials: Trial[] = studyDetail !== null ? studyDetail.trials : [] const objectiveNames: string[] = studyDetail?.objective_names || [] @@ -89,46 +92,48 @@ export const TrialTable: FC<{ })) columns.push(...objectiveColumns) } - columns.push({ - field: "datetime_start", - label: "Duration(ms)", - toCellValue: (i) => { - const startMs = trials[i].datetime_start?.getTime() - const completeMs = trials[i].datetime_complete?.getTime() - if (startMs !== undefined && completeMs !== undefined) { - return (completeMs - startMs).toString() - } - return null - }, - sortable: true, - less: (firstEl, secondEl): number => { - const firstStartMs = firstEl.datetime_start?.getTime() - const firstCompleteMs = firstEl.datetime_complete?.getTime() - const firstDurationMs = - firstStartMs !== undefined && firstCompleteMs !== undefined - ? firstCompleteMs - firstStartMs - : undefined - const secondStartMs = secondEl.datetime_start?.getTime() - const secondCompleteMs = secondEl.datetime_complete?.getTime() - const secondDurationMs = - secondStartMs !== undefined && secondCompleteMs !== undefined - ? secondCompleteMs - secondStartMs - : undefined + if (!isBeta) { + columns.push({ + field: "datetime_start", + label: "Duration(ms)", + toCellValue: (i) => { + const startMs = trials[i].datetime_start?.getTime() + const completeMs = trials[i].datetime_complete?.getTime() + if (startMs !== undefined && completeMs !== undefined) { + return (completeMs - startMs).toString() + } + return null + }, + sortable: true, + less: (firstEl, secondEl): number => { + const firstStartMs = firstEl.datetime_start?.getTime() + const firstCompleteMs = firstEl.datetime_complete?.getTime() + const firstDurationMs = + firstStartMs !== undefined && firstCompleteMs !== undefined + ? firstCompleteMs - firstStartMs + : undefined + const secondStartMs = secondEl.datetime_start?.getTime() + const secondCompleteMs = secondEl.datetime_complete?.getTime() + const secondDurationMs = + secondStartMs !== undefined && secondCompleteMs !== undefined + ? secondCompleteMs - secondStartMs + : undefined - if (firstDurationMs === secondDurationMs) { - return 0 - } else if ( - firstDurationMs !== undefined && - secondDurationMs !== undefined - ) { - return firstDurationMs < secondDurationMs ? 1 : -1 - } else if (firstDurationMs !== undefined) { - return -1 - } else { - return 1 - } - }, - }) + if (firstDurationMs === secondDurationMs) { + return 0 + } else if ( + firstDurationMs !== undefined && + secondDurationMs !== undefined + ) { + return firstDurationMs < secondDurationMs ? 1 : -1 + } else if (firstDurationMs !== undefined) { + return -1 + } else { + return 1 + } + }, + }) + } if ( studyDetail?.union_search_space.length === studyDetail?.intersection_search_space.length @@ -199,6 +204,26 @@ export const TrialTable: FC<{ }, }) }) + if (isBeta) { + columns.push({ + field: "trial_id", + label: "Detail", + toCellValue: (i) => ( + + + + ), + }) + } const collapseIntermediateValueColumns: DataGridColumn[] = [ @@ -273,7 +298,7 @@ export const TrialTable: FC<{ rows={trials} keyField={"trial_id"} dense={true} - collapseBody={collapseBody} + collapseBody={isBeta ? undefined : collapseBody} initialRowsPerPage={initialRowsPerPage} /> ) diff --git a/typescript_tests/TrialTable.test.tsx b/typescript_tests/TrialTable.test.tsx index 6a38f9e8..c443df13 100644 --- a/typescript_tests/TrialTable.test.tsx +++ b/typescript_tests/TrialTable.test.tsx @@ -91,7 +91,7 @@ const studyDetail: StudyDetail = { it("Sort TrialTable by trial number", () => { const { getAllByRole, getByText } = render( - + ) const rows = getAllByRole("row") @@ -107,7 +107,7 @@ it("Sort TrialTable by trial number", () => { it("Sort TrialTable by value", () => { const { getAllByRole, getByText } = render( - + ) fireEvent.click(getByText("Value")) const rows = getAllByRole("row") @@ -122,7 +122,7 @@ it("Sort TrialTable by value", () => { it("Sort TrialTable by duration", () => { const { getAllByRole, getByText } = render( - + ) fireEvent.click(getByText("Duration(ms)")) const rows = getAllByRole("row") @@ -137,7 +137,7 @@ it("Sort TrialTable by duration", () => { it("Sort TrialTable by state", () => { const { getAllByRole, getByText } = render( - + ) fireEvent.click(getByText("State")) const rows = getAllByRole("row") @@ -151,7 +151,9 @@ it("Sort TrialTable by state", () => { }) it("Filter trials by state", () => { - const { queryAllByText } = render() + const { queryAllByText } = render( + + ) expect(queryAllByText("Fail").length).toBe(1) // Click 'Complete' state