支持批量创建同名称环境变量,日志和脚本管理PC页支持宽度拖拽

This commit is contained in:
hanhh
2021-08-17 18:34:55 +08:00
parent 594e871744
commit 2d6da9ebfe
9 changed files with 114 additions and 89 deletions
+2 -1
View File
@@ -317,7 +317,8 @@ const Env = () => {
const result = [...value];
const index = value.findIndex((x) => x._id === env._id);
if (index === -1) {
result.push(env);
env = Array.isArray(env) ? env : [env];
result.push(...env);
} else {
result.splice(index, 1, {
...env,
+21 -2
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form } from 'antd';
import { Modal, message, Input, Form, Radio } from 'antd';
import { request } from '@/utils/http';
import config from '@/utils/config';
@@ -17,8 +17,19 @@ const EnvModal = ({
const handleOk = async (values: any) => {
setLoading(true);
const { value, split, name, remarks } = values;
const method = env ? 'put' : 'post';
const payload = env ? { ...values, _id: env._id } : values;
let payload = env ? { ...values, _id: env._id } : values;
if (!env && split === '1') {
const symbol = value.includes('&') ? '&' : '\n';
payload = value.split(symbol).map((x: any) => {
return {
name: name,
value: x,
remarks: remarks,
};
});
}
const { code, data } = await request[method](`${config.apiPrefix}envs`, {
data: payload,
});
@@ -61,6 +72,14 @@ const EnvModal = ({
>
<Input placeholder="请输入环境变量名称" />
</Form.Item>
{!env && (
<Form.Item name="split" label="自动拆分" initialValue="0">
<Radio.Group>
<Radio value="1"></Radio>
<Radio value="0"></Radio>
</Radio.Group>
</Form.Item>
)}
<Form.Item
name="value"
label="值"