33
44import { Icon } from '@iconify/react' ;
55import { useTranslation } from '@kinvolk/headlamp-plugin/lib' ;
6- import { Box , Grid , Typography } from '@mui/material' ;
6+ import { Box , Typography } from '@mui/material' ;
77import React from 'react' ;
88import type { DeploymentInfo } from '../hooks/useDeployments' ;
99import type { HPAInfo } from '../hooks/useHPAInfo' ;
@@ -19,14 +19,14 @@ interface ScalingMetricsProps {
1919
2020function MetricTile ( { label, value } : { label : string ; value : React . ReactNode } ) {
2121 return (
22- < Grid item xs = { 2.4 } >
22+ < Box sx = { { minWidth : '5rem' , flex : '1 1 5rem' } } >
2323 < Typography variant = "caption" color = "text.secondary" sx = { { display : 'block' } } >
2424 { label }
2525 </ Typography >
2626 < Typography variant = "body1" fontWeight = "bold" >
2727 { value }
2828 </ Typography >
29- </ Grid >
29+ </ Box >
3030 ) ;
3131}
3232
@@ -59,38 +59,36 @@ export const ScalingMetrics: React.FC<ScalingMetricsProps> = ({
5959 : currentDeployment ?. availableReplicas ?? 'N/A' ;
6060
6161 return (
62- < Box sx = { { mb : 2 } } >
63- < Grid container spacing = { 2 } >
64- { /* Scaling Mode */ }
65- < Grid item xs = { 2.4 } >
66- < Typography variant = "caption" color = "text.secondary" sx = { { display : 'block' } } >
67- { t ( 'Scaling Mode' ) }
62+ < Box sx = { { mb : 2 , display : 'flex' , flexWrap : 'wrap' , gap : 2 } } >
63+ { /* Scaling Mode */ }
64+ < Box sx = { { minWidth : '5rem' , flex : '1 1 5rem' } } >
65+ < Typography variant = "caption" color = "text.secondary" sx = { { display : 'block' } } >
66+ { t ( 'Scaling Mode' ) }
67+ </ Typography >
68+ < Box display = "flex" alignItems = "center" gap = { 0.5 } >
69+ < Icon
70+ icon = { hpaInfo ? 'mdi:autorenew' : 'mdi:account' }
71+ style = { { fontSize : 18 , flexShrink : 0 , color : hpaInfo ? '#66BB6A' : '#42A5F5' } }
72+ />
73+ < Typography variant = "body1" fontWeight = "bold" >
74+ { hpaInfo ? 'HPA' : t ( 'Manual' ) }
6875 </ Typography >
69- < Box display = "flex" alignItems = "center" gap = { 0.5 } >
70- < Icon
71- icon = { hpaInfo ? 'mdi:autorenew' : 'mdi:account' }
72- style = { { fontSize : 18 , flexShrink : 0 , color : hpaInfo ? '#66BB6A' : '#42A5F5' } }
73- />
74- < Typography variant = "body1" fontWeight = "bold" >
75- { hpaInfo ? 'HPA' : t ( 'Manual' ) }
76- </ Typography >
77- </ Box >
78- </ Grid >
76+ </ Box >
77+ </ Box >
7978
80- < MetricTile
81- label = { t ( 'Current Replicas' ) }
82- value = { hpaInfo ?. currentReplicas ?? currentDeployment ?. readyReplicas ?? 'N/A' }
83- />
84- < MetricTile
85- label = { hpaInfo ? t ( 'Desired Replicas' ) : t ( 'Configured Replicas' ) }
86- value = { hpaInfo ?. desiredReplicas ?? currentDeployment ?. replicas ?? 'N/A' }
87- />
88- < MetricTile
89- label = { hpaInfo ? t ( 'Replica Bounds' ) : t ( 'Available Replicas' ) }
90- value = { boundsValue }
91- />
92- < MetricTile label = { hpaInfo ? t ( 'CPU Usage / Target' ) : t ( 'CPU Usage' ) } value = { cpuValue } />
93- </ Grid >
79+ < MetricTile
80+ label = { t ( 'Current Replicas' ) }
81+ value = { hpaInfo ?. currentReplicas ?? currentDeployment ?. readyReplicas ?? 'N/A' }
82+ />
83+ < MetricTile
84+ label = { hpaInfo ? t ( 'Desired Replicas' ) : t ( 'Configured Replicas' ) }
85+ value = { hpaInfo ?. desiredReplicas ?? currentDeployment ?. replicas ?? 'N/A' }
86+ />
87+ < MetricTile
88+ label = { hpaInfo ? t ( 'Replica Bounds' ) : t ( 'Available Replicas' ) }
89+ value = { boundsValue }
90+ />
91+ < MetricTile label = { hpaInfo ? t ( 'CPU Usage / Target' ) : t ( 'CPU Usage' ) } value = { cpuValue } />
9492 </ Box >
9593 ) ;
9694} ;
0 commit comments