Commit 1002e59b authored by chenshouchao's avatar chenshouchao

feat: 任务详情下载功能

parent 5edcaf48
......@@ -93,6 +93,10 @@
position: relative;
align-items: center;
}
.taskInfoDownload {
color: rgba(19, 112, 255, 1);
cursor: pointer;
}
.taskInfoValueShowAll {
white-space: normal;
}
......
......@@ -17,13 +17,16 @@ import { IResponse } from "@/api/http";
import jobSue from "@/assets/project/jobSue.svg";
import jobStop from "@/assets/project/jobStop.svg";
import jobRun from "@/assets/project/jobRun.svg";
import CloudEController from "@/api/fileserver/CloudEController";
import jobFail from "@/assets/project/jobFail.svg";
import classNames from "classnames";
import { useStores } from "@/store";
import { toJS } from "mobx";
import { observer } from "mobx-react-lite";
import classNames from "classnames";
import styles from "./index.module.css";
import { ITaskInfo } from "../ProjectSubmitWork/interface";
import Flow from "../components/Flow";
import { style } from "@mui/system";
const stateMap = {
RUNNING: "正在运行",
......@@ -41,7 +44,10 @@ const statusMap = {
type IStatus = "Done" | "Running" | "Failed" | "Pending";
const ProjectSubmitWork = () => {
const ProjectSubmitWork = observer(() => {
const { currentProjectStore } = useStores();
const fileToken = toJS(currentProjectStore.currentProjectInfo.filetoken);
const projectId = toJS(currentProjectStore.currentProjectInfo.id);
const [workFlowJobInfo, setWorkFlowJobInfo] = useState<ITaskInfo>();
const [patchInfo, setPatchInfo] = useState<any>();
const [activePatchId, setActivePatchId] = useState<string>("");
......@@ -101,6 +107,17 @@ const ProjectSubmitWork = () => {
setShowOptions(!showOptions);
};
const handleDownLoad = (path: string) => {
if (path.indexOf("/home/cloudam") !== -1) {
path = path.slice(13);
}
CloudEController.JobFileDownload(
path,
fileToken as string,
projectId as string
);
};
return (
<div className={styles.swBox}>
<div className={styles.swHeader}>
......@@ -238,7 +255,15 @@ const ProjectSubmitWork = () => {
<div className={styles.taskInfoLi}>
<div className={styles.taskInfoParams}>日志文件</div>
<div className={styles.taskInfoValue}>
{workFlowJobInfo?.logPath}
{workFlowJobInfo?.logPath && (
<span
className={styles.taskInfoDownload}
onClick={() => handleDownLoad(workFlowJobInfo?.logPath)}
>
下载
</span>
)}
{!workFlowJobInfo?.logPath && "-"}
</div>
</div>
</div>
......@@ -357,6 +382,6 @@ const ProjectSubmitWork = () => {
</div>
</div>
);
};
});
export default ProjectSubmitWork;
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