@@ -127,7 +127,7 @@ const Info = (props: IProps) => {
127127 initTargeting ( ) ;
128128 }
129129 } else {
130- message . success ( intl . formatMessage ( { id : 'targeting.approval.cancel.error' } ) ) ;
130+ message . error ( intl . formatMessage ( { id : 'targeting.approval.cancel.error' } ) ) ;
131131 }
132132 // Revoke approval
133133 } else if ( status === 'REVOKE' ) {
@@ -144,7 +144,7 @@ const Info = (props: IProps) => {
144144 initTargeting ( ) ;
145145 }
146146 } else {
147- message . success ( intl . formatMessage ( { id : 'targeting.approval.operate.error' } ) ) ;
147+ message . error ( intl . formatMessage ( { id : 'targeting.approval.operate.error' } ) ) ;
148148 }
149149 // Other operation
150150 } else {
@@ -157,7 +157,7 @@ const Info = (props: IProps) => {
157157 message . success ( intl . formatMessage ( { id : 'targeting.approval.operate.success' } ) ) ;
158158 initTargeting ( ) ;
159159 } else {
160- message . success ( intl . formatMessage ( { id : 'targeting.approval.operate.error' } ) ) ;
160+ message . error ( intl . formatMessage ( { id : 'targeting.approval.operate.error' } ) ) ;
161161 }
162162 }
163163 } , [ setValue , status , projectKey , environmentKey , toggleKey , comment , intl , isReEdit , refreshInitialTargeting , initTargeting ] ) ;
@@ -167,11 +167,12 @@ const Info = (props: IProps) => {
167167 const res = await cancelTargetingDraft ( projectKey , environmentKey , toggleKey , {
168168 comment : ''
169169 } ) ;
170+
170171 if ( res . success ) {
171172 initTargeting ( ) ;
172173 message . success ( intl . formatMessage ( { id : 'targeting.approval.operate.success' } ) ) ;
173174 } else {
174- message . success ( intl . formatMessage ( { id : 'targeting.approval.operate.error' } ) ) ;
175+ message . error ( intl . formatMessage ( { id : 'targeting.approval.operate.error' } ) ) ;
175176 }
176177 } , [ intl , projectKey , environmentKey , toggleKey , initTargeting ] ) ;
177178
@@ -194,7 +195,7 @@ const Info = (props: IProps) => {
194195 message . success ( intl . formatMessage ( { id : 'targeting.publish.success.text' } ) ) ;
195196 initTargeting ( ) ;
196197 } else {
197- message . success ( intl . formatMessage ( { id : 'targeting.publish.error.text' } ) ) ;
198+ message . error ( intl . formatMessage ( { id : 'targeting.publish.error.text' } ) ) ;
198199 }
199200 } ) ;
200201 } , [ intl , projectKey , environmentKey , toggleKey , initTargeting ] ) ;
@@ -412,31 +413,37 @@ const Info = (props: IProps) => {
412413 }
413414
414415 { /* Button Abandon */ }
415- { /* Button Publish */ }
416416 {
417417 (
418418 enableApproval &&
419419 ( toggleStatus === 'PASS' || toggleStatus === 'JUMP' ) &&
420420 ( approvalInfo ?. submitBy === userInfo . account || OWNER . includes ( userInfo . role ) )
421421 ) && (
422- < >
423- < Button
424- secondary
425- className = { styles [ 'dangerous-btn' ] }
426- onClick = { ( ) => {
427- saveOpen ( true ) ;
428- saveStatus ( 'CANCEL' ) ;
429- } }
430- >
431- < FormattedMessage id = 'targeting.approval.operation.abandon' />
432- </ Button >
433- < Button loading = { approvePublishLoading } disabled = { approvePublishLoading } primary className = { styles . btn } onClick = { handlePublish } >
434- < FormattedMessage id = 'targeting.approval.operation.publish' />
435- </ Button >
436- </ >
422+ < Button
423+ secondary
424+ className = { styles [ 'dangerous-btn' ] }
425+ onClick = { ( ) => {
426+ saveOpen ( true ) ;
427+ saveStatus ( 'CANCEL' ) ;
428+ } }
429+ >
430+ < FormattedMessage id = 'targeting.approval.operation.abandon' />
431+ </ Button >
437432 )
438433 }
439434
435+ { /* Button Publish */ }
436+ {
437+ (
438+ enableApproval &&
439+ ( toggleStatus === 'PASS' || toggleStatus === 'JUMP' ) &&
440+ ( approvalInfo ?. submitBy === userInfo . account )
441+ ) && (
442+ < Button loading = { approvePublishLoading } disabled = { approvePublishLoading } primary className = { styles . btn } onClick = { handlePublish } >
443+ < FormattedMessage id = 'targeting.approval.operation.publish' />
444+ </ Button >
445+ )
446+ }
440447
441448 { /* Button Abandon */ }
442449 { /* Button Modify */ }
0 commit comments