|
|
@@ -4,11 +4,10 @@ |
|
|
* @Description: 创建服务版本 |
|
|
* @Description: 创建服务版本 |
|
|
*/ |
|
|
*/ |
|
|
import CodeSelect from '@/components/CodeSelect'; |
|
|
import CodeSelect from '@/components/CodeSelect'; |
|
|
import KFIcon from '@/components/KFIcon'; |
|
|
|
|
|
import PageTitle from '@/components/PageTitle'; |
|
|
import PageTitle from '@/components/PageTitle'; |
|
|
import ResourceSelect, { |
|
|
import ResourceSelect, { |
|
|
requiredValidator, |
|
|
|
|
|
ResourceSelectorType, |
|
|
ResourceSelectorType, |
|
|
|
|
|
requiredValidator, |
|
|
type ParameterInputObject, |
|
|
type ParameterInputObject, |
|
|
} from '@/components/ResourceSelect'; |
|
|
} from '@/components/ResourceSelect'; |
|
|
import SubAreaTitle from '@/components/SubAreaTitle'; |
|
|
import SubAreaTitle from '@/components/SubAreaTitle'; |
|
|
@@ -22,7 +21,7 @@ import { changePropertyName } from '@/utils'; |
|
|
import { to } from '@/utils/promise'; |
|
|
import { to } from '@/utils/promise'; |
|
|
import SessionStorage from '@/utils/sessionStorage'; |
|
|
import SessionStorage from '@/utils/sessionStorage'; |
|
|
import { modalConfirm } from '@/utils/ui'; |
|
|
import { modalConfirm } from '@/utils/ui'; |
|
|
import { PlusOutlined } from '@ant-design/icons'; |
|
|
|
|
|
|
|
|
import { MinusCircleOutlined, PlusCircleOutlined, PlusOutlined } from '@ant-design/icons'; |
|
|
import { useNavigate, useParams } from '@umijs/max'; |
|
|
import { useNavigate, useParams } from '@umijs/max'; |
|
|
import { App, Button, Col, Flex, Form, Input, InputNumber, Row, Select } from 'antd'; |
|
|
import { App, Button, Col, Flex, Form, Input, InputNumber, Row, Select } from 'antd'; |
|
|
import { omit, pick } from 'lodash'; |
|
|
import { omit, pick } from 'lodash'; |
|
|
@@ -426,82 +425,100 @@ function CreateServiceVersion() { |
|
|
</Col> |
|
|
</Col> |
|
|
</Row> |
|
|
</Row> |
|
|
|
|
|
|
|
|
<Form.List name="env_variables"> |
|
|
|
|
|
{(fields, { add, remove }) => ( |
|
|
|
|
|
<> |
|
|
|
|
|
<Row gutter={8}> |
|
|
|
|
|
<Col span={10}> |
|
|
|
|
|
<Form.Item label="环境变量"> |
|
|
|
|
|
{fields.length === 0 ? ( |
|
|
|
|
|
<Button |
|
|
|
|
|
type="link" |
|
|
|
|
|
style={{ padding: '0' }} |
|
|
|
|
|
onClick={() => add()} |
|
|
|
|
|
disabled={disabled} |
|
|
|
|
|
> |
|
|
|
|
|
添加环境变量 |
|
|
|
|
|
</Button> |
|
|
|
|
|
) : null} |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
</Col> |
|
|
|
|
|
</Row> |
|
|
|
|
|
{fields.map(({ key, name, ...restField }) => ( |
|
|
|
|
|
<Flex key={key} align="center" gap="0 8px" style={{ width: '50%' }}> |
|
|
|
|
|
<Form.Item |
|
|
|
|
|
{...restField} |
|
|
|
|
|
name={[name, 'key']} |
|
|
|
|
|
style={{ flex: 1 }} |
|
|
|
|
|
rules={[ |
|
|
|
|
|
{ required: true, message: '请输入变量名' }, |
|
|
|
|
|
{ |
|
|
|
|
|
pattern: /^[a-zA-Z_][a-zA-Z0-9_-]*$/, |
|
|
|
|
|
message: |
|
|
|
|
|
'变量名只支持字母、数字、下划线、中横线且开头必须是字母或下划线', |
|
|
|
|
|
}, |
|
|
|
|
|
]} |
|
|
|
|
|
> |
|
|
|
|
|
<Input placeholder="请输入变量名" disabled={disabled} /> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<span style={{ marginBottom: '24px' }}>=</span> |
|
|
|
|
|
<Form.Item |
|
|
|
|
|
{...restField} |
|
|
|
|
|
name={[name, 'value']} |
|
|
|
|
|
style={{ flex: 1 }} |
|
|
|
|
|
rules={[{ required: true, message: '请输入变量值' }]} |
|
|
|
|
|
> |
|
|
|
|
|
<Input placeholder="请输入变量值" disabled={disabled} /> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Button |
|
|
|
|
|
type="link" |
|
|
|
|
|
style={{ marginBottom: '24px' }} |
|
|
|
|
|
icon={<KFIcon type="icon-shanchu" font={16} />} |
|
|
|
|
|
disabled={disabled} |
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
modalConfirm({ |
|
|
|
|
|
title: '删除', |
|
|
|
|
|
content: '是否确认要删除该环境变量?', |
|
|
|
|
|
onOk: () => { |
|
|
|
|
|
remove(name); |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}} |
|
|
|
|
|
></Button> |
|
|
|
|
|
</Flex> |
|
|
|
|
|
))} |
|
|
|
|
|
{fields.length > 0 ? ( |
|
|
|
|
|
<Button |
|
|
|
|
|
type="link" |
|
|
|
|
|
style={{ padding: '0', margin: '-24px 0 24px' }} |
|
|
|
|
|
onClick={() => add()} |
|
|
|
|
|
icon={<PlusOutlined />} |
|
|
|
|
|
disabled={disabled} |
|
|
|
|
|
> |
|
|
|
|
|
环境变量 |
|
|
|
|
|
</Button> |
|
|
|
|
|
) : null} |
|
|
|
|
|
</> |
|
|
|
|
|
)} |
|
|
|
|
|
</Form.List> |
|
|
|
|
|
|
|
|
<Row gutter={8}> |
|
|
|
|
|
<Col span={10}> |
|
|
|
|
|
<Form.Item label="环境变量"> |
|
|
|
|
|
<Form.List name="env_variables"> |
|
|
|
|
|
{(fields, { add, remove }) => ( |
|
|
|
|
|
<> |
|
|
|
|
|
{fields.map(({ key, name, ...restField }, index) => ( |
|
|
|
|
|
<Flex key={key} align="center" gap="0 8px"> |
|
|
|
|
|
<Form.Item |
|
|
|
|
|
{...restField} |
|
|
|
|
|
name={[name, 'key']} |
|
|
|
|
|
style={{ flex: 1 }} |
|
|
|
|
|
rules={[ |
|
|
|
|
|
{ required: true, message: '请输入变量名' }, |
|
|
|
|
|
{ |
|
|
|
|
|
pattern: /^[a-zA-Z_][a-zA-Z0-9_-]*$/, |
|
|
|
|
|
message: |
|
|
|
|
|
'变量名只支持字母、数字、下划线、中横线且开头必须是字母或下划线', |
|
|
|
|
|
}, |
|
|
|
|
|
]} |
|
|
|
|
|
> |
|
|
|
|
|
<Input placeholder="请输入变量名" disabled={disabled} /> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<span style={{ marginBottom: '24px' }}>=</span> |
|
|
|
|
|
<Form.Item |
|
|
|
|
|
{...restField} |
|
|
|
|
|
name={[name, 'value']} |
|
|
|
|
|
style={{ flex: 1 }} |
|
|
|
|
|
rules={[{ required: true, message: '请输入变量值' }]} |
|
|
|
|
|
> |
|
|
|
|
|
<Input placeholder="请输入变量值" disabled={disabled} /> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
<Flex |
|
|
|
|
|
style={{ |
|
|
|
|
|
width: '76px', |
|
|
|
|
|
marginLeft: '10px', |
|
|
|
|
|
height: '46px', |
|
|
|
|
|
marginBottom: '24px', |
|
|
|
|
|
}} |
|
|
|
|
|
align="center" |
|
|
|
|
|
> |
|
|
|
|
|
<Button |
|
|
|
|
|
style={{ |
|
|
|
|
|
marginRight: '3px', |
|
|
|
|
|
}} |
|
|
|
|
|
shape="circle" |
|
|
|
|
|
size="middle" |
|
|
|
|
|
type="text" |
|
|
|
|
|
icon={<MinusCircleOutlined />} |
|
|
|
|
|
disabled={disabled} |
|
|
|
|
|
onClick={() => { |
|
|
|
|
|
modalConfirm({ |
|
|
|
|
|
title: '确定要删除该环境变量吗?', |
|
|
|
|
|
onOk: () => { |
|
|
|
|
|
remove(name); |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
}} |
|
|
|
|
|
></Button> |
|
|
|
|
|
{index === fields.length - 1 && ( |
|
|
|
|
|
<Button |
|
|
|
|
|
shape="circle" |
|
|
|
|
|
size="middle" |
|
|
|
|
|
type="text" |
|
|
|
|
|
disabled={disabled} |
|
|
|
|
|
icon={<PlusCircleOutlined />} |
|
|
|
|
|
onClick={() => add()} |
|
|
|
|
|
></Button> |
|
|
|
|
|
)} |
|
|
|
|
|
</Flex> |
|
|
|
|
|
</Flex> |
|
|
|
|
|
))} |
|
|
|
|
|
{fields.length === 0 && ( |
|
|
|
|
|
<Form.Item className={styles['create-service-version__content__env']}> |
|
|
|
|
|
<Button |
|
|
|
|
|
className={styles['create-service-version__content__env__add-btn']} |
|
|
|
|
|
color="primary" |
|
|
|
|
|
variant="dashed" |
|
|
|
|
|
disabled={disabled} |
|
|
|
|
|
icon={<PlusOutlined />} |
|
|
|
|
|
block |
|
|
|
|
|
onClick={() => add()} |
|
|
|
|
|
> |
|
|
|
|
|
环境变量 |
|
|
|
|
|
</Button> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
)} |
|
|
|
|
|
</> |
|
|
|
|
|
)} |
|
|
|
|
|
</Form.List> |
|
|
|
|
|
</Form.Item> |
|
|
|
|
|
</Col> |
|
|
|
|
|
</Row> |
|
|
|
|
|
|
|
|
<Form.Item wrapperCol={{ offset: 0, span: 16 }}> |
|
|
<Form.Item wrapperCol={{ offset: 0, span: 16 }}> |
|
|
<Button type="primary" htmlType="submit"> |
|
|
<Button type="primary" htmlType="submit"> |
|
|
{buttonText} |
|
|
{buttonText} |
|
|
|