@@ -157,7 +157,7 @@ export const PortsFormatter: React.FC<PortsFormatterProps> = ({ data }) => {
157157 { data ?. map ( ( item , index ) => (
158158 < Details noPadding key = { index } >
159159 < Box display = "flex" alignItems = "center" >
160- < Typography variant = "body1" > { `${ item . name } : ` } </ Typography >
160+ { item . name && < Typography variant = "body1" > { `${ item . name } : ` } </ Typography > }
161161 < ElementData > { `(${ item . containerPort || item . port } /${ item . protocol } )` } </ ElementData >
162162 </ Box >
163163 </ Details >
@@ -580,8 +580,9 @@ export const ContainerFormatter: React.FC<ContainerFormatterProps> = ({
580580 containerSpec,
581581 containerStatus
582582} ) => {
583- const status = _ . capitalize ( Object . keys ( containerStatus . state ) [ 0 ] ) ;
584- const stateValues = Object . values ( containerStatus . state ) [ 0 ] ;
583+ const state = containerStatus ?. state || { } ;
584+ const status = _ . capitalize ( Object . keys ( state ) ?. [ 0 ] || 'unknown' ) ;
585+ const stateValues = Object . values ( state ) ?. [ 0 ] || { } ;
585586 const startedAt = stateValues ? stateValues ?. startedAt : null ;
586587 return (
587588 < Box display = "flex" flexDirection = "column" gap = { '0.5rem' } >
@@ -601,89 +602,89 @@ export const ContainerFormatter: React.FC<ContainerFormatterProps> = ({
601602 />
602603 < DetailSection
603604 title = "Image Pull Policy"
604- data = { containerSpec . imagePullPolicy }
605+ data = { containerSpec ? .imagePullPolicy }
605606 formatter = { ( { data } ) => < Typography variant = "body1" > { data } </ Typography > }
606607 />
607608
608609 < DetailSection
609610 title = "Total Restarts"
610- data = { containerStatus . restartCount }
611+ data = { containerStatus ? .restartCount }
611612 formatter = { ( { data } ) => < NumberState value = { data } quantity = "times" /> }
612613 />
613614
614615 < DetailSection
615616 title = "Image"
616- data = { containerSpec . image }
617+ data = { containerSpec ? .image }
617618 formatter = { ( { data } ) => < StyledChip label = { data } size = "small" /> }
618619 />
619620 < DetailSection
620621 title = "Container"
621- data = { containerStatus . containerID }
622+ data = { containerStatus ? .containerID }
622623 formatter = { ( { data } ) => < StyledChip label = { data } size = "small" /> }
623624 />
624625
625626 < DetailSection
626627 title = "Environment Variables"
627- data = { containerSpec . env }
628+ data = { containerSpec ? .env }
628629 formatter = { EnvironmentFormatter }
629630 />
630631
631632 < KeyValueInRow
632633 Key = "Volume Mounts"
633634 Value = {
634635 < Box display = { 'flex' } flexDirection = { 'column' } gap = { 1 } >
635- { containerSpec . volumeMounts ?. map ( ( item , index ) => {
636- const roStatus = item . readOnly ? ' (RO)' : ' (RW)' ;
636+ { containerSpec ? .volumeMounts ?. map ( ( item , index ) => {
637+ const roStatus = item ? .readOnly ? ' (RO)' : ' (RW)' ;
637638 return (
638639 < Box display = { 'flex' } key = { index } flexWrap = { 'wrap' } gap = { '0.25rem 0.5rem' } >
639640 < ElementData key = { index } >
640- < StyledChip label = { item . mountPath } size = "small" />
641+ < StyledChip label = { item ? .mountPath } size = "small" />
641642 </ ElementData >
642643 < ElementData >
643- < Typography variant = "body1" > { `from ${ item . name } ${ roStatus } ` } </ Typography >
644+ < Typography variant = "body1" > { `from ${ item ? .name } ${ roStatus } ` } </ Typography >
644645 </ ElementData >
645646 </ Box >
646647 ) ;
647648 } ) }
648649 </ Box >
649650 }
650651 />
651- { containerSpec . command && (
652+ { containerSpec ? .command && (
652653 < DetailSection title = "Command" data = { containerSpec . command } formatter = { CodeFormatter } />
653654 ) }
654- { containerSpec . livenessProbe && (
655+ { containerSpec ? .livenessProbe && (
655656 < DetailSection
656657 title = "Liveness Probe"
657658 data = { containerSpec . livenessProbe }
658659 formatter = { CodeFormatter }
659660 />
660661 ) }
661- { containerSpec . readinessProbe && (
662+ { containerSpec ? .readinessProbe && (
662663 < DetailSection
663664 title = "Readiness Probe"
664- data = { containerSpec . readinessProbe }
665+ data = { containerSpec ? .readinessProbe }
665666 formatter = { CodeFormatter }
666667 />
667668 ) }
668- { containerSpec . startupProbe && (
669+ { containerSpec ? .startupProbe && (
669670 < DetailSection
670671 title = "Startup Probe"
671- data = { containerSpec . startupProbe }
672+ data = { containerSpec ? .startupProbe }
672673 formatter = { CodeFormatter }
673674 />
674675 ) }
675- < DetailSection title = "Arguments" data = { containerSpec . args } formatter = { CodeFormatter } />
676+ < DetailSection title = "Arguments" data = { containerSpec ? .args } formatter = { CodeFormatter } />
676677 { containerSpec . resources ?. requests && (
677678 < DetailSection
678679 title = "Resources"
679- data = { containerSpec . resources . requests }
680+ data = { containerSpec ? .resources ? .requests }
680681 formatter = { CodeFormatter }
681682 />
682683 ) }
683- { containerSpec . resources ?. limits && (
684+ { containerSpec ? .resources ?. limits && (
684685 < DetailSection
685686 title = "Limits"
686- data = { containerSpec . resources . limits }
687+ data = { containerSpec ? .resources ? .limits }
687688 formatter = { CodeFormatter }
688689 />
689690 ) }
0 commit comments