Browse Source

feat: 流水线集成服务部署

pull/145/head
cp3hnu 1 year ago
parent
commit
6a357c5bb4
2 changed files with 37 additions and 18 deletions
  1. +22
    -0
      react-ui/src/components/ParameterSelect/config.tsx
  2. +15
    -18
      react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx

+ 22
- 0
react-ui/src/components/ParameterSelect/config.tsx View File

@@ -1,7 +1,10 @@
import { ServiceData } from '@/pages/ModelDeployment/types';
import { getDatasetList, getModelList } from '@/services/dataset/index.js';
import { getServiceListReq } from '@/services/modelDeployment';
import { getComputingResourceReq } from '@/services/pipeline';
import { ComputingResource } from '@/types';
import { type SelectProps } from 'antd';
import { pick } from 'lodash';

// 过滤资源规格
const filterResourceStandard: SelectProps<string, ComputingResource>['filterOption'] = (
@@ -62,6 +65,25 @@ export const paramSelectConfig: Record<string, SelectPropsConfig> = {
},
optionFilterProp: 'name',
},
service: {
getOptions: async () => {
const res = await getServiceListReq({
page: 0,
size: 1000,
});
return (
res?.data?.content?.map((item: ServiceData) => ({
label: item.service_name,
value: JSON.stringify(pick(item, ['id', 'service_name'])),
})) ?? []
);
},
fieldNames: {
label: 'label',
value: 'value',
},
optionFilterProp: 'label',
},
resource: {
getOptions: async () => {
const res = await getComputingResourceReq({


+ 15
- 18
react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx View File

@@ -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>


Loading…
Cancel
Save