mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-10-04 12:50:44 +08:00
Follow review comments
This commit is contained in:
1 parent
798a433029
commit
cf16cd8507
3 files changed
+28
-21
No files matched your search
@@ -289,7 +289,7 @@ export const actionCreator = () => {
|
||||
studyId: number,
|
||||
trialId: number,
|
||||
state: TrialStateFinished,
|
||||
values?: string[]
|
||||
values?: number[]
|
||||
): Promise<void> => {
|
||||
const message =
|
||||
values === undefined
|
||||
|
||||
@@ -221,9 +221,9 @@ export const tellTrialAPI = (
|
||||
studyId: number,
|
||||
trialId: number,
|
||||
state: TrialStateFinished,
|
||||
values?: string[]
|
||||
values?: number[]
|
||||
): Promise<void> => {
|
||||
const req: { state: TrialState; values?: string[] } = {
|
||||
const req: { state: TrialState; values?: number[] } = {
|
||||
state: state,
|
||||
values: values,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import React, {ChangeEvent, createRef, FC, FormEvent, MouseEvent, useState} from "react"
|
||||
import React, {
|
||||
ChangeEvent,
|
||||
createRef,
|
||||
FC,
|
||||
FormEvent,
|
||||
MouseEvent,
|
||||
useState,
|
||||
} from "react"
|
||||
import {
|
||||
Typography,
|
||||
Grid,
|
||||
@@ -274,7 +281,9 @@ export const TrialTable: FC<{
|
||||
]
|
||||
|
||||
const collapseBody = (index: number) => {
|
||||
const objectiveFormRefs = studyDetail?.directions.map(d => createRef<HTMLInputElement>())
|
||||
const objectiveFormRefs = studyDetail?.directions.map((d) =>
|
||||
createRef<HTMLInputElement>()
|
||||
)
|
||||
const handleSubmit = (e: FormEvent<HTMLFormElement>): void => {
|
||||
if (objectiveFormRefs === undefined) {
|
||||
return
|
||||
@@ -283,14 +292,11 @@ export const TrialTable: FC<{
|
||||
e.preventDefault()
|
||||
const studyId = (studyDetail as StudyDetail).id
|
||||
const trialId = trials[index].number
|
||||
const objectiveValues = objectiveFormRefs.map(ref => ref.current ? ref.current.value : "")
|
||||
console.dir(objectiveValues)
|
||||
action.tellTrial(
|
||||
studyId,
|
||||
trialId,
|
||||
"Complete",
|
||||
objectiveValues
|
||||
const objectiveValues = objectiveFormRefs.map((ref) =>
|
||||
ref.current ? ref.current.value : ""
|
||||
)
|
||||
console.dir(objectiveValues)
|
||||
action.tellTrial(studyId, trialId, "Complete", objectiveValues)
|
||||
}
|
||||
const handleFailTrial = (e: MouseEvent<HTMLButtonElement>): void => {
|
||||
const studyId = (studyDetail as StudyDetail).id
|
||||
@@ -337,15 +343,16 @@ export const TrialTable: FC<{
|
||||
<form onSubmit={handleSubmit}>
|
||||
<Box margin={1}>
|
||||
<Stack direction="row" spacing={1}>
|
||||
{objectiveFormRefs !== undefined && objectiveFormRefs.map((ref, i) => (
|
||||
<TextField
|
||||
id={`objective-${i}`}
|
||||
key={`objective-${i}`}
|
||||
label={`Objective ${i}`}
|
||||
type="number"
|
||||
inputRef={ref}
|
||||
/>
|
||||
))}
|
||||
{objectiveFormRefs !== undefined &&
|
||||
objectiveFormRefs.map((ref, i) => (
|
||||
<TextField
|
||||
id={`objective-${i}`}
|
||||
key={`objective-${i}`}
|
||||
label={`Objective ${i}`}
|
||||
type="number"
|
||||
inputRef={ref}
|
||||
/>
|
||||
))}
|
||||
</Stack>
|
||||
</Box>
|
||||
<Box margin={1}>
|
||||
|
||||
Reference in new issue
Block a user