Commit 287ce476 authored by chenshouchao's avatar chenshouchao

Merge branch 'feat-20221012-environment' of http://120.77.149.83/root/bkunyun…

Merge branch 'feat-20221012-environment' of http://120.77.149.83/root/bkunyun into feat-20221012-environment
parents 60352605 ff68cec8
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:17:48 * @Date: 2022-05-31 10:17:48
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-10-27 15:39:05 * @LastEditTime: 2022-10-28 13:58:40
* @FilePath: /bkunyun/src/api/api_prefix.ts * @FilePath: /bkunyun/src/api/api_prefix.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
*/ */
...@@ -36,7 +36,7 @@ switch (process.env.REACT_APP_ENV) { ...@@ -36,7 +36,7 @@ switch (process.env.REACT_APP_ENV) {
BACKEND_API_URI_PREFIX = "https://www.cloudam.cn"; BACKEND_API_URI_PREFIX = "https://www.cloudam.cn";
} }
else { else {
BACKEND_API_URI_PREFIX = "http://47.57.4.97"; BACKEND_API_URI_PREFIX = "http://47.75.104.171";
} }
break; break;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com * @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-11 11:56:58 * @Date: 2022-07-11 11:56:58
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-09-08 13:55:20 * @LastEditTime: 2022-10-28 15:27:23
* @FilePath: /bkunyun/src/components/mui/MyTooltip.tsx * @FilePath: /bkunyun/src/components/mui/MyTooltip.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
*/ */
...@@ -11,7 +11,7 @@ import { ThemeProvider, createTheme } from "@mui/material/styles"; ...@@ -11,7 +11,7 @@ import { ThemeProvider, createTheme } from "@mui/material/styles";
import { useMemo } from "react"; import { useMemo } from "react";
interface IMyTooltipProps extends Omit<TooltipProps, "title"> { interface IMyTooltipProps extends Omit<TooltipProps, "title"> {
title?: string | boolean; title?: string | boolean | JSX.Element | React.ReactNode;
} }
const theme = createTheme({ const theme = createTheme({
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
.content { .content {
display: flex; display: flex;
/* position: relative; */
/* overflow: hidden; */
border-radius: 4px; border-radius: 4px;
margin-bottom: 20px; margin-bottom: 20px;
height: 600px; height: 600px;
...@@ -103,3 +105,7 @@ ...@@ -103,3 +105,7 @@
color: #ff4e4e; color: #ff4e4e;
background-color: #ffe8e8; background-color: #ffe8e8;
} }
.react-flow > div:last-child {
display: none;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生 15770852798@163.com * @Author: 吴永生 15770852798@163.com
* @Date: 2022-10-18 16:12:55 * @Date: 2022-10-18 16:12:55
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-10-27 18:43:48 * @LastEditTime: 2022-10-28 16:48:21
* @FilePath: /bkunyun/src/views/ResourceCenter/UserResources/WorkflowOperator/components/AddOperator/index.tsx * @FilePath: /bkunyun/src/views/ResourceCenter/UserResources/WorkflowOperator/components/AddOperator/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
*/ */
...@@ -47,6 +47,7 @@ import { saveBatchActor } from "@/api/project_api"; ...@@ -47,6 +47,7 @@ import { saveBatchActor } from "@/api/project_api";
import positionTransform from "@/views/CustomOperator/utils"; import positionTransform from "@/views/CustomOperator/utils";
import style from "./index.module.css"; import style from "./index.module.css";
import MyTooltip from "@/components/mui/MyTooltip";
interface IAddOperator { interface IAddOperator {
pageType: string; pageType: string;
...@@ -98,8 +99,6 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -98,8 +99,6 @@ const AddOperator = observer((props: IAddOperator) => {
/** 是否打开帮助手册 */ /** 是否打开帮助手册 */
const [tipsOpen, setTipsOpen] = useState<boolean>(false); const [tipsOpen, setTipsOpen] = useState<boolean>(false);
/** 详情数据 */ /** 详情数据 */
const [detailData, setDetailData] = useState<any>({});
/** 详情数据 */
const [detailInfo, setDetailInfo] = useState<any>(); const [detailInfo, setDetailInfo] = useState<any>();
const { handleCheck } = useCheckOperator( const { handleCheck } = useCheckOperator(
...@@ -127,8 +126,6 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -127,8 +126,6 @@ const AddOperator = observer((props: IAddOperator) => {
const { run: fetchOperatorDetail } = useMyRequest(getOperatorDetail, { const { run: fetchOperatorDetail } = useMyRequest(getOperatorDetail, {
onSuccess: (res: any) => { onSuccess: (res: any) => {
if (res.message === "success") { if (res.message === "success") {
/** 设置详情数据 */
setDetailData(res.data);
/** 批算子数据 */ /** 批算子数据 */
const batchData = res?.data?.filter((item: any) => { const batchData = res?.data?.filter((item: any) => {
return item.type === "BATCH"; return item.type === "BATCH";
...@@ -180,13 +177,19 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -180,13 +177,19 @@ const AddOperator = observer((props: IAddOperator) => {
if (type === "BATCH" && !envId) { if (type === "BATCH" && !envId) {
setOperatorList(flowData || []); setOperatorList(flowData || []);
} else { } else {
setCode(JSON.stringify(res?.data?.parameters, null, "\t")); setCode(JSON.stringify(determineInfo?.parameters, null, "\t"));
} }
setDetailInfo(res.data); setDetailInfo(determineInfo);
} }
}, },
}); });
// 调用详情数据
useEffect(() => {
if (!detailsId) return;
fetchOperatorDetail(detailsId);
}, [detailsId, fetchOperatorDetail]);
/** 保存修改算子 */ /** 保存修改算子 */
const { run: runSaveOperator } = useMyRequest(saveOperator, { const { run: runSaveOperator } = useMyRequest(saveOperator, {
onSuccess: (res: any) => { onSuccess: (res: any) => {
...@@ -197,6 +200,7 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -197,6 +200,7 @@ const AddOperator = observer((props: IAddOperator) => {
} }
}, },
}); });
// 基于流算子构建批算子 // 基于流算子构建批算子
const { run: saveBatchActorRun } = useMyRequest(saveBatchActor, { const { run: saveBatchActorRun } = useMyRequest(saveBatchActor, {
onSuccess: (res) => { onSuccess: (res) => {
...@@ -206,11 +210,7 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -206,11 +210,7 @@ const AddOperator = observer((props: IAddOperator) => {
}, },
}); });
useEffect(() => { // 参数配置失焦校验
if (!detailsId) return;
fetchOperatorDetail(detailsId);
}, [detailsId, fetchOperatorDetail]);
const paramsConfigBlur = useCallback(() => { const paramsConfigBlur = useCallback(() => {
let result, resultError; let result, resultError;
if (batchBuildType === "OPERATOR") return; if (batchBuildType === "OPERATOR") return;
...@@ -271,6 +271,7 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -271,6 +271,7 @@ const AddOperator = observer((props: IAddOperator) => {
setBatchBuildType(val); setBatchBuildType(val);
}; };
/** 构建环境提交 */
const handleSubmit = useCallback(() => { const handleSubmit = useCallback(() => {
const resultErrors = checkFormData( const resultErrors = checkFormData(
formData, formData,
...@@ -342,6 +343,22 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -342,6 +343,22 @@ const AddOperator = observer((props: IAddOperator) => {
taskType, taskType,
]); ]);
const scriptHelp = useMemo(() => {
let newText = "";
try {
const newData = JSON.parse(code);
const nameArr = newData?.map((item: any) => {
return `${item.name}: ~{$actorName$.${item.name}}`;
});
newText = nameArr?.join("\n");
} catch (err) {
console.log(err);
}
console.log(newText, "newText");
return <pre>{newText}</pre>;
}, [code]);
return ( return (
<div className={style.addOperatorBox}> <div className={style.addOperatorBox}>
<div className={style.left}> <div className={style.left}>
...@@ -568,6 +585,7 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -568,6 +585,7 @@ const AddOperator = observer((props: IAddOperator) => {
</FormItemBox> </FormItemBox>
</div> </div>
)} )}
<div></div>
</div> </div>
{taskType === "FLOW" ? null : ( {taskType === "FLOW" ? null : (
<div <div
...@@ -575,7 +593,16 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -575,7 +593,16 @@ const AddOperator = observer((props: IAddOperator) => {
style={{ marginBottom: flowParametersError ? "56px" : "24px" }} style={{ marginBottom: flowParametersError ? "56px" : "24px" }}
> >
<div className={style.codeTitle}> <div className={style.codeTitle}>
{batchBuildType === "ENVIRONMENT" ? "运行脚本" : "流程编排"} <span>
{batchBuildType === "ENVIRONMENT" ? "运行脚本" : "流程编排"}
</span>
{batchBuildType === "ENVIRONMENT" ? (
<MyTooltip title={scriptHelp}>
<span style={{ color: "#1370FF", cursor: "pointer" }}>
帮助手册
</span>
</MyTooltip>
) : null}
</div> </div>
{batchBuildType === "ENVIRONMENT" ? ( {batchBuildType === "ENVIRONMENT" ? (
<div className={style.code}> <div className={style.code}>
...@@ -588,6 +615,7 @@ const AddOperator = observer((props: IAddOperator) => { ...@@ -588,6 +615,7 @@ const AddOperator = observer((props: IAddOperator) => {
) : ( ) : (
<div <div
id="customOperatorFlow" id="customOperatorFlow"
className="reactFlowBox"
style={{ style={{
position: "relative", position: "relative",
height: 400, height: 400,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生 15770852798@163.com * @Author: 吴永生 15770852798@163.com
* @Date: 2022-10-20 17:36:14 * @Date: 2022-10-20 17:36:14
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-10-27 11:30:07 * @LastEditTime: 2022-10-28 15:22:13
* @FilePath: /bkunyun/src/views/ResourceCenter/UserResources/WorkflowOperator/components/AddOperator/utils.ts * @FilePath: /bkunyun/src/views/ResourceCenter/UserResources/WorkflowOperator/components/AddOperator/utils.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
*/ */
...@@ -125,7 +125,7 @@ export const checkParamsConfig = (val: string) => { ...@@ -125,7 +125,7 @@ export const checkParamsConfig = (val: string) => {
} }
export const initCode = [{ export const initCode = [{
"name" : "timeout", "name" : "paramName",
"classType" : "INT", "classType" : "INT",
"required" : false, "required" : false,
"defaultValue" : 10000, "defaultValue" : 10000,
...@@ -154,7 +154,6 @@ export const initCode = [{ ...@@ -154,7 +154,6 @@ export const initCode = [{
}] }]
export const text = `{ export const text = `{
// 参数名, 必填, 在15字符以内,仅限大小写字母、数字、"_",且只能以大小写字母开头 // 参数名, 必填, 在15字符以内,仅限大小写字母、数字、"_",且只能以大小写字母开头
"name" : "timeout", "name" : "timeout",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴永生 15770852798@163.com * @Author: 吴永生 15770852798@163.com
* @Date: 2022-10-17 14:35:11 * @Date: 2022-10-17 14:35:11
* @LastEditors: 吴永生 15770852798@163.com * @LastEditors: 吴永生 15770852798@163.com
* @LastEditTime: 2022-10-27 17:22:54 * @LastEditTime: 2022-10-28 14:54:39
* @FilePath: /bkunyun/src/views/ResourceCenter/UserResources/WorkflowOperator/index.tsx * @FilePath: /bkunyun/src/views/ResourceCenter/UserResources/WorkflowOperator/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
*/ */
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom"; import { useLocation, useNavigate } from "react-router-dom";
import { Base64 } from "js-base64";
import BasicInfo from "../../../../components/BasinInfo"; import BasicInfo from "../../../../components/BasinInfo";
import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle"; import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle";
...@@ -19,10 +20,9 @@ import { useStores } from "@/store"; ...@@ -19,10 +20,9 @@ import { useStores } from "@/store";
import goback from "@/assets/project/goback.svg"; import goback from "@/assets/project/goback.svg";
import Code from "@/components/CommonComponents/Code"; import Code from "@/components/CommonComponents/Code";
import Flow from "@/views/Project/components/Flow"; import Flow from "@/views/Project/components/Flow";
import { IParameterClassType, parameterClassType } from "../../interface";
import styles from "./index.module.css"; import styles from "./index.module.css";
import { Base64 } from "js-base64";
import { IParameterClassType, parameterClassType } from "../../interface";
const ParametersInfo = (props: any) => { const ParametersInfo = (props: any) => {
const { const {
...@@ -35,7 +35,6 @@ const ParametersInfo = (props: any) => { ...@@ -35,7 +35,6 @@ const ParametersInfo = (props: any) => {
domType, domType,
description = "", description = "",
} = props?.info; } = props?.info;
console.log(name, "1111");
const infoData = useMemo(() => { const infoData = useMemo(() => {
return [ return [
{ {
...@@ -76,7 +75,6 @@ const ParametersInfo = (props: any) => { ...@@ -76,7 +75,6 @@ const ParametersInfo = (props: any) => {
required, required,
title, title,
]); ]);
console.log(infoData, "infoData");
return ( return (
<div className={styles.paramsBox}> <div className={styles.paramsBox}>
<div className={styles.nameBox}>{name}</div> <div className={styles.nameBox}>{name}</div>
...@@ -108,10 +106,18 @@ const OperatorDetails = observer(() => { ...@@ -108,10 +106,18 @@ const OperatorDetails = observer(() => {
onSuccess: (res: any) => { onSuccess: (res: any) => {
if (res.message === "success") { if (res.message === "success") {
/** 设置详情数据 */ /** 设置详情数据 */
setDetailData(res.data); const newData = res.data.map((item: any) => {
/** 初始化批算子偏移量 */
if (item.type === "BATCH") {
item.position = { x: 100, y: 100 };
}
return item;
});
setDetailData(newData);
const filterData = res?.data?.filter((item: any) => { const filterData = res?.data?.filter((item: any) => {
return item.type === "BATCH"; return item.type === "BATCH";
}); });
if (filterData?.length) { if (filterData?.length) {
setDetailInfo(filterData[0]); setDetailInfo(filterData[0]);
} else { } else {
...@@ -145,9 +151,13 @@ const OperatorDetails = observer(() => { ...@@ -145,9 +151,13 @@ const OperatorDetails = observer(() => {
return result; return result;
}, [envId]); }, [envId]);
/** 初始设置第一项 */
useEffect(() => {
setContentType(contentTypeList[0].value);
}, [contentTypeList]);
/** 切换类型 */ /** 切换类型 */
const handleRadio = (val: string) => { const handleRadio = (val: string) => {
console.log(val, "2");
setContentType(val); setContentType(val);
}; };
...@@ -181,7 +191,12 @@ const OperatorDetails = observer(() => { ...@@ -181,7 +191,12 @@ const OperatorDetails = observer(() => {
</div> </div>
</div> </div>
<h2 className={styles.baseInfoBox}>基础信息</h2> <h2 className={styles.baseInfoBox}>基础信息</h2>
<div style={{ border: "1px solid #EBEDF0" }}> <div
style={{
border: "1px solid #EBEDF0",
marginBottom: type === "BATCH" ? undefined : "16px",
}}
>
<BasicInfo <BasicInfo
infoList={[ infoList={[
{ label: "所属产品", value: productText }, { label: "所属产品", value: productText },
...@@ -208,8 +223,10 @@ const OperatorDetails = observer(() => { ...@@ -208,8 +223,10 @@ const OperatorDetails = observer(() => {
/> />
</div> </div>
) : null} ) : null}
{contentType === "flowChart" && type === "BATCH" ? ( {contentType === "flowChart" && !envId ? (
<Flow tasks={detailData} className={styles.contentBox} /> <div className={styles.contentBox}>
<Flow tasks={detailData} showControls={false} />
</div>
) : null} ) : null}
{contentType === "parameterList" || type === "FLOW" ? ( {contentType === "parameterList" || type === "FLOW" ? (
<> <>
......
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