@@ -14,9 +14,10 @@ import './forms.css';
1414
1515export  type  ResourceCalculatorProps  =  { 
1616  flowCollector : K8sResourceKind  |  null ; 
17+   setSampling ?: ( sampling : number )  =>  void ; 
1718} ; 
1819
19- export  const  Consumption : FC < ResourceCalculatorProps >  =  ( {  flowCollector } )  =>  { 
20+ export  const  Consumption : FC < ResourceCalculatorProps >  =  ( {  flowCollector,  setSampling  } )  =>  { 
2021  const  {  t }  =  useTranslation ( 'plugin__netobserv-plugin' ) ; 
2122
2223  const  [ receivedPackets ,  rpLoaded ,  rpError ]  =  usePrometheusPoll ( { 
@@ -64,8 +65,8 @@ export const Consumption: FC<ResourceCalculatorProps> = ({ flowCollector }) => {
6465        return  t ( 'n/a' ) ; 
6566      } 
6667      return  _ . uniq ( _ . map ( receivedPackets . data . result ,  r  =>  r . metric [ label ] ) ) . length ; 
67-       // eslint-disable-next-line react-hooks/exhaustive-deps 
6868    } , 
69+     // eslint-disable-next-line react-hooks/exhaustive-deps 
6970    [ receivedPackets ,  rpError ,  rpLoaded ] 
7071  ) ; 
7172
@@ -114,7 +115,13 @@ export const Consumption: FC<ResourceCalculatorProps> = ({ flowCollector }) => {
114115            { getSamplings ( ) . map ( ( sampling ,  i )  =>  { 
115116              const  current  =  getCurrentSampling ( )  ===  sampling ; 
116117              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+                 > 
118125                  < Td > { `${ sampling }   ${ current  ? t ( '(current)' )  : '' }  ` } </ Td > 
119126                  < Td > </ Td > 
120127                  < Td > </ Td > 
0 commit comments