From 2e00309b4055d77817fb7a46b49420a08627dee5 Mon Sep 17 00:00:00 2001 From: jialin Date: Fri, 16 Aug 2024 13:35:14 +0800 Subject: [PATCH] fix: workers map parameters null --- src/pages/resources/components/gpus.tsx | 2 +- src/pages/resources/components/workers.tsx | 50 ++++++++++++---------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/pages/resources/components/gpus.tsx b/src/pages/resources/components/gpus.tsx index e7d011e5..b1698e5f 100644 --- a/src/pages/resources/components/gpus.tsx +++ b/src/pages/resources/components/gpus.tsx @@ -183,7 +183,7 @@ const GPUList: React.FC = () => { render={(text, record: GPUDeviceItem) => { return ( diff --git a/src/pages/resources/components/workers.tsx b/src/pages/resources/components/workers.tsx index f2192bd7..b400c913 100644 --- a/src/pages/resources/components/workers.tsx +++ b/src/pages/resources/components/workers.tsx @@ -254,7 +254,7 @@ const Resources: React.FC = () => { render={(text, record: ListItem) => { return ( ); }} @@ -267,18 +267,18 @@ const Resources: React.FC = () => { return ( {intl.formatMessage({ id: 'resources.table.total' })}:{' '} - {convertFileSize(record?.status?.memory.total, 0)} + {convertFileSize(record?.status?.memory?.total, 0)} {intl.formatMessage({ id: 'resources.table.used' })}:{' '} - {convertFileSize(record?.status?.memory.used, 0)} + {convertFileSize(record?.status?.memory?.used, 0)} } @@ -293,22 +293,25 @@ const Resources: React.FC = () => { render={(text, record: ListItem) => { return ( - {record?.status?.gpu_devices.map((item, index) => { - return ( - - - [{item.index}] + {_.map( + record?.status?.gpu_devices, + (item: GPUDeviceItem, index: string) => { + return ( + + + [{item.index}] + + - - - ); - })} + ); + } + )} ); }} @@ -321,8 +324,9 @@ const Resources: React.FC = () => { render={(text, record: ListItem) => { return ( - {record?.status?.gpu_devices.map( - (item: GPUDeviceItem, index) => { + {_.map( + record?.status?.gpu_devices, + (item: GPUDeviceItem, index: string) => { return ( @@ -334,7 +338,7 @@ const Resources: React.FC = () => {