@@ -30,6 +30,7 @@ import {
3030 CopyOutlined ,
3131 EyeOutlined ,
3232 RedoOutlined ,
33+ LoadingOutlined ,
3334 UpOutlined ,
3435 DownOutlined ,
3536 MinusOutlined ,
@@ -216,6 +217,7 @@ const Runhistory = () => {
216217 project_id : "" ,
217218 } ) ;
218219 const orgId = selectedOrgId || "default_org" ;
220+ const [ retryLoading , setRetryLoading ] = useState ( false ) ;
219221
220222 /* ── APIs ── */
221223 const fetchStats = useCallback (
@@ -363,6 +365,8 @@ const Runhistory = () => {
363365 }
364366 } ;
365367 const handleRetry = async ( taskId ) => {
368+ if ( retryLoading ) return ;
369+ setRetryLoading ( true ) ;
366370 try {
367371 await axios . post (
368372 `/api/v1/visitran/${ orgId } /project/_all/jobs/trigger-periodic-task/${ taskId } ` ,
@@ -373,10 +377,12 @@ const Runhistory = () => {
373377 } ,
374378 }
375379 ) ;
376- notify ( { type : "success" , message : "Job submitted " } ) ;
380+ notify ( { type : "success" , message : "Job triggered successfully " } ) ;
377381 setTimeout ( handleRefresh , 2000 ) ;
378382 } catch ( error ) {
379383 notify ( { error } ) ;
384+ } finally {
385+ setRetryLoading ( false ) ;
380386 }
381387 } ;
382388 const handleCopyError = ( text ) => {
@@ -612,11 +618,12 @@ const Runhistory = () => {
612618 key : "actions" ,
613619 width : 50 ,
614620 render : ( ) => (
615- < Tooltip title = " Retry run">
621+ < Tooltip title = { retryLoading ? "Submitting..." : " Retry run"} >
616622 < Button
617623 type = "text"
618624 size = "small"
619- icon = { < RedoOutlined /> }
625+ icon = { retryLoading ? < LoadingOutlined spin /> : < RedoOutlined /> }
626+ disabled = { retryLoading }
620627 onClick = { ( e ) => {
621628 e . stopPropagation ( ) ;
622629 handleRetry ( envInfo . id ) ;
@@ -626,7 +633,7 @@ const Runhistory = () => {
626633 ) ,
627634 } ,
628635 ] ,
629- [ stats , envInfo . id ]
636+ [ stats , envInfo . id , retryLoading ]
630637 ) ;
631638
632639 /* ── RunDetail (expanded row) ── */
@@ -851,6 +858,8 @@ const Runhistory = () => {
851858 type = "primary"
852859 icon = { < RedoOutlined /> }
853860 size = "small"
861+ loading = { retryLoading }
862+ disabled = { retryLoading }
854863 onClick = { ( ) => handleRetry ( envInfo . id ) }
855864 >
856865 Re-run
0 commit comments