@@ -12,6 +12,7 @@ import RollingTimePicker from "Common/UI/Components/RollingTimePicker/RollingTim
1212import RollingTimeUtil from "Common/Types/RollingTime/RollingTimeUtil" ;
1313import FieldLabelElement from "Common/UI/Components/Forms/Fields/FieldLabel" ;
1414import MetricViewData from "Common/Types/Metrics/MetricViewData" ;
15+ import MetricQueryConfigData from "Common/Types/Metrics/MetricQueryConfigData" ;
1516import Dropdown , {
1617 DropdownOption ,
1718 DropdownValue ,
@@ -42,7 +43,6 @@ export interface ComponentProps {
4243 onChange : (
4344 monitorStepKubernetesMonitor : MonitorStepKubernetesMonitor ,
4445 ) => void ;
45- onMonitorStepOverride ?: ( ( step : MonitorStep ) => void ) | undefined ;
4646 onModeChange ?: ( ( mode : KubernetesFormMode ) => void ) | undefined ;
4747 initialTemplateId ?: string | undefined ;
4848 initialClusterId ?: string | undefined ;
@@ -92,7 +92,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
9292 Navigation . getQueryStringByName ( "clusterId" ) ||
9393 undefined ;
9494
95- const [ _mode , setMode ] = React . useState < KubernetesFormMode > ( "quick" ) ;
95+ const [ , setMode ] = React . useState < KubernetesFormMode > ( "quick" ) ;
9696
9797 const [ rollingTime , setRollingTime ] = React . useState < RollingTime | null > (
9898 null ,
@@ -109,8 +109,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
109109 Array < DropdownOption >
110110 > ( [ ] ) ;
111111
112- const [ _isLoadingClusters , setIsLoadingClusters ] =
113- React . useState < boolean > ( true ) ;
112+ const [ , setIsLoadingClusters ] = React . useState < boolean > ( true ) ;
114113
115114 // Quick Setup state
116115 const [ selectedTemplateId , setSelectedTemplateId ] = React . useState <
@@ -155,12 +154,11 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
155154 setClusterOptions ( options ) ;
156155
157156 // Auto-select cluster if initialClusterId or URL param is provided
158- if (
159- urlClusterId &&
160- ! monitorStepKubernetesMonitor . clusterIdentifier
161- ) {
157+ if ( urlClusterId && ! monitorStepKubernetesMonitor . clusterIdentifier ) {
162158 const matchedCluster : DropdownOption | undefined = options . find (
163- ( o : DropdownOption ) => o . value === urlClusterId ,
159+ ( o : DropdownOption ) => {
160+ return o . value === urlClusterId ;
161+ } ,
164162 ) ;
165163 if ( matchedCluster ) {
166164 props . onChange ( {
@@ -211,13 +209,15 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
211209 ) ;
212210 } , [ ] ) ;
213211
214- const handleTemplateSelection = (
212+ const handleTemplateSelection : ( template : KubernetesAlertTemplate ) => void = (
215213 template : KubernetesAlertTemplate ,
216214 ) : void => {
217215 setSelectedTemplateId ( template . id ) ;
218216
219- // Build the kubernetes monitor config from the template's getMonitorStep
220- // We need the cluster identifier to build the config
217+ /*
218+ * Build the kubernetes monitor config from the template's getMonitorStep
219+ * We need the cluster identifier to build the config
220+ */
221221 const clusterIdentifier : string =
222222 monitorStepKubernetesMonitor . clusterIdentifier ;
223223
@@ -245,9 +245,9 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
245245 }
246246 } ;
247247
248- const handleCustomMetricSelection = (
248+ const handleCustomMetricSelection : (
249249 metric : KubernetesMetricDefinition ,
250- ) : void => {
250+ ) => void = ( metric : KubernetesMetricDefinition ) : void => {
251251 setSelectedMetricId ( metric . id ) ;
252252 setCustomAggregation ( metric . defaultAggregation ) ;
253253 setCustomResourceScope ( metric . defaultResourceScope ) ;
@@ -273,22 +273,19 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
273273 KubernetesResourceScope . Namespace ||
274274 monitorStepKubernetesMonitor . resourceScope ===
275275 KubernetesResourceScope . Workload ||
276- monitorStepKubernetesMonitor . resourceScope ===
277- KubernetesResourceScope . Pod ;
276+ monitorStepKubernetesMonitor . resourceScope === KubernetesResourceScope . Pod ;
278277
279278 const showWorkloadFilter : boolean =
280279 monitorStepKubernetesMonitor . resourceScope ===
281280 KubernetesResourceScope . Workload ;
282281
283282 const showNodeFilter : boolean =
284- monitorStepKubernetesMonitor . resourceScope ===
285- KubernetesResourceScope . Node ;
283+ monitorStepKubernetesMonitor . resourceScope === KubernetesResourceScope . Node ;
286284
287285 const showPodFilter : boolean =
288- monitorStepKubernetesMonitor . resourceScope ===
289- KubernetesResourceScope . Pod ;
286+ monitorStepKubernetesMonitor . resourceScope === KubernetesResourceScope . Pod ;
290287
291- const renderClusterDropdown = ( ) : ReactElement => {
288+ const renderClusterDropdown : ( ) => ReactElement = ( ) : ReactElement => {
292289 return (
293290 < div className = "mb-4" >
294291 < FieldLabelElement
@@ -298,10 +295,11 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
298295 />
299296 < Dropdown
300297 options = { clusterOptions }
301- value = { clusterOptions . find (
302- ( option : DropdownOption ) =>
303- option . value === monitorStepKubernetesMonitor . clusterIdentifier ,
304- ) }
298+ value = { clusterOptions . find ( ( option : DropdownOption ) => {
299+ return (
300+ option . value === monitorStepKubernetesMonitor . clusterIdentifier
301+ ) ;
302+ } ) }
305303 onChange = { ( value : DropdownValue | Array < DropdownValue > | null ) => {
306304 props . onChange ( {
307305 ...monitorStepKubernetesMonitor ,
@@ -314,7 +312,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
314312 ) ;
315313 } ;
316314
317- const renderResourceFilters = ( ) : ReactElement => {
315+ const renderResourceFilters : ( ) => ReactElement = ( ) : ReactElement => {
318316 return (
319317 < >
320318 { showNamespaceFilter && (
@@ -400,9 +398,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
400398 required = { false }
401399 />
402400 < Input
403- value = {
404- monitorStepKubernetesMonitor . resourceFilters . podName || ""
405- }
401+ value = { monitorStepKubernetesMonitor . resourceFilters . podName || "" }
406402 onChange = { ( value : string ) => {
407403 props . onChange ( {
408404 ...monitorStepKubernetesMonitor ,
@@ -420,7 +416,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
420416 ) ;
421417 } ;
422418
423- const renderQuickSetup = ( ) : ReactElement => {
419+ const renderQuickSetup : ( ) => ReactElement = ( ) : ReactElement => {
424420 return (
425421 < div className = "mt-4" >
426422 < KubernetesTemplatePicker
@@ -464,7 +460,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
464460 ) ;
465461 } ;
466462
467- const renderCustomMetric = ( ) : ReactElement => {
463+ const renderCustomMetric : ( ) => ReactElement = ( ) : ReactElement => {
468464 return (
469465 < div className = "mt-4 space-y-4" >
470466 < div >
@@ -493,10 +489,9 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
493489 />
494490 < Dropdown
495491 options = { resourceScopeOptions }
496- value = { resourceScopeOptions . find (
497- ( option : DropdownOption ) =>
498- option . value === customResourceScope ,
499- ) }
492+ value = { resourceScopeOptions . find ( ( option : DropdownOption ) => {
493+ return option . value === customResourceScope ;
494+ } ) }
500495 onChange = { (
501496 value : DropdownValue | Array < DropdownValue > | null ,
502497 ) => {
@@ -526,10 +521,9 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
526521 />
527522 < Dropdown
528523 options = { aggregationOptions }
529- value = { aggregationOptions . find (
530- ( option : DropdownOption ) =>
531- option . value === customAggregation ,
532- ) }
524+ value = { aggregationOptions . find ( ( option : DropdownOption ) => {
525+ return option . value === customAggregation ;
526+ } ) }
533527 onChange = { (
534528 value : DropdownValue | Array < DropdownValue > | null ,
535529 ) => {
@@ -543,9 +537,9 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
543537 monitorStepKubernetesMonitor . metricViewConfig . queryConfigs
544538 . length > 0
545539 ) {
546- const currentQueryConfig =
540+ const currentQueryConfig : MetricQueryConfigData =
547541 monitorStepKubernetesMonitor . metricViewConfig
548- . queryConfigs [ 0 ] ;
542+ . queryConfigs [ 0 ] ! ;
549543 if ( currentQueryConfig ) {
550544 props . onChange ( {
551545 ...monitorStepKubernetesMonitor ,
@@ -601,7 +595,7 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
601595 ) ;
602596 } ;
603597
604- const renderAdvanced = ( ) : ReactElement => {
598+ const renderAdvanced : ( ) => ReactElement = ( ) : ReactElement => {
605599 return (
606600 < div className = "mt-4" >
607601 < div >
@@ -612,10 +606,11 @@ const KubernetesMonitorStepForm: FunctionComponent<ComponentProps> = (
612606 />
613607 < Dropdown
614608 options = { resourceScopeOptions }
615- value = { resourceScopeOptions . find (
616- ( option : DropdownOption ) =>
617- option . value === monitorStepKubernetesMonitor . resourceScope ,
618- ) }
609+ value = { resourceScopeOptions . find ( ( option : DropdownOption ) => {
610+ return (
611+ option . value === monitorStepKubernetesMonitor . resourceScope
612+ ) ;
613+ } ) }
619614 onChange = { ( value : DropdownValue | Array < DropdownValue > | null ) => {
620615 props . onChange ( {
621616 ...monitorStepKubernetesMonitor ,
0 commit comments