mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-11 12:30:25 +08:00
Add table artifact viewer for trial
This commit is contained in:
@@ -55,7 +55,7 @@ export const TableArtifactViewer: React.FC<TableArtifactViewerProps> = (
|
||||
})
|
||||
const keys = Array.from(unionSet)
|
||||
return keys.map((key) => ({
|
||||
header: key,
|
||||
header: key || " ",
|
||||
accessorFn: (info: Data) =>
|
||||
typeof info[key] === "object" ? JSON.stringify(info[key]) : info[key],
|
||||
enableSorting: true,
|
||||
|
||||
@@ -24,6 +24,7 @@ import { Trial } from "ts/types/optuna"
|
||||
import { actionCreator } from "../../action"
|
||||
import { ArtifactCardMedia } from "./ArtifactCardMedia"
|
||||
import { useDeleteTrialArtifactDialog } from "./DeleteArtifactDialog"
|
||||
import { isTableArtifact, useTableArtifactModal } from "./TableArtifactViewer"
|
||||
import {
|
||||
isThreejsArtifact,
|
||||
useThreejsArtifactModal,
|
||||
@@ -35,6 +36,8 @@ export const TrialArtifactCards: FC<{ trial: Trial }> = ({ trial }) => {
|
||||
useDeleteTrialArtifactDialog()
|
||||
const [openThreejsArtifactModal, renderThreejsArtifactModal] =
|
||||
useThreejsArtifactModal()
|
||||
const [openTableArtifactModal, renderTableArtifactModal] =
|
||||
useTableArtifactModal()
|
||||
const isArtifactModifiable = (trial: Trial) => {
|
||||
return trial.state === "Running" || trial.state === "Waiting"
|
||||
}
|
||||
@@ -104,6 +107,19 @@ export const TrialArtifactCards: FC<{ trial: Trial }> = ({ trial }) => {
|
||||
<FullscreenIcon />
|
||||
</IconButton>
|
||||
) : null}
|
||||
{isTableArtifact(artifact) ? (
|
||||
<IconButton
|
||||
aria-label="show artifact table"
|
||||
size="small"
|
||||
color="inherit"
|
||||
sx={{ margin: "auto 0" }}
|
||||
onClick={() => {
|
||||
openTableArtifactModal(urlPath, artifact)
|
||||
}}
|
||||
>
|
||||
<FullscreenIcon />
|
||||
</IconButton>
|
||||
) : null}
|
||||
{isArtifactModifiable(trial) ? (
|
||||
<IconButton
|
||||
aria-label="delete artifact"
|
||||
@@ -141,6 +157,7 @@ export const TrialArtifactCards: FC<{ trial: Trial }> = ({ trial }) => {
|
||||
</Box>
|
||||
{renderDeleteArtifactDialog()}
|
||||
{renderThreejsArtifactModal()}
|
||||
{renderTableArtifactModal()}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user