diff --git a/templates/repo/modelarts/trainjob/index.tmpl b/templates/repo/modelarts/trainjob/index.tmpl index e55131bca..e1e878a9a 100755 --- a/templates/repo/modelarts/trainjob/index.tmpl +++ b/templates/repo/modelarts/trainjob/index.tmpl @@ -391,7 +391,7 @@
{{$.CsrfTokenHtml}} {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} - + {{$.i18n.Tr "repo.stop"}} {{else}} @@ -404,11 +404,11 @@
{{$.CsrfTokenHtml}} {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} - + {{$.i18n.Tr "repo.delete"}} {{else}} - + {{$.i18n.Tr "repo.delete"}} {{end}} @@ -541,33 +541,7 @@ $('#' + jobID+ '-text').text(status) } - if(status==="RUNNING"){ - $('#model-debug-'+jobID).removeClass('disabled') - $('#model-debug-'+jobID).addClass('blue') - // $('#duration-'+jobID).text(duration) - - } - if(status!=="RUNNING"){ - $('#model-debug-'+jobID).removeClass('blue') - $('#model-debug-'+jobID).addClass('disabled') - - } - if(status!=="KILLED" || status!=="FAILED"){ - $('#stop-model-debug-'+jobID).removeClass('disabled') - $('#stop-model-debug-'+jobID).addClass('blue') - $('#model-delete-'+jobID).removeClass('red') - $('#model-delete-'+jobID).addClass('disabled') - } - if(status=="KILLED" || status=="FAILED" || status=="KILLING" || status=="COMPLETED"){ - $('#stop-model-debug-'+jobID).removeClass('blue') - $('#stop-model-debug-'+jobID).addClass('disabled') - $('#model-delete-'+jobID).removeClass('disabled') - $('#model-delete-'+jobID).addClass('red') - } - if(status=="START_FAILED"){ - $('#stop-model-debug-'+jobID).removeClass('blue') - $('#stop-model-debug-'+jobID).addClass('disabled') - } + }).fail(function(err) { console.log(err); }); @@ -605,15 +579,34 @@ } function stopVersion(version_name,jobID){ - $.post(`/api/v1/repos{{$.Link}}/${.JobID}/stop_version`,{version_name:version_name},(data)=>{ + const url = '/api/v1/repos/{{$.RepoRelPath}}/modelarts/train-job/'+jobID+'/stop_version' + $.post(url,{version_name:version_name},(data)=>{ if(data.StatusOK===0){ + $('#'+version_name+'-stop').removeClass('blue') $('#'+version_name+'-stop').addClass('disabled') - refreshStatus(version_name) + refreshStatus(version_name,jobID) } }).fail(function(err) { console.log(err); }); } + function refreshStatus(version_name,jobID){ + + const url = '/api/v1/repos/{{$.RepoRelPath}}/modelarts/train-job/'+jobID+'?version_name='+version_name + $.get(url,(data)=>{ + + + $(`#${jobID}-icon`).attr("class",data.JobStatus) + // detail status and duration + + $(`#${jobID}-text`).text(data.JobStatus) + + + }).fail(function(err) { + console.log(err); + }); + + } // 显示弹窗,弹出相应的信息 function showmask() { $('#imageModal').css('display', 'none')