@@ -309,6 +309,14 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
309309 ` ) ;
310310
311311 const handleOk = ( ) => {
312+ // Manual validation for Prometheus preset (Form.Item has no name, so
313+ // Ant Design form validation does not cover it automatically)
314+ const currentMetricSource = formRef . current ?. getFieldValue ( 'metricSource' ) ;
315+ if ( currentMetricSource === 'PROMETHEUS' && ! selectedPresetId ) {
316+ message . error ( t ( 'autoScalingRule.PrometheusPresetRequired' ) ) ;
317+ return ;
318+ }
319+
312320 return formRef . current
313321 ?. validateFields ( )
314322 . then ( ( values ) => {
@@ -512,12 +520,18 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
512520 }
513521 } }
514522 options = { [
515- { label : 'Kernel' , value : 'KERNEL' } ,
516523 {
517- label : 'Inference Framework' ,
524+ label : t ( 'autoScalingRule.MetricSourceKernel' ) ,
525+ value : 'KERNEL' ,
526+ } ,
527+ {
528+ label : t ( 'autoScalingRule.MetricSourceInferenceFramework' ) ,
518529 value : 'INFERENCE_FRAMEWORK' ,
519530 } ,
520- { label : 'Prometheus' , value : 'PROMETHEUS' } ,
531+ {
532+ label : t ( 'autoScalingRule.MetricSourcePrometheus' ) ,
533+ value : 'PROMETHEUS' ,
534+ } ,
521535 ] }
522536 />
523537 </ Form . Item >
@@ -606,19 +620,17 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
606620 < Form . Item
607621 label = { t ( 'autoScalingRule.QueryTemplate' ) }
608622 extra = {
609- selectedPresetId ? (
610- < ErrorBoundaryWithNullFallback >
611- < React . Suspense
612- fallback = {
613- < Spin size = "small" style = { { marginRight : 8 } } />
614- }
615- >
616- < PrometheusPresetPreview
617- presetGlobalId = { selectedPresetId }
618- />
619- </ React . Suspense >
620- </ ErrorBoundaryWithNullFallback >
621- ) : undefined
623+ < ErrorBoundaryWithNullFallback >
624+ < React . Suspense
625+ fallback = {
626+ < Spin size = "small" style = { { marginRight : 8 } } />
627+ }
628+ >
629+ < PrometheusPresetPreview
630+ presetGlobalId = { selectedPreset . id }
631+ />
632+ </ React . Suspense >
633+ </ ErrorBoundaryWithNullFallback >
622634 }
623635 >
624636 < Typography . Text
0 commit comments