Browse Source

fix: 修复镜像版本列表没有描述字段

pull/189/head
cp3hnu 1 year ago
parent
commit
590d99727c
4 changed files with 26 additions and 20 deletions
  1. +2
    -2
      react-ui/src/pages/DevelopmentEnvironment/components/CreateMirrorModal/index.tsx
  2. +21
    -15
      react-ui/src/pages/Mirror/Create/index.tsx
  3. +2
    -2
      react-ui/src/pages/Mirror/Info/index.tsx
  4. +1
    -1
      react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx

+ 2
- 2
react-ui/src/pages/DevelopmentEnvironment/components/CreateMirrorModal/index.tsx View File

@@ -51,8 +51,8 @@ function CreateMirrorModal({ envId, onOk, ...rest }: CreateMirrorModalProps) {
message: '请输入镜像名称',
},
{
pattern: /^[a-z0-9/_-]*$/,
message: '只支持小写字母、数字、下划线(_)、中横线(-)、斜杠(/)',
pattern: /^[a-z0-9/._-]*$/,
message: '只支持小写字母、数字、点(.)、下划线(_)、中横线(-)、斜杠(/)',
},
]}
>


+ 21
- 15
react-ui/src/pages/Mirror/Create/index.tsx View File

@@ -70,32 +70,36 @@ function MirrorCreate() {
// 创建公网、本地镜像
const createPublicMirror = async (formData: FormData) => {
const upload_type = formData['upload_type'];
let params;
if (upload_type === CommonTabKeys.Public) {
params = {
const params = {
...omit(formData, ['upload_type']),
upload_type: 0,
image_type: 0,
};
const [res] = await to(createMirrorReq(params));
if (res) {
message.success('创建成功');
navigate(-1);
}
} else {
const fileList = formData['fileList'] ?? [];
if (validateUploadFiles(fileList)) {
const file = fileList[0];
params = {
const params = {
...omit(formData, ['fileList', 'upload_type']),
path: file.response.data.url,
file_size: file.response.data.fileSize,
upload_type: 1,
image_type: 0,
};
const [res] = await to(createMirrorReq(params));
if (res) {
message.success('创建成功');
navigate(-1);
}
}
}

const [res] = await to(createMirrorReq(params));
if (res) {
message.success('创建成功');
navigate(-1);
}
};

// 提交
@@ -118,6 +122,8 @@ function MirrorCreate() {
return true;
};

const descTitle = isAddVersion ? '版本描述' : '镜像描述';

return (
<div className={styles['mirror-create']}>
<PageTitle title={!isAddVersion ? '创建镜像' : '新增镜像版本'}></PageTitle>
@@ -125,7 +131,7 @@ function MirrorCreate() {
<div>
<Form
name="mirror-create"
labelCol={{ flex: '130px' }}
labelCol={{ flex: '135px' }}
wrapperCol={{ flex: 1 }}
labelAlign="left"
form={form}
@@ -150,8 +156,8 @@ function MirrorCreate() {
message: '请输入镜像名称',
},
{
pattern: /^[a-z0-9/_-]*$/,
message: '只支持小写字母、数字、下划线(_)、中横线(-)、斜杠(/)',
pattern: /^[a-z0-9/._-]*$/,
message: '只支持小写字母、数字、点(.)、下划线(_)、中横线(-)、斜杠(/)',
},
]}
>
@@ -189,18 +195,18 @@ function MirrorCreate() {
<Row gutter={10}>
<Col span={20}>
<Form.Item
label={isAddVersion ? '镜像版本描述' : '镜像描述'}
label={descTitle}
name="description"
rules={[
{
required: true,
message: '请输入镜像描述',
message: `请输入${descTitle}`,
},
]}
>
<Input.TextArea
autoSize={{ minRows: 2, maxRows: 6 }}
placeholder="请输入镜像描述,最长128字符"
placeholder={`请输入${descTitle}`}
maxLength={128}
showCount
allowClear


+ 2
- 2
react-ui/src/pages/Mirror/Info/index.tsx View File

@@ -167,14 +167,14 @@ function MirrorInfo() {
title: '镜像版本',
dataIndex: 'tag_name',
key: 'tag_name',
width: '20%',
width: '25%',
render: tableCellRender(),
},
{
title: '镜像地址',
dataIndex: 'url',
key: 'url',
width: '20%',
width: '25%',
render: tableCellRender('auto', TableCellValueType.Text, { copyable: true }),
},
{


+ 1
- 1
react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx View File

@@ -433,7 +433,7 @@ function ServiceInfo() {
onClick={() => createServiceVersion(ServiceOperationType.Create)}
icon={<KFIcon type="icon-xinjian2" />}
>
新增版本
新增服务版本
</Button>
<Button style={{ marginRight: '15px' }} type="default" onClick={handleVersionCompare}>
版本对比


Loading…
Cancel
Save