fix: watch api block

This commit is contained in:
jialin
2024-07-15 15:16:29 +08:00
parent 21e151ac28
commit cb4c984e96
7 changed files with 110 additions and 33 deletions
+12 -1
View File
@@ -19,6 +19,7 @@ import { PageContainer } from '@ant-design/pro-components';
import { Access, useAccess, useIntl, useNavigate } from '@umijs/max';
import { Button, Input, Modal, Space, message } from 'antd';
import dayjs from 'dayjs';
import _ from 'lodash';
import { memo, useCallback, useState } from 'react';
import {
MODELS_API,
@@ -101,6 +102,15 @@ const Models: React.FC<ModelsProps> = ({
}
];
const setActionList = (record: ListItem) => {
return _.filter(ActionList, (action: any) => {
if (action.key === 'chat') {
return record.ready_replicas > 0;
}
return true;
});
};
const handleTableChange = (pagination: any, filters: any, sorter: any) => {
console.log('handleTableChange=======', pagination, filters, sorter);
setSortOrder(sorter.order);
@@ -315,6 +325,7 @@ const Models: React.FC<ModelsProps> = ({
onExpand={handleExpandChange}
loading={loading}
rowKey="id"
childParentKey="model_id"
expandable={true}
onChange={handleTableChange}
pollingChildren={false}
@@ -388,7 +399,7 @@ const Models: React.FC<ModelsProps> = ({
render={(text, record) => {
return !record.transition ? (
<DropdownButtons
items={ActionList}
items={setActionList(record)}
onSelect={(val) => handleSelect(val, record)}
></DropdownButtons>
) : null;