diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index 7a0cdf6d4..66bc37d6a 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -525,9 +525,15 @@ url:debugUrl+'restart', data:$('#debugAgainForm-'+JobID).serialize(), success:function(res){ - if(res.result_code==0){ - $('#' + JobID+'-icon').removeClass().addClass(res.status) - $('#' + JobID+ '-text').text(res.status) + if(res.result_code==="0"){ + if(res.job_id!==JobID){ + location.reload() + }else{ + $('#' + JobID+'-icon').removeClass().addClass(res.status) + $('#' + JobID+ '-text').text(res.status) + $('#model-debug-'+JobID).removeClass('blue').addClass('disabled') + $('#model-delete-'+JobID).removeClass('blue').addClass('disabled') + } }else{ $(".ui.negative.message").css("display","block") $(".ui.negative.message p").text(res.error_msg) @@ -548,9 +554,19 @@ url:stopUrl, data:$('#stopForm-'+JobID).serialize(), success:function(res){ - if(res.result_code==0){ - $('#' + jobID+'-icon').removeClass().addClass(res.status) - $('#' + jobID+ '-text').text(res.status) + if(res.result_code==="0"){ + $('#' + JobID+'-icon').removeClass().addClass(res.status) + $('#' + JobID+ '-text').text(res.status) + if(res.status==="STOPPED"){ + $('#model-debug-'+JobID).removeClass('blue').addClass('disabled').text("再次调试").css("margin","0") + $('#model-image-'+JobID).removeClass('blue').addClass('disabled') + $('#stop-model-debug-'+JobID).removeClass('blue').addClass('disabled') + } + else{ + $('#model-debug-'+JobID).removeClass('blue').addClass('disabled') + $('#stop-model-debug-'+JobID).removeClass('blue').addClass('disabled') + } + }else{ $("ui.negative.message").text(res.error_msg) } @@ -584,44 +600,30 @@ $('#' + jobID+ '-text').text(status) } if(status==="RUNNING"){ - $('#model-debug-'+jobID).removeClass('disabled') - $('#model-debug-'+jobID).addClass('blue') - $('#model-debug-'+jobID).text('调试') - $('#model-image-'+jobID).removeClass('disabled') - $('#model-image-'+jobID).addClass('blue') - $('#model-debug-'+jobID).css("margin","0 1rem") + $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") + $('#model-image-'+jobID).removeClass('disabled').addClass('blue') } if(status!=="RUNNING"){ // $('#model-debug-'+jobID).removeClass('blue') // $('#model-debug-'+jobID).addClass('disabled') - $('#model-image-'+jobID).removeClass('blue') - $('#model-image-'+jobID).addClass('disabled') - + $('#model-image-'+jobID).removeClass('blue').addClass('disabled') } if(["CREATING","STOPPING","WAITING","STARTING"].includes(status)){ - $('#model-debug-'+jobID).removeClass('blue') - $('#model-debug-'+jobID).addClass('disabled') + $('#model-debug-'+jobID).removeClass('blue').addClass('disabled') } if(['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED'].includes(status)){ - $('#model-debug-'+jobID).removeClass('disabled') - $('#model-debug-'+jobID).addClass('blue') - $('#model-debug-'+jobID).text('再次调试') - + $('#model-debug-'+jobID).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") } if(["RUNNING","WAITING"].includes(status)){ - $('#stop-model-debug-'+jobID).removeClass('disabled') - $('#stop-model-debug-'+jobID).addClass('blue') + $('#stop-model-debug-'+jobID).removeClass('disabled').addClass('blue') } if(["CREATING","STOPPING","STARTING","STOPPED","FAILED","START_FAILED"].includes(status)){ - $('#stop-model-debug-'+jobID).removeClass('blue') - $('#stop-model-debug-'+jobID).addClass('disabled') + $('#stop-model-debug-'+jobID).removeClass('blue').addClass('disabled') } if(status==="STOPPED" || status==="FAILED"|| status==="START_FAILED"){ - $('#model-delete-'+jobID).removeClass('disabled') - $('#model-delete-'+jobID).addClass('blue') + $('#model-delete-'+jobID).removeClass('disabled').addClass('blue') }else{ - $('#model-delete-'+jobID).removeClass('blue') - $('#model-delete-'+jobID).addClass('disabled') + $('#model-delete-'+jobID).removeClass('blue').addClass('disabled') } }).fail(function(err) { console.log(err);