| @@ -202,15 +202,20 @@ | |||||
| <div class="rect5"></div> | <div class="rect5"></div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <!-- 提示框 --> | |||||
| <div class="alert"></div> | |||||
| <div class="repository release dataset-list view"> | <div class="repository release dataset-list view"> | ||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| {{template "base/alert" .}} | |||||
| <!-- {{template "base/alert" .}} --> | |||||
| <!-- 提示框 --> | |||||
| <!-- 列表容器 --> | <!-- 列表容器 --> | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| <div class="ui two column stackable grid "> | |||||
| <div class="ui negative message" style="display: none;"> | |||||
| <i class="close icon"></i> | |||||
| <p></p> | |||||
| </div> | |||||
| <div class="ui two column stackable grid"> | |||||
| <div class="column"> | <div class="column"> | ||||
| <div class="ui blue small menu compact selectcloudbrain"> | <div class="ui blue small menu compact selectcloudbrain"> | ||||
| <a class="active item" href="{{.RepoLink}}/debugjob?debugListType=all">{{$.i18n.Tr "repo.modelarts.notebook"}}</a> | <a class="active item" href="{{.RepoLink}}/debugjob?debugListType=all">{{$.i18n.Tr "repo.modelarts.notebook"}}</a> | ||||
| @@ -316,15 +321,15 @@ | |||||
| </a> | </a> | ||||
| {{end}} --> | {{end}} --> | ||||
| <!-- 调试 --> | <!-- 调试 --> | ||||
| <form id="debugAgainForm-{{.JobID}}" action="{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/restart" method="POST"> | |||||
| <form id="debugAgainForm-{{.JobID}}"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| {{if .CanDebug}} | {{if .CanDebug}} | ||||
| {{if eq .Status "RUNNING"}} | {{if eq .Status "RUNNING"}} | ||||
| <a style="margin: 0 1rem;" id="model-debug-{{.JobID}}" class='ui basic blue button' onclick='debugAgain("{{.JobID}}","{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/debug")'> | |||||
| <a style="margin: 0 1rem;" id="model-debug-{{.JobID}}" class='ui basic blue button' onclick='debugAgain("{{.JobID}}","{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/")'> | |||||
| {{$.i18n.Tr "repo.debug"}} | {{$.i18n.Tr "repo.debug"}} | ||||
| </a> | </a> | ||||
| {{else}} | {{else}} | ||||
| <a id="model-debug-{{.JobID}}" class='ui basic {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' onclick='debugAgain("{{.JobID}}","{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/debug")'> | |||||
| <a id="model-debug-{{.JobID}}" class='ui basic {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' onclick='debugAgain("{{.JobID}}","{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/")'> | |||||
| {{$.i18n.Tr "repo.debug_again"}} | {{$.i18n.Tr "repo.debug_again"}} | ||||
| </a> | </a> | ||||
| {{end}} | {{end}} | ||||
| @@ -337,7 +342,7 @@ | |||||
| </form> | </form> | ||||
| <!-- 停止 --> | <!-- 停止 --> | ||||
| <form id="stopForm-{{.JobID}}" action="{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/stop" style="margin-left:-1px;"> | |||||
| <form id="stopForm-{{.JobID}}" style="margin-left:-1px;"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| {{if .CanDel}} | {{if .CanDel}} | ||||
| {{if eq .ComputeResource "CPU/GPU" }} | {{if eq .ComputeResource "CPU/GPU" }} | ||||
| @@ -512,11 +517,28 @@ | |||||
| } | } | ||||
| } | } | ||||
| function debugAgain(JobID,debugUrl){ | function debugAgain(JobID,debugUrl){ | ||||
| console.log() | |||||
| if($('#' + JobID+ '-text').text()==="RUNNING"){ | if($('#' + JobID+ '-text').text()==="RUNNING"){ | ||||
| window.open(debugUrl) | |||||
| window.open(debugUrl+'debug') | |||||
| }else{ | }else{ | ||||
| document.getElementById(`debugAgainForm-${JobID}`).submit(); | |||||
| $.ajax({ | |||||
| type:"POST", | |||||
| 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) | |||||
| }else{ | |||||
| $(".ui.negative.message").css("display","block") | |||||
| $(".ui.negative.message p").text(res.error_msg) | |||||
| setTimeout("$('.message .close').click()",3000) | |||||
| } | |||||
| }, | |||||
| error :function(res){ | |||||
| console.log(res) | |||||
| } | |||||
| }) | |||||
| } | } | ||||
| } | } | ||||
| @@ -526,7 +548,12 @@ | |||||
| url:stopUrl, | url:stopUrl, | ||||
| data:$('#stopForm-'+JobID).serialize(), | data:$('#stopForm-'+JobID).serialize(), | ||||
| success:function(res){ | success:function(res){ | ||||
| console.log(res) | |||||
| if(res.result_code==0){ | |||||
| $('#' + jobID+'-icon').removeClass().addClass(res.status) | |||||
| $('#' + jobID+ '-text').text(res.status) | |||||
| }else{ | |||||
| $("ui.negative.message").text(res.error_msg) | |||||
| } | |||||
| }, | }, | ||||
| error :function(res){ | error :function(res){ | ||||
| console.log(res) | console.log(res) | ||||
| @@ -612,6 +639,13 @@ | |||||
| location.href = `${url}/debugjob?debugListType=${value}` | location.href = `${url}/debugjob?debugListType=${value}` | ||||
| } | } | ||||
| }) | }) | ||||
| $('.message .close') | |||||
| .on('click', function() { | |||||
| console.log(this) | |||||
| $(this) | |||||
| .closest('.message') | |||||
| .transition('fade') | |||||
| }) | |||||
| }) | }) | ||||