Browse Source

Merge branch 'dev' of https://gitlink.org.cn/ci4s/ci4sManagement-cloud into dev

pull/221/head
chenzhihang 9 months ago
parent
commit
1ab06a0ab7
6 changed files with 40 additions and 37 deletions
  1. +1
    -1
      react-ui/src/iconfont/iconfont-menu.js
  2. +15
    -1
      react-ui/src/iconfont/iconfont-menu.json
  3. +8
    -20
      react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx
  4. +8
    -8
      react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx
  5. +6
    -6
      react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.tsx
  6. +2
    -1
      react-ui/src/utils/date.ts

+ 1
- 1
react-ui/src/iconfont/iconfont-menu.js
File diff suppressed because it is too large
View File


+ 15
- 1
react-ui/src/iconfont/iconfont-menu.json View File

@@ -1,10 +1,24 @@
{
"id": "4511326",
"name": "智能材料科研平台-导航",
"name": "复杂智能软件-导航",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "42495274",
"name": "知识图谱-active",
"font_class": "zhishitupu-icon-active",
"unicode": "e63e",
"unicode_decimal": 58942
},
{
"icon_id": "42495275",
"name": "知识图谱",
"font_class": "zhishitupu-icon",
"unicode": "e63f",
"unicode_decimal": 58943
},
{
"icon_id": "41643218",
"name": "模型开发",


+ 8
- 20
react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx View File

@@ -3,7 +3,6 @@
* @Date: 2024-04-16 13:58:08
* @Description: 创建服务版本
*/
import CodeSelect from '@/components/CodeSelect';
import PageTitle from '@/components/PageTitle';
import ParameterSelect from '@/components/ParameterSelect';
import ResourceSelect, {
@@ -36,7 +35,7 @@ export type FormData = {
description: string; // 描述
model: ParameterInputObject; // 模型
image: ParameterInputObject; // 镜像
code_config: ParameterInputObject; // 代码
// code_config: ParameterInputObject; // 代码
resource: string; // 资源规格
replicas: string; // 副本数量
mount_path: string; // 模型路径
@@ -75,28 +74,23 @@ function CreateServiceVersion() {
setOperationType(res.operationType);
setLastPage(res.lastPage);
setVersionInfo(res);
let model, codeConfig, envVariables;
let model, envVariables;
// 模型
if (res.model && typeof res.model === 'object') {
model = changePropertyName(res.model, { show_value: 'showValue' });
// 接口返回是数据没有 value 值,但是 form 需要 value
model.value = model.showValue;
}
if (res.code_config && typeof res.code_config === 'object') {
codeConfig = changePropertyName(res.code_config, { show_value: 'showValue' });
// 接口返回是数据没有 value 值,但是 form 需要 value
codeConfig.value = codeConfig.showValue;
}
// 环境变量
if (res.env_variables && typeof res.env_variables === 'object') {
envVariables = Object.entries(res.env_variables).map(([key, value]) => ({
key,
value,
}));
}

const formData = {
...omit(res, 'model', 'code_config', 'env_variables'),
...omit(res, 'model', 'env_variables'),
model: model,
code_config: codeConfig,
env_variables: envVariables,
};
form.setFieldsValue(formData);
@@ -124,7 +118,6 @@ function CreateServiceVersion() {
const createServiceVersion = async (formData: FormData) => {
const envList = formData['env_variables'];
const model = formData['model'];
const codeConfig = formData['code_config'];
const envVariables = envList?.reduce((acc, cur) => {
acc[cur.key] = cur.value;
return acc;
@@ -132,18 +125,13 @@ function CreateServiceVersion() {

// 根据后台要求,修改表单数据
const object = {
...omit(formData, ['replicas', 'env_variables', 'model', 'code_config']),
...omit(formData, ['replicas', 'env_variables', 'model']),
replicas: Number(formData.replicas),
env_variables: envVariables,
model: changePropertyName(
pick(model, ['id', 'name', 'version', 'path', 'identifier', 'owner', 'showValue']),
{ showValue: 'show_value' },
),
code_config: codeConfig
? changePropertyName(pick(codeConfig, ['code_path', 'branch', 'showValue']), {
showValue: 'show_value',
})
: undefined,
service_id: serviceId,
};

@@ -335,7 +323,7 @@ function CreateServiceVersion() {
</Form.Item>
</Col>
</Row>
<Row gutter={8}>
{/* <Row gutter={8}>
<Col span={10}>
<Form.Item
label="代码配置"
@@ -350,7 +338,7 @@ function CreateServiceVersion() {
/>
</Form.Item>
</Col>
</Row>
</Row> */}
<Row gutter={8}>
<Col span={10}>
<Form.Item


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

@@ -284,14 +284,7 @@ function ServiceInfo() {
render: tableCellRender(true),
},
{
title: '状态',
dataIndex: 'run_state',
key: 'run_state',
width: '20%',
render: ServiceRunStatusCell,
},
{
title: '版本镜像',
title: '镜像版本',
dataIndex: ['image', 'showValue'],
key: 'image',
width: '20%',
@@ -313,6 +306,13 @@ function ServiceInfo() {
format: getResourceDescription,
}),
},
{
title: '状态',
dataIndex: 'run_state',
key: 'run_state',
width: '20%',
render: ServiceRunStatusCell,
},
{
title: '操作',
dataIndex: 'operation',


+ 6
- 6
react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.tsx View File

@@ -3,7 +3,7 @@ import { ServiceRunStatus } from '@/enums';
import { useComputingResource } from '@/hooks/useComputingResource';
import { ServiceVersionData } from '@/pages/ModelDeployment/types';
import { formatDate } from '@/utils/date';
import { formatCodeConfig, formatMirror, formatModel } from '@/utils/format';
import { formatMirror, formatModel } from '@/utils/format';
import { Flex } from 'antd';
import ModelDeployStatusCell from '../ModelDeployStatusCell';

@@ -47,11 +47,11 @@ function VersionBasicInfo({ info }: BasicInfoProps) {
label: '版本名称',
value: info?.version,
},
{
label: '代码配置',
value: info?.code_config,
format: formatCodeConfig,
},
// {
// label: '代码配置',
// value: info?.code_config,
// format: formatCodeConfig,
// },
{
label: '镜像',
value: info?.image,


+ 2
- 1
react-ui/src/utils/date.ts View File

@@ -1,3 +1,4 @@
import { now } from '@/hooks/useServerTime';
import dayjs from 'dayjs';

/**
@@ -13,7 +14,7 @@ export const elapsedTime = (begin?: string | Date | null, end?: string | Date |
}

const beginDate = dayjs(begin);
const endDate = end === undefined || end === null ? dayjs() : dayjs(end);
const endDate = end === undefined || end === null ? dayjs(now()) : dayjs(end);
if (!beginDate.isValid() || !endDate.isValid()) {
return '--';
}


Loading…
Cancel
Save