chore: model list render time
This commit is contained in:
@@ -10,7 +10,7 @@ import { useIntl } from '@umijs/max';
|
||||
import { Col, Row, Space, Tooltip } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import React, { useCallback } from 'react';
|
||||
import { InstanceStatusMap, InstanceStatusMapValue, status } from '../config';
|
||||
import { ModelInstanceListItem } from '../config/types';
|
||||
|
||||
@@ -49,14 +49,14 @@ const InstanceItem: React.FC<InstanceItemProps> = ({
|
||||
}
|
||||
];
|
||||
|
||||
const setChildActionList = (item: ModelInstanceListItem) => {
|
||||
const setChildActionList = useCallback((item: ModelInstanceListItem) => {
|
||||
return _.filter(childActionList, (action: any) => {
|
||||
if (action.key === 'viewlog') {
|
||||
return action.status.includes(item.state);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
const renderWorkerInfo = (item: ModelInstanceListItem) => {
|
||||
let workerIp = '-';
|
||||
|
||||
@@ -39,10 +39,8 @@ import ViewLogsModal from './view-logs-modal';
|
||||
interface ModelsProps {
|
||||
handleSearch: (e: any) => void;
|
||||
handleNameChange: (e: any) => void;
|
||||
fetchData: () => Promise<any>;
|
||||
handleShowSizeChange?: (page: number, size: number) => void;
|
||||
handlePageChange: (page: number, pageSize: number | undefined) => void;
|
||||
createModelsChunkRequest: () => void;
|
||||
queryParams: {
|
||||
page: number;
|
||||
perPage: number;
|
||||
@@ -101,14 +99,14 @@ const Models: React.FC<ModelsProps> = ({
|
||||
}
|
||||
];
|
||||
|
||||
const setActionList = (record: ListItem) => {
|
||||
const setActionList = useCallback((record: ListItem) => {
|
||||
return _.filter(ActionList, (action: any) => {
|
||||
if (action.key === 'chat') {
|
||||
return record.ready_replicas > 0;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
const handleOnSort = (dataIndex: string, order: any) => {
|
||||
console.log('handleTableChange=======', dataIndex, order);
|
||||
|
||||
@@ -22,7 +22,6 @@ const Models: React.FC = () => {
|
||||
const [firstLoad, setFirstLoad] = useState(true);
|
||||
const chunkRequedtRef = useRef<any>();
|
||||
const chunkInstanceRequedtRef = useRef<any>();
|
||||
const dataSourceRef = useRef<any>();
|
||||
let axiosToken = createAxiosToken();
|
||||
const [queryParams, setQueryParams] = useState({
|
||||
page: 1,
|
||||
@@ -30,8 +29,6 @@ const Models: React.FC = () => {
|
||||
search: ''
|
||||
});
|
||||
|
||||
// dataSourceRef.current = dataSource;
|
||||
|
||||
const { updateChunkedList, cacheDataListRef } = useUpdateChunkedList({
|
||||
dataList: dataSource,
|
||||
setDataList: setDataSource
|
||||
@@ -51,7 +48,6 @@ const Models: React.FC = () => {
|
||||
if (!firstLoad) {
|
||||
setDataSource(res.items);
|
||||
}
|
||||
// setDataSource(res.items);
|
||||
setTotal(res.pagination.total);
|
||||
} catch (error) {
|
||||
setDataSource([]);
|
||||
@@ -154,11 +150,9 @@ const Models: React.FC = () => {
|
||||
handleNameChange={handleNameChange}
|
||||
handleSearch={handleSearch}
|
||||
handlePageChange={handlePageChange}
|
||||
createModelsChunkRequest={createModelsChunkRequest}
|
||||
queryParams={queryParams}
|
||||
loading={loading}
|
||||
total={total}
|
||||
fetchData={fetchData}
|
||||
></TableList>
|
||||
</TableContext.Provider>
|
||||
);
|
||||
|
||||
@@ -44,9 +44,8 @@ const ReferenceParams = (props: ReferenceParamsProps) => {
|
||||
</Tooltip>
|
||||
</span>
|
||||
|
||||
<span>
|
||||
<span className="usage">
|
||||
<Tooltip
|
||||
trigger={['click']}
|
||||
title={
|
||||
<Space>
|
||||
<span>
|
||||
|
||||
@@ -172,9 +172,13 @@ const GPUList: React.FC = () => {
|
||||
label={
|
||||
<span className="flex-column">
|
||||
<span>
|
||||
Total: {convertFileSize(record.memory?.total, 0)}
|
||||
{intl.formatMessage({ id: 'resources.table.total' })}:{' '}
|
||||
{convertFileSize(record.memory?.total, 0)}
|
||||
</span>
|
||||
<span>
|
||||
{intl.formatMessage({ id: 'resources.table.used' })}:{' '}
|
||||
{convertFileSize(record.memory?.used, 0)}
|
||||
</span>
|
||||
<span>Used: {convertFileSize(record.memory?.used, 0)}</span>
|
||||
</span>
|
||||
}
|
||||
></ProgressBar>
|
||||
|
||||
@@ -315,7 +315,7 @@ const Resources: React.FC = () => {
|
||||
className="m-r-5"
|
||||
style={{ display: 'flex', width: 25 }}
|
||||
>
|
||||
[{index}]
|
||||
[{item.index}]
|
||||
</span>
|
||||
<ProgressBar
|
||||
key={index}
|
||||
|
||||
Reference in New Issue
Block a user