Skip to content

Commit

Permalink
fix: model instances limit
Browse files Browse the repository at this point in the history
  • Loading branch information
hibig committed Oct 18, 2024
1 parent 594c4cd commit b9c9fe7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const isProduction = env === 'production';
const t = Date.now();
export default defineConfig({
proxy: {
...proxy()
...proxy('http://192.168.50.166:8080')
},
history: {
type: 'hash'
Expand Down
3 changes: 2 additions & 1 deletion src/components/seal-table/components/table-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const TableRow: React.FC<

const { updateChunkedList, cacheDataListRef } = useUpdateChunkedList({
dataList: childrenData,
limit: 100,
setDataList: setChildrenData
// callback: (list) => renderChildren?.(list)
});
Expand Down Expand Up @@ -118,7 +119,7 @@ const TableRow: React.FC<

const updateChildrenHandler = (list: any) => {
_.each(list, (data: any) => {
updateChunkedList(data, childrenDataRef.current);
updateChunkedList(data);
});
};

Expand Down
6 changes: 4 additions & 2 deletions src/hooks/use-update-chunk-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface ChunkedCollection {
// Only used to update lists without nested state
export function useUpdateChunkedList(options: {
dataList?: any[];
limit?: number;
setDataList: (args: any) => void;
callback?: (args: any) => void;
filterFun?: (args: any) => boolean;
Expand All @@ -19,6 +20,7 @@ export function useUpdateChunkedList(options: {
const cacheDataListRef = useRef<any[]>(options.dataList || []);
const timerRef = useRef<any>(null);
const countRef = useRef<number>(0);
const limit = options.limit || 10;

useEffect(() => {
cacheDataListRef.current = [...(options.dataList || [])];
Expand Down Expand Up @@ -68,7 +70,7 @@ export function useUpdateChunkedList(options: {
cacheDataListRef.current = [
...newDataList,
...cacheDataListRef.current
].slice(0, 10);
].slice(0, limit);
}
// DELETE
if (data?.type === WatchEventType.DELETE) {
Expand All @@ -91,7 +93,7 @@ export function useUpdateChunkedList(options: {
} else if (updateIndex === -1) {
cacheDataListRef.current = [
updateItem,
...cacheDataListRef.current.slice(0, 9)
...cacheDataListRef.current.slice(0, limit - 1)
];
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/pages/resources/components/gpus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ const GPUList: React.FC = () => {
return <span>{text ? _.round(text, 1) : '-'}</span>;
}}
/>
<Column
{/* <Column
title={intl.formatMessage({ id: 'resources.table.core' })}
dataIndex="core"
key="Core"
render={(text, record: GPUDeviceItem) => {
return <span>{record.core?.total}</span>;
}}
/>
/> */}
<Column
title={intl.formatMessage({ id: 'resources.table.gpuutilization' })}
dataIndex="gpuUtil"
Expand Down

0 comments on commit b9c9fe7

Please sign in to comment.