-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from visualDust/dev
better stability
- Loading branch information
Showing
67 changed files
with
996 additions
and
762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
frontend/src/components/dashboard/project/hardware/graphWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { PropsWithChildren, memo } from "react"; | ||
import { JsonPopover } from "../jsonView"; | ||
|
||
export const GraphWrapper = memo( | ||
({ title, lastValue, children }: PropsWithChildren<{ title: string; lastValue: any }>) => { | ||
return ( | ||
<div style={{ position: "relative" }}> | ||
{children} | ||
<JsonPopover | ||
title={title} | ||
value={lastValue} | ||
position="right" | ||
style={{ position: "absolute", left: 5, top: 3 }} | ||
/> | ||
</div> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { memo } from "react"; | ||
import { Popover, Space, Typography } from "@douyinfe/semi-ui"; | ||
import { IconInfoCircle } from "@douyinfe/semi-icons"; | ||
import { useProjectRunStatus } from "../../../hooks/useProject"; | ||
import Loading from "../../loading"; | ||
import { JsonViewThemed } from "./jsonView"; | ||
|
||
export const HyperParams = memo(({ projectId, runId, trigger = "click", position }: any) => { | ||
return ( | ||
<Popover | ||
showArrow | ||
trigger={trigger} | ||
position={position} | ||
content={<HyperParamsContent projectId={projectId} runId={runId} />} | ||
> | ||
<IconInfoCircle /> | ||
</Popover> | ||
); | ||
}); | ||
|
||
const HyperParamsContent = memo(({ projectId, runId }: any) => { | ||
const runStatus = useProjectRunStatus(projectId, runId); | ||
const value = runStatus?.hyperparameters; | ||
return ( | ||
<Space vertical> | ||
<Typography.Text type="primary">Hyperparameter</Typography.Text> | ||
{!runStatus ? ( | ||
<Loading /> | ||
) : value == null ? ( | ||
<Typography.Text type="tertiary">N/A</Typography.Text> | ||
) : ( | ||
<JsonViewThemed | ||
style={{ minWidth: 200, width: 400, maxHeight: "70vh", overflow: "auto" }} | ||
value={value} | ||
displayDataTypes={false} | ||
/> | ||
)} | ||
</Space> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.w-json-view-container { | ||
padding-left: 1em; | ||
} | ||
|
||
span[style="display: inline-flex; align-items: center;"] { | ||
/* position: absolute; */ | ||
transform: translate(-1em, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import JsonView from "@uiw/react-json-view"; | ||
// eslint-disable-next-line import/no-unresolved | ||
import { githubDarkTheme } from "@uiw/react-json-view/githubDark"; | ||
import { CSSProperties, memo } from "react"; | ||
import { Popover, Space, Typography } from "@douyinfe/semi-ui"; | ||
import { IconCode, IconCodeStroked } from "@douyinfe/semi-icons"; | ||
import { Position } from "@douyinfe/semi-ui/lib/es/tooltip"; | ||
import { useTheme } from "../../../hooks/useTheme"; | ||
import "./jsonView.css"; | ||
|
||
export const JsonViewThemed = memo((props: any) => { | ||
const { darkMode } = useTheme(); | ||
return ( | ||
<JsonView | ||
displayDataTypes={false} | ||
{...props} | ||
style={{ | ||
minWidth: 200, | ||
width: 400, | ||
maxHeight: "60vh", | ||
overflow: "auto", | ||
...props?.style, | ||
...(darkMode ? githubDarkTheme : null), | ||
background: "transparent", | ||
}} | ||
/> | ||
); | ||
}); | ||
|
||
export const JsonPopover = memo( | ||
({ | ||
value, | ||
title, | ||
position, | ||
style, | ||
}: { | ||
value: any; | ||
title?: string; | ||
position?: Position; | ||
style?: CSSProperties; | ||
}) => { | ||
return ( | ||
<Popover | ||
showArrow | ||
position={position} | ||
content={ | ||
<Space vertical> | ||
{title && <Typography.Text>{title}</Typography.Text>} | ||
<JsonViewThemed value={value} /> | ||
</Space> | ||
} | ||
> | ||
<IconCodeStroked style={{ color: "var(--semi-color-tertiary)", ...style }} /> | ||
</Popover> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.