Commit 804cfece authored by 吴永生#A02208's avatar 吴永生#A02208

feat: 点击幕布重置

parent 19848612
...@@ -140,11 +140,10 @@ const FileItem = observer((props: IProps) => { ...@@ -140,11 +140,10 @@ const FileItem = observer((props: IProps) => {
<div className={styles.speedBox}> <div className={styles.speedBox}>
<span className={styles.span}>{`${storageUnitFromB( <span className={styles.span}>{`${storageUnitFromB(
itemInfo?.bytesUploaded || 0 itemInfo?.bytesUploaded || 0
)}/${storageUnitFromB(itemInfo?.bytesTotal || 0)}`}</span>{" "} )}/${storageUnitFromB(itemInfo?.bytesTotal || 0)}`}</span>
: {statusMsg !== '上传失败' ? <span className={styles.span}>{`${storageUnitFromB(
<span className={styles.span}>{`${storageUnitFromB(
speed speed
)}/s`}</span> )}/s`}</span> : null}
</div> </div>
)} )}
</div> </div>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56 * @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-28 11:22:47 * @LastEditTime: 2022-06-28 17:19:15
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/index.tsx * @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56 * @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com * @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-06-22 19:53:09 * @LastEditTime: 2022-06-28 16:22:13
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/interface.ts * @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/interface.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -29,6 +29,8 @@ export interface IParameter { ...@@ -29,6 +29,8 @@ export interface IParameter {
helperText?: string; helperText?: string;
} }
export type IExecutionStatus = 'Pending' | 'Running' | 'Done' | 'Failed'
export interface ITask { export interface ITask {
id: string; id: string;
title: string; title: string;
...@@ -42,6 +44,7 @@ export interface ITask { ...@@ -42,6 +44,7 @@ export interface ITask {
parameters: Array<IParameter>; parameters: Array<IParameter>;
edges: Array<IEdge>; edges: Array<IEdge>;
isCheck?: boolean; isCheck?: boolean;
executionStatus?: IExecutionStatus
} }
export interface ITemplateConfig { export interface ITemplateConfig {
......
...@@ -14,7 +14,7 @@ import classNames from "classnames"; ...@@ -14,7 +14,7 @@ import classNames from "classnames";
import jobFail from "@/assets/project/jobFail.svg"; import jobFail from "@/assets/project/jobFail.svg";
import jobRun from "@/assets/project/jobRun.svg"; import jobRun from "@/assets/project/jobRun.svg";
import jobSue from "@/assets/project/jobSue.svg"; import jobSue from "@/assets/project/jobSue.svg";
import { IEdge, ITask } from "../../ProjectSubmitWork/interface"; import { IEdge, IExecutionStatus, ITask } from "../../ProjectSubmitWork/interface";
import { IBatchNode, ILine } from "./interface"; import { IBatchNode, ILine } from "./interface";
import styles from "./index.module.css"; import styles from "./index.module.css";
...@@ -32,6 +32,20 @@ interface IProps extends ReactFlowProps { ...@@ -32,6 +32,20 @@ interface IProps extends ReactFlowProps {
onBatchClick?: (val: string) => void; onBatchClick?: (val: string) => void;
} }
/** 获取imgUrl */
const getImgUrl = (type: IExecutionStatus) => {
if(type === 'Done'){
return jobSue
}
if(type === 'Failed'){
return jobFail
}
if(type === 'Running'){
return jobRun
}
return undefined
}
/** 自定义batch节点 */ /** 自定义batch节点 */
const BatchNode = (props: IBatchNode) => { const BatchNode = (props: IBatchNode) => {
const { data } = props; const { data } = props;
...@@ -89,7 +103,7 @@ const FlowNode = (props: any) => { ...@@ -89,7 +103,7 @@ const FlowNode = (props: any) => {
<div style={{ display: "flex", alignItems: "center" }}> <div style={{ display: "flex", alignItems: "center" }}>
{data?.label || ""} {data?.label || ""}
{data.isCheck && <span className={styles.successDot}></span>} {data.isCheck && <span className={styles.successDot}></span>}
<img style={{ marginLeft: "6px" }} src={jobRun} alt="" /> {getImgUrl(data.executionStatus) && <img style={{ marginLeft: "6px" }} src={getImgUrl(data.executionStatus)} alt="" />}
</div> </div>
{data?.dotStatus?.isOutput ? ( {data?.dotStatus?.isOutput ? (
<Handle <Handle
...@@ -200,6 +214,7 @@ const Flow = (props: IProps) => { ...@@ -200,6 +214,7 @@ const Flow = (props: IProps) => {
selectedStatus: selectedNodeId === item.id, selectedStatus: selectedNodeId === item.id,
} }
: { isCheck: item.isCheck }), : { isCheck: item.isCheck }),
executionStatus: item.executionStatus,
/** 输入输出圆点状态 */ /** 输入输出圆点状态 */
dotStatus: nodesInputAndOutputStatus(item.id), dotStatus: nodesInputAndOutputStatus(item.id),
/** 样式 */ /** 样式 */
...@@ -255,7 +270,7 @@ const Flow = (props: IProps) => { ...@@ -255,7 +270,7 @@ const Flow = (props: IProps) => {
/** flowNode点击事件 */ /** flowNode点击事件 */
const onNodeClick = (e: any, node: Node) => { const onNodeClick = (e: any, node: Node) => {
tasks?.forEach((item) => { tasks?.forEach((item) => {
if (item.id === node.id) { if (item.id === node.id) {
if (item.parentNode) { if (item.parentNode) {
setSelectedNodeId(item.parentNode); setSelectedNodeId(item.parentNode);
onBatchClick && onBatchClick(item.parentNode); onBatchClick && onBatchClick(item.parentNode);
...@@ -267,6 +282,11 @@ const Flow = (props: IProps) => { ...@@ -267,6 +282,11 @@ const Flow = (props: IProps) => {
}); });
}; };
const handlePaneClick = () => {
setSelectedNodeId('');
onBatchClick && onBatchClick('');
}
/** node节点 */ /** node节点 */
const [nodes, setNodes] = useNodesState(initialNodes); const [nodes, setNodes] = useNodesState(initialNodes);
/** 连线数组 */ /** 连线数组 */
...@@ -287,11 +307,12 @@ const Flow = (props: IProps) => { ...@@ -287,11 +307,12 @@ const Flow = (props: IProps) => {
fitView fitView
proOptions={{ hideAttribution: true, account: "" }} proOptions={{ hideAttribution: true, account: "" }}
nodeTypes={nodeTypes} nodeTypes={nodeTypes}
onPaneClick={handlePaneClick}
onNodeClick={onNodeClick} onNodeClick={onNodeClick}
{...props} {...props}
> >
<Controls /> <Controls />
<Background color="#aaa" gap={16} /> <Background color="#aaa" gap={16} />
</ReactFlow> </ReactFlow>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment