diff --git a/optuna_dashboard/ts/components/PreferentialTrials.tsx b/optuna_dashboard/ts/components/PreferentialTrials.tsx
index a5d1e4af..ec597a09 100644
--- a/optuna_dashboard/ts/components/PreferentialTrials.tsx
+++ b/optuna_dashboard/ts/components/PreferentialTrials.tsx
@@ -6,7 +6,7 @@ import {
Card,
CardContent,
CardActions,
- CardActionArea,
+ Button,
MenuItem,
Select,
FormControl,
@@ -31,7 +31,9 @@ const FeedbackContent: FC<{
trial: Trial
artifact?: Artifact
componentId: FeedbackComponentType
-}> = ({ trial, artifact, componentId }) => {
+ width: string
+ minHeight: string
+}> = ({ trial, artifact, componentId, width, minHeight }) => {
if (componentId === "Note") {
return
}
@@ -43,8 +45,8 @@ const FeedbackContent: FC<{
)
}
@@ -96,9 +98,10 @@ const PreferentialTrial: FC<{
}> = ({ trial, studyDetail, hideTrial }) => {
const theme = useTheme()
const action = actionCreator()
- const trialWidth = 500
+ const trialWidth = 400
const trialHeight = 300
const [detailShown, setDetailShown] = useState(false)
+ const [buttonHover, setButtonHover] = useState(false)
const componentId = studyDetail.feedback_component_type ?? "Note"
const artifactKey = studyDetail.feedback_artifact_key
const artifactId = trial?.user_attrs.find((a) => a.key === artifactKey)?.value
@@ -115,6 +118,13 @@ const PreferentialTrial: FC<{
/>
)
}
+ const onFeedback = () => {
+ hideTrial()
+ const best_trials = studyDetail.best_trials
+ .map((t) => t.number)
+ .filter((t) => t !== trial.number)
+ action.updatePreference(trial.study_id, best_trials, [trial.number])
+ }
return (
-
- {
- hideTrial()
- const best_trials = studyDetail.best_trials
- .map((t) => t.number)
- .filter((t) => t !== trial.number)
- action.updatePreference(trial.study_id, best_trials, [trial.number])
- }}
+ {
+ if (e.shiftKey) onFeedback()
+ }}
+ sx={{
+ position: "relative",
+ padding: theme.spacing(2),
+ overflow: "hidden",
+ minHeight: theme.spacing(20),
+ }}
+ >
+
+
+
+
+
+
-
+
+ Worst
+
+
{
@@ -430,7 +443,7 @@ export const PreferentialTrials: FC<{ studyDetail: StudyDetail | null }> = ({
{displayTrials.numbers.map((t, index) => (
trial.number === t)}
studyDetail={studyDetail}
hideTrial={() => {
diff --git a/optuna_dashboard/ts/components/TrialList.tsx b/optuna_dashboard/ts/components/TrialList.tsx
index 3a1fcee6..bb70c119 100644
--- a/optuna_dashboard/ts/components/TrialList.tsx
+++ b/optuna_dashboard/ts/components/TrialList.tsx
@@ -459,13 +459,17 @@ const TrialArtifact: FC<{
artifact: Artifact
width: string
height: string
- buttons_width: number
}> = ({ trial, artifact, width, height }) => {
- const [openDeleteArtifactDialog] = useDeleteArtifactDialog()
+ const [openDeleteArtifactDialog, renderDeleteArtifactDialog] =
+ useDeleteArtifactDialog()
const theme = useTheme()
- const is_3d_model =
+ const is3dModel =
artifact.filename.endsWith(".stl") || artifact.filename.endsWith(".3dm")
- const actions_width = is_3d_model ? theme.spacing(12) : theme.spacing(8)
+ const canDelete = trial.state === "Running" || trial.state === "Waiting"
+ let actionsCount = 1
+ if (canDelete) actionsCount += 1
+ if (is3dModel) actionsCount += 1
+ const actionsWidth = theme.spacing(actionsCount * 4)
return (
@@ -495,29 +499,31 @@ const TrialArtifact: FC<{
p: theme.spacing(0.5, 0),
flexGrow: 1,
wordWrap: "break-word",
- maxWidth: `calc(100% - ${actions_width})`,
+ maxWidth: `calc(100% - ${actionsWidth})`,
}}
>
{artifact.filename}
- {is_3d_model ? (
+ {is3dModel ? (
) : null}
- {
- openDeleteArtifactDialog(trial.study_id, trial.trial_id, artifact)
- }}
- >
-
-
+ {canDelete ? (
+ {
+ openDeleteArtifactDialog(trial.study_id, trial.trial_id, artifact)
+ }}
+ >
+
+
+ ) : null}
+ {renderDeleteArtifactDialog()}
)
}
@@ -536,7 +543,6 @@ const TrialArtifact: FC<{
const TrialArtifacts: FC<{ trial: Trial }> = ({ trial }) => {
const theme = useTheme()
const action = actionCreator()
- const [, renderDeleteArtifactDialog] = useDeleteArtifactDialog()
const [dragOver, setDragOver] = useState(false)
const width = "200px"
@@ -648,7 +654,6 @@ const TrialArtifacts: FC<{ trial: Trial }> = ({ trial }) => {
) : null}
- {renderDeleteArtifactDialog()}
>
)
}