fix: update allChildren after stop or start

main
jialin 8 months ago
parent 034a54bf4b
commit f53fe042a9

@ -41,7 +41,6 @@ const TableRow: React.FC<
} = props;
const tableContext: any = React.useContext<{
allChildren?: any[];
allSubChildren?: any[];
setDisableExpand?: (record: any) => boolean;
}>(TableContext);
const { setChunkRequest } = useSetChunkRequest();

@ -55,7 +55,7 @@ export default function useTableFetch<ListItem>(
const { setChunkRequest } = useSetChunkRequest();
const { updateChunkedList, cacheDataListRef } = useUpdateChunkedList({
events: ['UPDATE', 'DELETE'],
events: ['UPDATE', 'DELETE', 'INSERT'],
dataList: dataSource.dataList,
setDataList(list, opts?: any) {
setDataSource((pre) => {

@ -478,9 +478,6 @@ const Models: React.FC<ModelsProps> = ({
await handleStartModel(row);
message.success(intl.formatMessage({ id: 'common.message.success' }));
updateExpandedRowKeys([row.id, ...expandedRowKeys]);
setTimeout(() => {
handleSearch?.();
}, 150);
}
if (val === 'api') {
@ -496,9 +493,6 @@ const Models: React.FC<ModelsProps> = ({
name: row.name,
async onOk() {
await handleStopModel(row);
setTimeout(() => {
handleSearch?.();
}, 150);
}
});
}

@ -85,16 +85,14 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
const handleOnValuesChange = _.debounce((data: any) => {
const formdata = form.getFieldsValue?.();
console.log('handleOnValuesChange:', formdata);
let alldata = {};
if (formdata.scheduleType === 'manual') {
alldata = {
..._.omit(formdata, ['worker_selector']),
env: formdata.env || originFormData.current?.env || null,
gpu_selector:
formdata.gpu_selector?.gpu_ids?.length > 0
? originFormData.current?.gpu_selector
: null
gpu_selector: formdata.gpu_selector
};
} else {
alldata = {

@ -202,14 +202,7 @@ export const useGenerateModelFileOptions = () => {
Object.entries(worker).filter(([key]) => workerFields.has(key))
)
}));
// extract a list from the result, and the structure is like:
// [
// {
// label: 'worker_name/child_label',
// value: 'child_value',
// ...other child properties
// }
// ]
const childrenList = result.reduce((acc: any[], cur) => {
if (cur.children) {
const list = cur.children.map((child: any) => ({
@ -223,8 +216,6 @@ export const useGenerateModelFileOptions = () => {
}, []);
return childrenList;
// return result;
};
return {

@ -252,10 +252,14 @@ const Models: React.FC = () => {
});
}, [fetchData, createModelsChunkRequest, createModelsInstanceChunkRequest]);
const handleOnStop = useCallback((ids: number[]) => {
const handleOnStop = useCallback(async (ids: number[]) => {
cacheInsDataListRef.current = cacheInsDataListRef.current.filter(
(item: any) => !ids.includes(item.model_id)
);
await new Promise((resolve) => {
setTimeout(resolve, 300);
});
setModelInstances(cacheInsDataListRef.current);
}, []);
const handleSearch = useCallback(async () => {

@ -602,7 +602,7 @@ const ModelFiles = () => {
{
title: intl.formatMessage({ id: 'resources.modelfiles.size' }),
dataIndex: 'size',
width: 100,
width: 110,
align: 'right',
ellipsis: {
showTitle: false

Loading…
Cancel
Save