Commit b04111bc authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20220705-customTemplate' into 'release'

cn-fix: 新增模板勾选、文件路径修改

See merge request !94
parents f69316a2 d4fb15ff
...@@ -78,7 +78,7 @@ const UseTusUpload = (uploadInfoStore: any) => { ...@@ -78,7 +78,7 @@ const UseTusUpload = (uploadInfoStore: any) => {
id: timeId, id: timeId,
statusMsg: "正在上传", statusMsg: "正在上传",
upload, upload,
dir: "/home/cloudam/", dir: "/ProjectData/",
}; };
uploadInfoStore?.setUploadInfo(item.id, { uploadInfoStore?.setUploadInfo(item.id, {
...item, ...item,
......
...@@ -64,7 +64,7 @@ const ConsoleLayout = observer(() => { ...@@ -64,7 +64,7 @@ const ConsoleLayout = observer(() => {
currentProjectStore.changeProductInfo({ id: item.id, name: item.name }); currentProjectStore.changeProductInfo({ id: item.id, name: item.name });
setCurrentProduct(item); setCurrentProduct(item);
runGetProjectList({ runGetProjectList({
product: item.name, product: item.id,
}); });
}; };
......
...@@ -98,7 +98,7 @@ const ProjectSubmitWork = observer(() => { ...@@ -98,7 +98,7 @@ const ProjectSubmitWork = observer(() => {
// 前往数据管理页面 // 前往数据管理页面
const goToProjectData = (path: string) => { const goToProjectData = (path: string) => {
path = path.slice(13); path = path.slice(12);
if (path) { if (path) {
navigate(`/product/cadd/projectData`, { navigate(`/product/cadd/projectData`, {
state: { pathName: path }, state: { pathName: path },
...@@ -110,7 +110,7 @@ const ProjectSubmitWork = observer(() => { ...@@ -110,7 +110,7 @@ const ProjectSubmitWork = observer(() => {
} }
}; };
// 通过文件路径获取文件所在文件夹路径 如 输入 /home/cloudam/task_a.out 输出/home/cloudam/ // 通过文件路径获取文件所在文件夹路径 如 输入 /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) {
...@@ -127,8 +127,8 @@ const ProjectSubmitWork = observer(() => { ...@@ -127,8 +127,8 @@ const ProjectSubmitWork = observer(() => {
}, [navigate]); }, [navigate]);
const outputPathTransform = (path: string) => { const outputPathTransform = (path: string) => {
path = path.slice(13); path = path.slice(1);
return `ProjectData${path}`; return path;
}; };
const getOutouts = (outputs: any) => { const getOutouts = (outputs: any) => {
...@@ -259,8 +259,8 @@ const ProjectSubmitWork = observer(() => { ...@@ -259,8 +259,8 @@ const ProjectSubmitWork = observer(() => {
}; };
const handleDownLoad = (path: string) => { const handleDownLoad = (path: string) => {
if (path.indexOf("/home/cloudam") !== -1) { if (path.indexOf("/ProjectData") !== -1) {
path = path.slice(13); path = path.slice(12);
} }
CloudEController.JobFileDownload( CloudEController.JobFileDownload(
path, path,
......
...@@ -182,11 +182,7 @@ const ProjectSubmitWork = () => { ...@@ -182,11 +182,7 @@ const ProjectSubmitWork = () => {
parameter.domType.toLowerCase() === "dataset" || parameter.domType.toLowerCase() === "dataset" ||
parameter.domType.toLowerCase() === "file" parameter.domType.toLowerCase() === "file"
) { ) {
if (value === "ProjectData") { value = `/${value}`;
value = "/home/cloudam";
} else {
value = `/home/cloudam${value.slice(11)}`;
}
} }
promotedParameters[parameter.name] = { promotedParameters[parameter.name] = {
[parameter.classTypeName]: value, [parameter.classTypeName]: value,
...@@ -195,10 +191,7 @@ const ProjectSubmitWork = () => { ...@@ -195,10 +191,7 @@ const ProjectSubmitWork = () => {
}); });
submitWorkFlowRun({ submitWorkFlowRun({
name, name,
outputPath: outputPath: `/${outputPath}`,
outputPath === "ProjectData"
? "/home/cloudam"
: `/home/cloudam${outputPath.slice(11)}`,
projectId: projectId as string, projectId: projectId as string,
specId: templateConfigInfo?.id as string, specId: templateConfigInfo?.id as string,
promotedParameters, promotedParameters,
......
...@@ -16,11 +16,15 @@ import _ from "lodash"; ...@@ -16,11 +16,15 @@ import _ from "lodash";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import noData from "../../../../../../assets/project/noTemplate.svg"; import noData from "../../../../../../assets/project/noTemplate.svg";
import { ICustomTemplate } from "../../interface"; import { ICustomTemplate } from "../../interface";
import { getAddWorkbenchTemplate } from "@/api/workbench_api"; import {
getAddWorkbenchTemplate,
addWorkbenchTemplate,
} from "@/api/workbench_api";
import { toJS } from "mobx"; import { toJS } from "mobx";
type IAddTemplateProps = { type IAddTemplateProps = {
setShowAddTemplate: any; setShowAddTemplate: any;
getTemplateInfo: any;
}; };
const radioOptions = [ const radioOptions = [
...@@ -38,7 +42,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => { ...@@ -38,7 +42,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const projectId = toJS(currentProjectStore.currentProjectInfo.id); const projectId = toJS(currentProjectStore.currentProjectInfo.id);
const productId = toJS(currentProjectStore.currentProductInfo.id); const productId = toJS(currentProjectStore.currentProductInfo.id);
const { setShowAddTemplate } = props; const { setShowAddTemplate, getTemplateInfo } = props;
const handleSearch = (value: string) => { const handleSearch = (value: string) => {
console.log(value); console.log(value);
...@@ -56,8 +60,34 @@ const AddTemplate = observer((props: IAddTemplateProps) => { ...@@ -56,8 +60,34 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
setTemplateType(value); setTemplateType(value);
}; };
const handleSelectTemplate = (id: string) => {
let list: string[] = [...selectTemplateData];
if (selectTemplateData.filter((e) => e === id).length > 0) {
list = list.filter((e) => e !== id);
setSelectTemplateData(list);
} else {
list.push(id);
setSelectTemplateData(list);
}
};
// 项目管理员-添加工作流模板-提交
const { run: addTemplate } = useMyRequest(addWorkbenchTemplate, {
onSuccess: (result: any) => {
setSelectTemplateData([]);
setShowAddTemplate(false);
getTemplateInfo({
projectId: projectId as string,
});
},
});
const handleAddTemplate = () => { const handleAddTemplate = () => {
console.log("handleAddTemplate"); console.log("handleAddTemplate");
addTemplate({
projectId: projectId as string,
workflowSpecIds: selectTemplateData,
});
}; };
// 添加工作流模板-获取模板列表 // 添加工作流模板-获取模板列表
...@@ -205,6 +235,9 @@ const AddTemplate = observer((props: IAddTemplateProps) => { ...@@ -205,6 +235,9 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
[style.templateLiCustom]: templateType !== "public", [style.templateLiCustom]: templateType !== "public",
})} })}
key={index} key={index}
onClick={() => {
handleSelectTemplate(item.id);
}}
> >
<div className={style.templateLiTop}> <div className={style.templateLiTop}>
<span className={style.templateTitle}>{item.title}</span> <span className={style.templateTitle}>{item.title}</span>
......
...@@ -267,7 +267,10 @@ const ProjectMembers = observer(() => { ...@@ -267,7 +267,10 @@ const ProjectMembers = observer(() => {
/> */} /> */}
{showAddTemplate && ( {showAddTemplate && (
<AddTemplate setShowAddTemplate={setShowAddTemplate} /> <AddTemplate
setShowAddTemplate={setShowAddTemplate}
getTemplateInfo={getTemplateInfo}
/>
)} )}
<SimpleDialog <SimpleDialog
......
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