Browse Source

fix issue

pull/1166/head
zhoupzh 3 years ago
parent
commit
d2547221bd
2 changed files with 26 additions and 31 deletions
  1. +1
    -0
      options/locale/locale_zh-CN.ini
  2. +25
    -31
      templates/repo/debugjob/index.tmpl

+ 1
- 0
options/locale/locale_zh-CN.ini View File

@@ -786,6 +786,7 @@ model_manager = 模型
model_noright=无权限操作

debug=调试
debug_again=再次调试
stop=停止
delete=删除
model_download=模型下载


+ 25
- 31
templates/repo/debugjob/index.tmpl View File

@@ -316,21 +316,26 @@
</a>
{{end}} -->
<!-- 调试 -->
{{if .CanDebug}}
{{if eq .ComputeResource "CPU/GPU"}}
<a id="model-debug-{{.JobID}}" class='ui basic {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' href="{{$.RepoLink}}/cloudbrain/{{.JobID}}/debug" onclick='debugAgain("{{.JobID}}","{{$.RepoLink}}/cloudbrain/{{.JobID}}/restart");return false' target="_blank">
<!-- {{$.i18n.Tr "repo.debug"}} -->再次调试
</a>
<form id="debugAgainForm-{{.JobID}}" action="{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/restart" method="POST">
{{$.CsrfTokenHtml}}
{{if .CanDebug}}
{{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")'>
{{$.i18n.Tr "repo.debug"}}
</a>
{{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")'>
{{$.i18n.Tr "repo.debug_again"}}
</a>
{{end}}
{{else}}
<a id="model-debug-{{.JobID}}" class='ui basic {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' href="{{$.RepoLink}}/modelarts/notebook/{{.JobID}}/debug" onclick='debugAgain("{{.JobID}}","{{$.RepoLink}}/modelarts/notebook/{{.JobID}}/restart");return false' target="_blank">
<!-- {{$.i18n.Tr "repo.debug"}} -->再次调试
<a class="ui basic disabled button">
{{$.i18n.Tr "repo.debug_again"}}
</a>
{{end}}
{{else}}
<a class="ui basic disabled button">
{{$.i18n.Tr "repo.debug"}}
</a>
{{end}}
</form>
<!-- 停止 -->
<form id="stopForm-{{.JobID}}" action="{{if eq .ComputeResource "CPU/GPU"}}{{$.RepoLink}}/cloudbrain{{else}}{{$.RepoLink}}/modelarts/notebook{{end}}/{{.JobID}}/stop" method="post" style="margin-left:-1px;">
{{$.CsrfTokenHtml}}
@@ -501,25 +506,13 @@
.modal('show')
}
}
function debugAgain(jobID,url){
console.log(url)
$.post(url,{_csrf:csrf},(data)=>{
let getUrl = url.split('/restart')[0]
console.log(getUrl)
$.get(`/api/v1/repos${getUrl}`,(data)=>{
const jobID = data.JobID
const status = data.JobStatus
console.log("status",status)
if(status==="RUNNING"){
console.log("========status",status)
$('#model-debug-'+jobID).removeClass('disabled')
$('#model-debug-'+jobID).addClass('blue')
$('#model-debug-'+jobID).text('调试')
$('#model-image-'+jobID).removeClass('disabled')
$('#model-image-'+jobID).addClass('blue')
}
})
})
function debugAgain(JobID,debugUrl){
console.log()
if($('#' + JobID+ '-text').text()==="RUNNING"){
window.open(debugUrl)
}else{
document.getElementById(`debugAgainForm-${JobID}`).submit();
}
}
// 加载任务状态
@@ -549,6 +542,7 @@
$('#model-debug-'+jobID).text('调试')
$('#model-image-'+jobID).removeClass('disabled')
$('#model-image-'+jobID).addClass('blue')
$('#model-debug-'+jobID).css("margin","0 1rem")
}
if(status!=="RUNNING"){
// $('#model-debug-'+jobID).removeClass('blue')


Loading…
Cancel
Save