Commit d149ef25 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20221012-environment' into 'release'

cn-feat: 新增流式环境增加字段script、样式调整

See merge request !154
parents 68012927 ff63dd42
......@@ -15,7 +15,8 @@ type addActorenvBuildenvParams = {
baseEnvId: string,
type: "BATCH" | "FLOW",
filePaths: Array<string>,
bashScript: string,
bashScript?: string,
script?: string,
computeType: string,
publicProjectId: string,
}
......
......@@ -203,7 +203,7 @@ const SaveOperator = (props: IProps) => {
style={{
position: "absolute",
fontSize: "14px",
bottom: "7px",
top: "96px",
right: "12px",
color: description.length >= 300 ? "#d32f2f" : "#C2C6CC",
}}
......
......@@ -358,7 +358,7 @@ const BaseInfo = observer(() => {
style={{
fontSize: "14px",
position: "absolute",
bottom: "7px",
top: "96px",
right: "12px",
color: projectInfo.desc.length >= 100 ? "#d32f2f" : "#C2C6CC",
}}
......
......@@ -224,7 +224,7 @@ const AddProject = observer((props: IAddProjectProps) => {
style={{
position: "absolute",
fontSize: "14px",
bottom: "7px",
top: "96px",
right: "12px",
color: desc.length >= 300 ? "#d32f2f" : "#C2C6CC",
}}
......
......@@ -31,7 +31,6 @@
.content {
display: flex;
border-radius: 4px;
margin-bottom: 24px;
height: 580px;
}
.form {
......@@ -51,6 +50,22 @@
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.codeBox2 {
flex: 1;
display: flex;
flex-direction: column;
border-radius: 4px;
margin-top: 20px;
}
.codeBox2 .codeTitle {
border-top-right-radius: 4px;
border-top-left-radius: 4px;
}
.codeBox2 .code {
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
overflow: hidden;
}
.codeTitle {
background-color: rgba(230, 233, 237, 1);
padding: 11px 20px;
......@@ -143,3 +158,6 @@
line-height: 20px;
margin-top: 12px;
}
.button {
margin-top: 24px;
}
......@@ -48,6 +48,7 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
const [envList, setEnvList] = useState<Array<any>>([]); // 基础环境列表 和taskType环境类型有关
const [progress, setProgress] = useState("0%"); // 上传压缩包进度
const [code, setCode] = useState(""); // 脚本内容
const [flowCode, setFlowCode] = useState(""); // 脚本内容
const [codeWidth, setCodeWidth] = useState(0);
const [upload, setUpload] = useState<any>(() => {}); // 上传压缩包实例 用于暂停(取消上传)upload.abort(true);
const [nameHelper, setNameHelper] = useState({
......@@ -270,25 +271,49 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
};
const handleSubmit = () => {
if (
!checkName(name) &&
!checkDesc(desc) &&
!checkFile(filePaths) &&
baseEnvId &&
code
) {
addActorenvBuildenvFn({
title: name,
desc,
baseEnvId,
type: taskType,
filePaths,
bashScript: Base64.encode(code),
publicProjectId,
computeType,
});
if (taskType === "BATCH") {
if (
!checkName(name) &&
!checkDesc(desc) &&
!checkFile(filePaths) &&
baseEnvId &&
code
) {
addActorenvBuildenvFn({
title: name,
desc,
baseEnvId,
type: taskType,
filePaths,
bashScript: Base64.encode(code),
publicProjectId,
computeType,
});
} else {
Message.error("请完善环境信息");
}
} else {
Message.error("请完善环境信息");
if (
!checkName(name) &&
!checkDesc(desc) &&
!checkFile(filePaths) &&
baseEnvId &&
flowCode
) {
addActorenvBuildenvFn({
title: name,
desc,
baseEnvId,
type: taskType,
filePaths,
bashScript: Base64.encode(code),
script: Base64.encode(flowCode),
publicProjectId,
computeType,
});
} else {
Message.error("请完善环境信息");
}
}
};
......@@ -358,7 +383,7 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
style={{
position: "absolute",
fontSize: "14px",
bottom: "7px",
top: "96px",
right: "12px",
color: desc.length >= 300 ? "#d32f2f" : "#C2C6CC",
}}
......@@ -462,7 +487,10 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
</div>
<div className={style.codeBox}>
<div className={style.codeTitle}>
{taskType === "BATCH" ? "Shell脚本" : "Python脚本"}
Shell脚本
{taskType === "BATCH" && (
<span className={style.required}>*</span>
)}
</div>
<div className={style.code} id="addEnvironmentCode">
<Code
......@@ -474,6 +502,22 @@ const AddEnvironment = (props: IAddEnvironmentProps) => {
</div>
</div>
</div>
{taskType === "FLOW" && (
<div className={style.codeBox2}>
<div className={style.codeTitle}>
Python脚本
<span className={style.required}>*</span>
</div>
<div className={style.code} id="addEnvironmentCode">
<Code
value={flowCode}
onChange={(e: string) => setFlowCode(e)}
height="535px"
width={`${codeWidth + 368}px`}
/>
</div>
</div>
)}
<div className={style.button}>
<MyButton
text="开始构建"
......
......@@ -16,6 +16,7 @@ import WorkFlowEdit from "@/views/WorkFlowEdit";
import { useMessage } from "@/components/MySnackbar";
import TemplateDetail from "./TemplateDetail";
import style from "./index.module.css";
import NoData from "@/components/BusinessComponents/NoData";
const UserResourcesTemplate = observer(() => {
const [title, setTitle] = useState("");
......@@ -162,6 +163,7 @@ const UserResourcesTemplate = observer(() => {
</div>
</div>
<div className={style.tableBox}>
{list.length === 0 && <NoData text="暂无相关模板"></NoData>}
<CardTable
data={list}
renderItem={renderItem}
......
......@@ -253,7 +253,7 @@ const SaveCustomTemplate = (props: IProps) => {
style={{
position: "absolute",
fontSize: "14px",
bottom: "7px",
top: "96px",
right: "12px",
color: description.length >= 300 ? "#d32f2f" : "#C2C6CC",
}}
......
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