chore: version info modal

This commit is contained in:
jialin
2024-07-12 12:06:17 +08:00
parent c5327d3e56
commit 320db56fbe
38 changed files with 334 additions and 108 deletions
+31 -18
View File
@@ -1,9 +1,13 @@
import DropdownButtons from '@/components/drop-down-buttons';
import RowChildren from '@/components/seal-table/components/row-children';
import StatusTag from '@/components/status-tag';
import { DeleteOutlined, FieldTimeOutlined } from '@ant-design/icons';
import {
DeleteOutlined,
FieldTimeOutlined,
InfoCircleOutlined
} from '@ant-design/icons';
import { useIntl } from '@umijs/max';
import { Col, Row, Space } from 'antd';
import { Col, Row, Space, Tooltip } from 'antd';
import dayjs from 'dayjs';
import _ from 'lodash';
import React from 'react';
@@ -59,35 +63,44 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
});
};
const getWorkerIp = (item: ModelInstanceListItem) => {
const renderWorkerInfo = (item: ModelInstanceListItem) => {
let workerIp = '-';
if (item.worker_ip) {
return item.port ? `${item.worker_ip}:${item.port}` : item.worker_ip;
workerIp = item.port ? `${item.worker_ip}:${item.port}` : item.worker_ip;
}
return '-';
return (
<div>
<div>{item.worker_name}</div>
<div>{workerIp}</div>
</div>
);
};
return (
<Space size={16} direction="vertical" style={{ width: '100%' }}>
{_.map(list, (item: ModelInstanceListItem, index: number) => {
return (
<div
className="_2Q2Yw"
key={`${item.id}`}
style={{ borderRadius: 'var(--ant-table-header-border-radius)' }}
>
<RowChildren key={`${item.id}_row`}>
<Row style={{ width: '100%' }} align="middle">
<Col span={4}>{item.name}</Col>
<Col span={3}>{item.worker_name || '-'}</Col>
<Col span={4}>
<span>
{item.source === 'huggingface'
? item.huggingface_filename
: item.ollama_library_model_name}
</span>
<Col
span={5}
style={{
paddingInline: 'var(--ant-table-cell-padding-inline)'
}}
>
<Tooltip title={renderWorkerInfo(item)}>
<span className="m-r-5">{item.name}</span>
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={3}>
<Col span={6}></Col>
<Col span={4}>
<span
style={{ paddingLeft: '0px' }}
style={{ paddingLeft: '56px' }}
className="flex justify-center"
>
{item.state && (
@@ -107,11 +120,11 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
</span>
</Col>
<Col span={5}>
<span style={{ paddingLeft: 36 }}>
<span style={{ paddingLeft: 38 }}>
{dayjs(item.updated_at).format('YYYY-MM-DD HH:mm:ss')}
</span>
</Col>
<Col span={5}>
<Col span={4}>
<div style={{ paddingLeft: 39 }}>
<DropdownButtons
items={setChildActionList(item)}
+11 -5
View File
@@ -337,15 +337,21 @@ const Models: React.FC<ModelsProps> = ({
dataIndex="name"
key="name"
width={400}
span={6}
span={5}
/>
<SealColumn
title={intl.formatMessage({ id: 'models.form.source' })}
dataIndex="source"
key="source"
span={4}
render={(text) => {
return modelSourceMap[text] || '-';
span={6}
render={(text, record: ListItem) => {
return (
<span>
{record.source === modelSourceMap.huggingface_value
? `${modelSourceMap.huggingface} / ${record.huggingface_filename}`
: `${modelSourceMap.ollama_library} / ${record.ollama_library_model_name}`}
</span>
);
}}
/>
<SealColumn
@@ -369,7 +375,7 @@ const Models: React.FC<ModelsProps> = ({
}}
/>
<SealColumn
span={5}
span={4}
title={intl.formatMessage({ id: 'common.table.operation' })}
key="operation"
render={(text, record) => {