@@ -137,7 +137,7 @@ interface AutoScalingRuleListNodesProps extends Omit<
137137 isEndpointDestroying : boolean ;
138138 isOwnedByCurrentUser : boolean ;
139139 onEditRule : ( id : string ) => void ;
140- onDeleteRule : ( id : string ) => void ;
140+ onDeleteRule : ( id : string , metricName : string ) => void ;
141141}
142142
143143const AutoScalingRuleListNodes : React . FC < AutoScalingRuleListNodesProps > = ( {
@@ -211,7 +211,7 @@ const AutoScalingRuleListNodes: React.FC<AutoScalingRuleListNodesProps> = ({
211211 icon : < DeleteOutlined /> ,
212212 type : 'danger' ,
213213 disabled : isEndpointDestroying || ! isOwnedByCurrentUser ,
214- onClick : ( ) => onDeleteRule ( row . id ) ,
214+ onClick : ( ) => onDeleteRule ( row . id , row . metricName ?? '' ) ,
215215 } ,
216216 ] }
217217 />
@@ -320,12 +320,14 @@ interface AutoScalingRuleListProps {
320320 deploymentId : string ; // Relay global ID (e.g., toGlobalId('ModelDeployment', uuid))
321321 isEndpointDestroying : boolean ;
322322 isOwnedByCurrentUser : boolean ;
323+ fetchKey ?: string ;
323324}
324325
325326const AutoScalingRuleList : React . FC < AutoScalingRuleListProps > = ( {
326327 deploymentId,
327328 isEndpointDestroying,
328329 isOwnedByCurrentUser,
330+ fetchKey : parentFetchKey ,
329331} ) => {
330332 'use memo' ;
331333 const { t } = useTranslation ( ) ;
@@ -402,6 +404,7 @@ const AutoScalingRuleList: React.FC<AutoScalingRuleListProps> = ({
402404 edges {
403405 node {
404406 id
407+ metricName
405408 ...AutoScalingRuleListNodesFragment
406409 ...AutoScalingRuleEditorModalFragment
407410 }
@@ -413,7 +416,7 @@ const AutoScalingRuleList: React.FC<AutoScalingRuleListProps> = ({
413416 deferredQueryVariables ,
414417 {
415418 fetchPolicy : 'store-and-network' ,
416- fetchKey,
419+ fetchKey : parentFetchKey ? ` ${ parentFetchKey } _ ${ fetchKey } ` : fetchKey ,
417420 } ,
418421 ) ;
419422
@@ -470,33 +473,39 @@ const AutoScalingRuleList: React.FC<AutoScalingRuleListProps> = ({
470473 } ) ;
471474 } ;
472475
473- const handleDeleteRule = ( ruleId : string ) => {
476+ const handleDeleteRule = ( ruleId : string , metricName : string ) => {
474477 modal . confirm ( {
475478 title : t ( 'dialog.warning.CannotBeUndone' ) ,
479+ content : t ( 'autoScalingRule.ConfirmDeleteAutoScalingRule' , {
480+ autoScalingRule : metricName ,
481+ } ) ,
476482 okText : t ( 'button.Delete' ) ,
477483 okButtonProps : { danger : true } ,
478- onOk : ( ) => {
479- commitDeleteMutation ( {
480- variables : { input : { id : toLocalId ( ruleId ) } } ,
481- onCompleted : ( _res , errors ) => {
482- if ( errors && errors . length > 0 ) {
483- for ( const error of errors ) {
484- message . error ( error . message || t ( 'dialog.ErrorOccurred' ) ) ;
484+ onOk : ( ) =>
485+ new Promise < void > ( ( resolve , reject ) => {
486+ commitDeleteMutation ( {
487+ variables : { input : { id : toLocalId ( ruleId ) } } ,
488+ onCompleted : ( _res , errors ) => {
489+ if ( errors && errors . length > 0 ) {
490+ for ( const error of errors ) {
491+ message . error ( error . message || t ( 'dialog.ErrorOccurred' ) ) ;
492+ }
493+ reject ( ) ;
494+ } else {
495+ handleRefetch ( ) ;
496+ message . success ( {
497+ key : 'autoscaling-rule-deleted' ,
498+ content : t ( 'autoScalingRule.SuccessfullyDeleted' ) ,
499+ } ) ;
500+ resolve ( ) ;
485501 }
486- } else {
487- setEditingRuleId ( null ) ;
488- handleRefetch ( ) ;
489- message . success ( {
490- key : 'autoscaling-rule-deleted' ,
491- content : t ( 'autoScalingRule.SuccessfullyDeleted' ) ,
492- } ) ;
493- }
494- } ,
495- onError : ( error ) => {
496- message . error ( error ?. message || t ( 'dialog.ErrorOccurred' ) ) ;
497- } ,
498- } ) ;
499- } ,
502+ } ,
503+ onError : ( error ) => {
504+ message . error ( error ?. message || t ( 'dialog.ErrorOccurred' ) ) ;
505+ reject ( ) ;
506+ } ,
507+ } ) ;
508+ } ) ,
500509 } ) ;
501510 } ;
502511
0 commit comments