mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-23 13:30:25 +08:00
Apply prettier
This commit is contained in:
@@ -155,13 +155,16 @@ export const actionCreator = () => {
|
||||
const setTrialUserAttrs = (
|
||||
studyId: number,
|
||||
index: number,
|
||||
user_attrs: { [key: string]: number },
|
||||
user_attrs: { [key: string]: number }
|
||||
) => {
|
||||
const newTrial: Trial = Object.assign(
|
||||
{},
|
||||
studyDetails[studyId].trials[index]
|
||||
)
|
||||
newTrial.user_attrs = Object.keys(user_attrs).map(key => ({ key: key, value: user_attrs[key].toString() }))
|
||||
newTrial.user_attrs = Object.keys(user_attrs).map((key) => ({
|
||||
key: key,
|
||||
value: user_attrs[key].toString(),
|
||||
}))
|
||||
const newTrials: Trial[] = [...studyDetails[studyId].trials]
|
||||
newTrials[index] = newTrial
|
||||
const newStudy: StudyDetail = Object.assign({}, studyDetails[studyId])
|
||||
@@ -529,7 +532,7 @@ export const actionCreator = () => {
|
||||
const saveTrialUserAttrs = (
|
||||
studyId: number,
|
||||
trialId: number,
|
||||
user_attrs: { [key: string]: number },
|
||||
user_attrs: { [key: string]: number }
|
||||
): void => {
|
||||
console.log("user_attrs", user_attrs)
|
||||
const message = `id=${trialId}, user_attrs=${JSON.stringify(user_attrs)}`
|
||||
|
||||
@@ -26,7 +26,7 @@ export const ObjectiveForm: FC<{
|
||||
const theme = useTheme()
|
||||
const action = actionCreator()
|
||||
const [values, setValues] = useState<(number | null)[]>(
|
||||
widgets.map(widget => {
|
||||
widgets.map((widget) => {
|
||||
if (widget === undefined) {
|
||||
return null
|
||||
} else if (widget.type === "text") {
|
||||
@@ -72,7 +72,9 @@ export const ObjectiveForm: FC<{
|
||||
}
|
||||
action.makeTrialComplete(trial.study_id, trial.trial_id, filtered)
|
||||
} else if (outputType == "user_attr") {
|
||||
const user_attrs = Object.fromEntries(widgets.map((widget, i) => [widget.user_attr_key, values[i]]))
|
||||
const user_attrs = Object.fromEntries(
|
||||
widgets.map((widget, i) => [widget.user_attr_key, values[i]])
|
||||
)
|
||||
action.saveTrialUserAttrs(trial.study_id, trial.trial_id, user_attrs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ const TrialListDetail: FC<{
|
||||
directions,
|
||||
objectiveNames,
|
||||
objectiveFormWidgets,
|
||||
formWigetsOutputType
|
||||
formWigetsOutputType,
|
||||
}) => {
|
||||
const theme = useTheme()
|
||||
const artifactEnabled = useRecoilValue<boolean>(artifactIsAvailable)
|
||||
|
||||
Reference in New Issue
Block a user