@@ -14,9 +14,10 @@ import './forms.css';
14
14
15
15
export type ResourceCalculatorProps = {
16
16
flowCollector : K8sResourceKind | null ;
17
+ setSampling ?: ( sampling : number ) => void ;
17
18
} ;
18
19
19
- export const Consumption : FC < ResourceCalculatorProps > = ( { flowCollector } ) => {
20
+ export const Consumption : FC < ResourceCalculatorProps > = ( { flowCollector, setSampling } ) => {
20
21
const { t } = useTranslation ( 'plugin__netobserv-plugin' ) ;
21
22
22
23
const [ receivedPackets , rpLoaded , rpError ] = usePrometheusPoll ( {
@@ -64,8 +65,8 @@ export const Consumption: FC<ResourceCalculatorProps> = ({ flowCollector }) => {
64
65
return t ( 'n/a' ) ;
65
66
}
66
67
return _ . uniq ( _ . map ( receivedPackets . data . result , r => r . metric [ label ] ) ) . length ;
67
- // eslint-disable-next-line react-hooks/exhaustive-deps
68
68
} ,
69
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
70
[ receivedPackets , rpError , rpLoaded ]
70
71
) ;
71
72
@@ -114,7 +115,13 @@ export const Consumption: FC<ResourceCalculatorProps> = ({ flowCollector }) => {
114
115
{ getSamplings ( ) . map ( ( sampling , i ) => {
115
116
const current = getCurrentSampling ( ) === sampling ;
116
117
return (
117
- < Tr key = { i } isRowSelected = { current } >
118
+ < Tr
119
+ key = { i }
120
+ isSelectable = { setSampling !== undefined }
121
+ isClickable = { setSampling !== undefined }
122
+ isRowSelected = { current }
123
+ onClick = { ( ) => setSampling && setSampling ( sampling ) }
124
+ >
118
125
< Td > { `${ sampling } ${ current ? t ( '(current)' ) : '' } ` } </ Td >
119
126
< Td > </ Td >
120
127
< Td > </ Td >
0 commit comments