|
|
|
@@ -24,7 +24,7 @@ import SessionStorage from '@/utils/sessionStorage'; |
|
|
|
import { modalConfirm } from '@/utils/ui'; |
|
|
|
import { PlusOutlined } from '@ant-design/icons'; |
|
|
|
import { useNavigate, useParams } from '@umijs/max'; |
|
|
|
import { App, Button, Col, Flex, Form, Input, Row, Select } from 'antd'; |
|
|
|
import { App, Button, Col, Flex, Form, Input, InputNumber, Row, Select } from 'antd'; |
|
|
|
import { omit, pick } from 'lodash'; |
|
|
|
import { useEffect, useState } from 'react'; |
|
|
|
import { |
|
|
|
@@ -120,11 +120,11 @@ function CreateServiceVersion() { |
|
|
|
|
|
|
|
// 创建版本 |
|
|
|
const createServiceVersion = async (formData: FormData) => { |
|
|
|
const envList = formData['env_variables'] ?? []; |
|
|
|
const envList = formData['env_variables']; |
|
|
|
const image = formData['image']; |
|
|
|
const model = formData['model']; |
|
|
|
const codeConfig = formData['code_config']; |
|
|
|
const envVariables = envList.reduce((acc, cur) => { |
|
|
|
const envVariables = envList?.reduce((acc, cur) => { |
|
|
|
acc[cur.key] = cur.value; |
|
|
|
return acc; |
|
|
|
}, {} as Record<string, string>); |
|
|
|
@@ -139,9 +139,11 @@ function CreateServiceVersion() { |
|
|
|
pick(model, ['id', 'name', 'version', 'path', 'identifier', 'owner', 'showValue']), |
|
|
|
{ showValue: 'show_value' }, |
|
|
|
), |
|
|
|
code_config: changePropertyName(pick(codeConfig, ['code_path', 'branch', 'showValue']), { |
|
|
|
showValue: 'show_value', |
|
|
|
}), |
|
|
|
code_config: codeConfig |
|
|
|
? changePropertyName(pick(codeConfig, ['code_path', 'branch', 'showValue']), { |
|
|
|
showValue: 'show_value', |
|
|
|
}) |
|
|
|
: undefined, |
|
|
|
service_id: serviceInfo?.id, |
|
|
|
}; |
|
|
|
|
|
|
|
@@ -334,17 +336,7 @@ function CreateServiceVersion() { |
|
|
|
</Row> |
|
|
|
<Row gutter={8}> |
|
|
|
<Col span={10}> |
|
|
|
<Form.Item |
|
|
|
label="代码配置" |
|
|
|
name="code_config" |
|
|
|
rules={[ |
|
|
|
{ |
|
|
|
validator: requiredValidator, |
|
|
|
message: '请选择代码配置', |
|
|
|
}, |
|
|
|
]} |
|
|
|
required |
|
|
|
> |
|
|
|
<Form.Item label="代码配置" name="code_config"> |
|
|
|
<CodeSelect |
|
|
|
placeholder="请选择代码配置" |
|
|
|
canInput={false} |
|
|
|
@@ -395,7 +387,12 @@ function CreateServiceVersion() { |
|
|
|
}, |
|
|
|
]} |
|
|
|
> |
|
|
|
<Input placeholder="请输入副本数量" allowClear /> |
|
|
|
<InputNumber |
|
|
|
style={{ width: '100%' }} |
|
|
|
placeholder="请输入副本数量" |
|
|
|
min={1} |
|
|
|
precision={0} |
|
|
|
/> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
|