fix: refresh model list manually
This commit is contained in:
@@ -27,6 +27,8 @@ const RequestTokenInner: React.FC<RequestTokenInnerProps> = (props) => {
|
||||
const { requestData, tokenData, xAxisData } = props;
|
||||
const intl = useIntl();
|
||||
|
||||
console.log('usage===========', requestData, tokenData, xAxisData);
|
||||
|
||||
return (
|
||||
<CardWrapper style={{ width: '100%' }}>
|
||||
<Row style={{ width: '100%' }}>
|
||||
@@ -49,6 +51,17 @@ const RequestTokenInner: React.FC<RequestTokenInnerProps> = (props) => {
|
||||
></BarChart>
|
||||
</Col>
|
||||
</Row>
|
||||
{/* <MixLineBar
|
||||
title={intl.formatMessage({ id: 'dashboard.apirequest' })}
|
||||
chartData={{
|
||||
line: requestData,
|
||||
bar: tokenData
|
||||
}}
|
||||
seriesData={[]}
|
||||
xAxisData={xAxisData}
|
||||
height={360}
|
||||
labelFormatter={labelFormatter}
|
||||
></MixLineBar> */}
|
||||
</CardWrapper>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PageContainer } from '@ant-design/pro-components';
|
||||
import { Spin } from 'antd';
|
||||
import { memo, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import DashboardInner from './components/dahboard-inner';
|
||||
|
||||
const Dashboard: React.FC = () => {
|
||||
@@ -25,4 +25,4 @@ const Dashboard: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(Dashboard);
|
||||
export default Dashboard;
|
||||
|
||||
@@ -84,7 +84,7 @@ import ModelTag from './model-tag';
|
||||
import UpdateModel from './update-modal';
|
||||
import ViewLogsModal from './view-logs-modal';
|
||||
interface ModelsProps {
|
||||
handleSearch: () => void;
|
||||
handleSearch: (params?: any) => void;
|
||||
handleNameChange: (e: any) => void;
|
||||
handleShowSizeChange?: (page: number, size: number) => void;
|
||||
handlePageChange: (page: number, pageSize: number | undefined) => void;
|
||||
@@ -94,6 +94,7 @@ interface ModelsProps {
|
||||
onCancelViewLogs: () => void;
|
||||
handleOnToggleExpandAll: () => void;
|
||||
onStop?: (ids: number[]) => void;
|
||||
onStart?: () => void;
|
||||
queryParams: {
|
||||
page: number;
|
||||
perPage: number;
|
||||
@@ -134,6 +135,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
handleCategoryChange,
|
||||
handleOnToggleExpandAll,
|
||||
onStop,
|
||||
onStart,
|
||||
modelFileOptions,
|
||||
deleteIds,
|
||||
dataSource,
|
||||
@@ -262,7 +264,6 @@ const Models: React.FC<ModelsProps> = ({
|
||||
const handleStopModel = async (row: ListItem) => {
|
||||
await updateModel(getFormattedData(row, { replicas: 0 }));
|
||||
removeExpandedRowKey([row.id]);
|
||||
onStop?.([row.id]);
|
||||
};
|
||||
|
||||
const handleModalOk = useCallback(
|
||||
@@ -478,6 +479,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
await handleStartModel(row);
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
updateExpandedRowKeys([row.id, ...expandedRowKeys]);
|
||||
onStart?.();
|
||||
}
|
||||
|
||||
if (val === 'api') {
|
||||
@@ -493,6 +495,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
name: row.name,
|
||||
async onOk() {
|
||||
await handleStopModel(row);
|
||||
onStop?.([row.id]);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -560,6 +563,7 @@ const Models: React.FC<ModelsProps> = ({
|
||||
async onOk() {
|
||||
await handleBatchRequest(rowSelection.selectedRows, handleStartModel);
|
||||
rowSelection.clearSelections();
|
||||
onStart?.();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -260,11 +260,23 @@ const Models: React.FC = () => {
|
||||
setTimeout(resolve, 300);
|
||||
});
|
||||
setModelInstances(cacheInsDataListRef.current);
|
||||
fetchData({
|
||||
loadingVal: false
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleSearch = useCallback(async () => {
|
||||
await fetchData();
|
||||
}, [fetchData]);
|
||||
const handleOnStart = useCallback(() => {
|
||||
fetchData({
|
||||
loadingVal: false
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleSearch = useCallback(
|
||||
async (params?: any) => {
|
||||
await fetchData(params);
|
||||
},
|
||||
[fetchData]
|
||||
);
|
||||
|
||||
const debounceUpdateFilter = _.debounce((e: any) => {
|
||||
setQueryParams({
|
||||
@@ -469,6 +481,7 @@ const Models: React.FC = () => {
|
||||
onViewLogs={handleOnViewLogs}
|
||||
onCancelViewLogs={handleOnCancelViewLogs}
|
||||
onStop={handleOnStop}
|
||||
onStart={handleOnStart}
|
||||
queryParams={queryParams}
|
||||
loading={dataSource.loading}
|
||||
loadend={dataSource.loadend}
|
||||
|
||||
Reference in New Issue
Block a user