@@ -59,12 +59,6 @@ import {
5959} from './types' ;
6060import { parseCpu , splitCamelCaseString } from './utils' ;
6161
62- interface ResourceProgressProps {
63- title : string ;
64- percentage : number ;
65- type : string ;
66- }
67-
6862interface StatusColorType {
6963 background : string ;
7064 text : string ;
@@ -427,8 +421,8 @@ export const MemoryUsage: React.FC<MemoryUsageProps> = ({
427421 [ height , width ]
428422 ) ;
429423
430- const ResourceProgress = useCallback < React . FC < ResourceProgressProps > > (
431- ( { title, percentage, type } ) => (
424+ const renderResourceProgress = useCallback (
425+ ( title : string , percentage : number , type : string ) => (
432426 < ResourceProgressContainer >
433427 < Typography variant = "body1" > { title } </ Typography >
434428 < BBChart options = { chartOptions ( percentage , type ) } />
@@ -443,9 +437,9 @@ export const MemoryUsage: React.FC<MemoryUsageProps> = ({
443437
444438 return (
445439 < FlexResourceContainer >
446- < ResourceProgress title = " System Reserved Cpu" percentage = { reservedCpu } type = { 'CPU' } />
447- < ResourceProgress title = " Memory Usage" percentage = { memoryUsage } type = { 'Memory' } />
448- < ResourceProgress title = " Disk Usage" percentage = { diskUsagePercent } type = { 'Disk' } />
440+ { renderResourceProgress ( ' System Reserved Cpu' , reservedCpu , 'CPU' ) }
441+ { renderResourceProgress ( ' Memory Usage' , memoryUsage , 'Memory' ) }
442+ { renderResourceProgress ( ' Disk Usage' , diskUsagePercent , 'Disk' ) }
449443 </ FlexResourceContainer >
450444 ) ;
451445} ;
0 commit comments