@@ -5,8 +5,9 @@ import { EMPTY_TEXT_PLACEHOLDER } from 'shared/constants';
55import './MachineInfo.scss' ;
66
77export function MachineInfo ( { nodeInfo, capacity, addresses, spec, gpus } ) {
8- const formattedMemory =
9- Math . round ( ( parseInt ( capacity . memory ) / 1024 / 1024 ) * 10 ) / 10 ;
8+ const formattedMemory = capacity ?. memory
9+ ? Math . round ( ( parseInt ( capacity . memory ) / 1024 / 1024 ) * 10 ) / 10
10+ : 0 ;
1011 const { t } = useTranslation ( ) ;
1112
1213 return (
@@ -19,22 +20,22 @@ export function MachineInfo({ nodeInfo, capacity, addresses, spec, gpus }) {
1920 < DynamicPageComponent . Column
2021 title = { t ( 'node-details.machine-info.operating-system' ) }
2122 >
22- { `${ nodeInfo . operatingSystem } (${ nodeInfo . osImage } )` }
23+ { `${ nodeInfo ? .operatingSystem } (${ nodeInfo ? .osImage } )` }
2324 </ DynamicPageComponent . Column >
2425 < DynamicPageComponent . Column
2526 title = { t ( 'node-details.machine-info.provider' ) }
2627 >
27- { spec . providerID }
28+ { spec ? .providerID || EMPTY_TEXT_PLACEHOLDER }
2829 </ DynamicPageComponent . Column >
2930 < DynamicPageComponent . Column
3031 title = { t ( 'node-details.machine-info.architecture' ) }
3132 >
32- { nodeInfo . architecture }
33+ { nodeInfo ? .architecture || EMPTY_TEXT_PLACEHOLDER }
3334 </ DynamicPageComponent . Column >
3435 < DynamicPageComponent . Column
3536 title = { t ( 'node-details.machine-info.cpus' ) }
3637 >
37- { capacity . cpu }
38+ { capacity ? .cpu || EMPTY_TEXT_PLACEHOLDER }
3839 </ DynamicPageComponent . Column >
3940 { gpus > 0 && (
4041 < DynamicPageComponent . Column
@@ -51,26 +52,26 @@ export function MachineInfo({ nodeInfo, capacity, addresses, spec, gpus }) {
5152 < DynamicPageComponent . Column
5253 title = { t ( 'node-details.machine-info.pods-capacity' ) }
5354 >
54- { capacity . pods }
55+ { capacity ? .pods || EMPTY_TEXT_PLACEHOLDER }
5556 </ DynamicPageComponent . Column >
5657 < DynamicPageComponent . Column title = { t ( 'node-details.pod-cidr' ) } >
57- { spec . podCIDRs . join ( ',' ) }
58+ { spec ? .podCIDRs ? .join ( ',' ) || EMPTY_TEXT_PLACEHOLDER }
5859 </ DynamicPageComponent . Column >
5960 < DynamicPageComponent . Column
6061 title = { t ( 'node-details.machine-info.kubelet-version' ) }
6162 >
62- { nodeInfo . kubeletVersion }
63+ { nodeInfo ? .kubeletVersion || EMPTY_TEXT_PLACEHOLDER }
6364 </ DynamicPageComponent . Column >
6465 < DynamicPageComponent . Column
6566 title = { t ( 'node-details.machine-info.internal-ip' ) }
6667 >
67- { addresses . find ( ( a ) => a . type === 'InternalIP' ) ?. address ||
68+ { addresses ? .find ( ( a ) => a . type === 'InternalIP' ) ?. address ||
6869 EMPTY_TEXT_PLACEHOLDER }
6970 </ DynamicPageComponent . Column >
7071 < DynamicPageComponent . Column
7172 title = { t ( 'node-details.machine-info.hostname' ) }
7273 >
73- { addresses . find ( ( a ) => a . type === 'Hostname' ) . address ||
74+ { addresses ? .find ( ( a ) => a . type === 'Hostname' ) ? .address ||
7475 EMPTY_TEXT_PLACEHOLDER }
7576 </ DynamicPageComponent . Column >
7677 </ >
0 commit comments