Commit acf7cc2e authored by chenshouchao's avatar chenshouchao

feat: 任务详情 结果文件下载, 结果数据加查看

parent f786fccf
...@@ -159,7 +159,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => { ...@@ -159,7 +159,7 @@ const SeeDataset = observer((props: ISeeDatasetProps) => {
}; };
return ( return (
<FullScreenDrawer handleClose={props.handleClose}> <FullScreenDrawer handleClose={props.handleClose} zIndex={1100}>
<div <div
className={classNames({ className={classNames({
[style.datasetBox]: true, [style.datasetBox]: true,
......
...@@ -34,6 +34,7 @@ import Flow from "../components/Flow"; ...@@ -34,6 +34,7 @@ import Flow from "../components/Flow";
import { cancelWorkflowJob, deleteWorkflowJob } from "@/api/workbench_api"; import { cancelWorkflowJob, deleteWorkflowJob } from "@/api/workbench_api";
import { useMessage } from "@/components/MySnackbar"; import { useMessage } from "@/components/MySnackbar";
import MyPopconfirm from "@/components/mui/MyPopconfirm"; import MyPopconfirm from "@/components/mui/MyPopconfirm";
import SeeDataset from "../ProjectData/SeeDataset";
import { storageUnitFromB } from "@/utils/util"; import { storageUnitFromB } from "@/utils/util";
import styles from "./index.module.css"; import styles from "./index.module.css";
...@@ -72,8 +73,13 @@ const ProjectSubmitWork = observer(() => { ...@@ -72,8 +73,13 @@ const ProjectSubmitWork = observer(() => {
const message = useMessage(); const message = useMessage();
const isPass = usePass(); const isPass = usePass();
const [fullScreenShow, setFullScreenShow] = useState<boolean>(false); const [fullScreenShow, setFullScreenShow] = useState<boolean>(false);
const { name, state } = workFlowJobInfo || {}; const { name, state } = workFlowJobInfo || {};
// 查看数据集(数据集详情)显示控制
const [showSeeDataset, setShowSeeDataset] = useState(false);
// 查看的数据集的数据集名称
const [seeDatasetName, setSeeDatasetName] = useState("");
// 查看的数据集的数据集路径
const [seeDatasetPath, setSeeDatasetPath] = useState("");
/** 获取模版数据 */ /** 获取模版数据 */
const { run } = useMyRequest(fetchWorkFlowJob, { const { run } = useMyRequest(fetchWorkFlowJob, {
...@@ -113,12 +119,49 @@ const ProjectSubmitWork = observer(() => { ...@@ -113,12 +119,49 @@ const ProjectSubmitWork = observer(() => {
}; };
// 通过文件路径获取文件所在文件夹路径 如 输入 /ProjectData/task_a.out 输出/ProjectData/ // 通过文件路径获取文件所在文件夹路径 如 输入 /ProjectData/task_a.out 输出/ProjectData/
const getFolderPath = (path: string) => { // const getFolderPath = (path: string) => {
const lastIndex = path.lastIndexOf("/"); // const lastIndex = path.lastIndexOf("/");
if (lastIndex !== -1) { // if (lastIndex !== -1) {
path = path.slice(0, lastIndex); // path = path.slice(0, lastIndex);
// }
// return path;
// };
// 下载任务结果
const handleDownLoadOutput = (item: any) => {
console.log(item);
// 是文件下载
if (item.type !== "dataset") {
CloudEController.JobFileDownload(
item.path.slice(12),
fileToken as string,
projectId as string
);
} else {
// 是数据集 查看数据集
const noProjectPath = item.path.slice(12);
const fileIndex = noProjectPath.indexOf("/.dataset");
let datasetPath = "";
if (fileIndex !== -1) {
datasetPath = noProjectPath.slice(0, fileIndex);
} else {
datasetPath = noProjectPath;
}
let name = "";
let nameIndex = item.path.indexOf("/.dataset/") + 10;
const lastIndex = item.path.lastIndexOf("/");
if (nameIndex !== -1 && lastIndex !== -1) {
name = item.path.slice(nameIndex, lastIndex);
} else {
name = item.name;
}
setSeeDatasetPath(datasetPath ? datasetPath : "/");
setSeeDatasetName(name);
setShowSeeDataset(true);
} }
return path;
}; };
/** 返回事件 */ /** 返回事件 */
...@@ -386,7 +429,8 @@ const ProjectSubmitWork = observer(() => { ...@@ -386,7 +429,8 @@ const ProjectSubmitWork = observer(() => {
<div <div
className={styles.outputLiLeft} className={styles.outputLiLeft}
onClick={(e: any) => { onClick={(e: any) => {
goToProjectData(getFolderPath(item.path)); handleDownLoadOutput(item);
// goToProjectData(getFolderPath(item.path));
}} }}
> >
<img <img
...@@ -442,7 +486,6 @@ const ProjectSubmitWork = observer(() => { ...@@ -442,7 +486,6 @@ const ProjectSubmitWork = observer(() => {
setGoToProjectDataPath( setGoToProjectDataPath(
workFlowJobInfo?.outputPath as string workFlowJobInfo?.outputPath as string
); );
// goToProjectData(workFlowJobInfo?.outputPath as string)
}} }}
> >
{workFlowJobInfo?.outputPath || "-"} {workFlowJobInfo?.outputPath || "-"}
...@@ -666,6 +709,15 @@ const ProjectSubmitWork = observer(() => { ...@@ -666,6 +709,15 @@ const ProjectSubmitWork = observer(() => {
onCancel={handleCancel} onCancel={handleCancel}
onConfirm={handleConfirm} onConfirm={handleConfirm}
/> />
{showSeeDataset && (
<SeeDataset
handleClose={() => setShowSeeDataset(false)}
name={seeDatasetName}
path={seeDatasetPath}
fileToken={fileToken as string}
projectId={projectId as string}
></SeeDataset>
)}
</div> </div>
); );
}); });
......
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