From 1861349dfb8c7c0925cbc5c718cb57a1a408034d Mon Sep 17 00:00:00 2001 From: moririn2528 Date: Fri, 15 Sep 2023 19:24:35 +0900 Subject: [PATCH] change setting modal --- optuna_dashboard/_app.py | 2 +- .../ts/components/PreferentialTrials.tsx | 146 +++++++++--------- 2 files changed, 78 insertions(+), 70 deletions(-) diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index d14ada3d..eaab1ba6 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -320,7 +320,7 @@ def create_app( @json_api_view def put_preference_feedback_component(study_id: int) -> dict[str, Any]: try: - component_type = request.json.get("type", "") + component_type = request.json.get("output_type", "") artifact_key = request.json.get("artifact_key", None) except ValueError: response.status = 400 diff --git a/optuna_dashboard/ts/components/PreferentialTrials.tsx b/optuna_dashboard/ts/components/PreferentialTrials.tsx index a75455f4..120c317b 100644 --- a/optuna_dashboard/ts/components/PreferentialTrials.tsx +++ b/optuna_dashboard/ts/components/PreferentialTrials.tsx @@ -13,6 +13,10 @@ import { FormLabel, Modal, CircularProgress, + Dialog, + DialogTitle, + DialogContent, + DialogActions, } from "@mui/material" import IconButton from "@mui/material/IconButton" import OpenInFullIcon from "@mui/icons-material/OpenInFull" @@ -31,49 +35,11 @@ import { import { ArtifactCardMedia } from "./ArtifactCardMedia" import { MarkdownRenderer } from "./Note" -const ModalPage: FC<{ - children: React.ReactNode - displayFlag: boolean - onClose: () => void -}> = ({ children, displayFlag, onClose }) => { - const theme = useTheme() - return ( - - - - {children} - - - - ) -} - const SettingsPage: FC<{ studyDetail: StudyDetail settingShown: boolean setSettingShown: (flag: boolean) => void }> = ({ studyDetail, settingShown, setSettingShown }) => { - const theme = useTheme() const actions = actionCreator() const [outputComponentType, setOutputComponentType] = useState( studyDetail.feedback_component_type.output_type @@ -97,6 +63,9 @@ const SettingsPage: FC<{ ]) const onClose = () => { setSettingShown(false) + } + const onApply = () => { + setSettingShown(false) const outputComponent: FeedbackComponentType = outputComponentType === "note" ? ({ output_type: "note" } as FeedbackComponentNote) @@ -108,19 +77,15 @@ const SettingsPage: FC<{ } return ( - - + Settings + - Settings - - { @@ -168,8 +133,22 @@ const SettingsPage: FC<{ ) : null} - - + + + + + + ) } @@ -571,22 +550,51 @@ export const PreferentialTrials: FC<{ studyDetail: StudyDetail | null }> = ({ studyDetail={studyDetail} /> {detailTrial !== null && ( - { - setDetailTrial(null) - }} - > - - studyDetail.trials.find((t) => t.trial_id === trialId)?.state === - "Complete" ?? false - } - directions={[]} - objectiveNames={[]} - /> - + setDetailTrial(null)}> + + + + + + + studyDetail.trials.find((t) => t.trial_id === trialId) + ?.state === "Complete" ?? false + } + directions={[]} + objectiveNames={[]} + /> + + + )} {renderThreejsArtifactModal()}