mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-17 17:54:32 +08:00
支持批量创建同名称环境变量,日志和脚本管理PC页支持宽度拖拽
This commit is contained in:
Vendored
+2
-1
@@ -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,
|
||||
|
||||
Vendored
+21
-2
@@ -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="值"
|
||||
|
||||
Reference in New Issue
Block a user