From 5dff96fe210290c070e0b7b0ccb7baefa6e9e24a Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 8 Dec 2021 15:03:13 +0800 Subject: [PATCH 1/4] fix issue --- routers/repo/modelarts.go | 4 ++-- templates/repo/cloudbrain/index.tmpl | 26 ++++++++------------------ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 6047de980..9a4150d8e 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -71,7 +71,7 @@ func DebugJobIndex(ctx *context.Context) { } else { ciTasks[i].CanDebug = false } - ciTasks[i].CanDel = cloudbrain.CanDeleteDebugJob(ctx, &task.Cloudbrain) + ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) ciTasks[i].Cloudbrain.ComputeResource = modelarts.GPUResource } if task.Cloudbrain.Type == models.TypeCloudBrainTwo { @@ -80,7 +80,7 @@ func DebugJobIndex(ctx *context.Context) { } else { ciTasks[i].CanDebug = false } - ciTasks[i].CanDel = cloudbrain.CanDeleteDebugJob(ctx, &task.Cloudbrain) + ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) ciTasks[i].Cloudbrain.ComputeResource = modelarts.NPUResource } diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 936a5cfcf..641fefb79 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -368,19 +368,19 @@ {{else}} - {{$.i18n.Tr "repo.debug"}} + {{.CanDebug}}{{$.i18n.Tr "repo.debug"}} {{end}}
{{$.CsrfTokenHtml}} {{if .CanDel}} - + {{$.i18n.Tr "repo.stop"}} {{else}} - {{.CanDel}}{{$.i18n.Tr "repo.stop"}} + {{.CanDel}}{{$.i18n.Tr "repo.stop"}} {{end}}
@@ -393,8 +393,8 @@ - {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} - {{$.i18n.Tr "repo.submit_image"}} + {{if .CanDel}} + {{$.i18n.Tr "repo.submit_image"}} {{else}} {{$.i18n.Tr "repo.submit_image"}} {{end}} @@ -404,7 +404,7 @@
{{$.CsrfTokenHtml}} {{if .CanDel}} - + {{.CanDel}}{{$.i18n.Tr "repo.delete"}} {{else}} @@ -542,10 +542,6 @@ console.log("---------") $('#' + jobID+'-icon').removeClass().addClass(status) $('#' + jobID+ '-text').text(status) - - //if (status == 'STOPPED') { - // window.location.reload() - //} } if(status==="RUNNING"){ console.log("----------",status,$('#model-debug-'+jobID)) @@ -558,6 +554,8 @@ if(status==="STOPPED" || status==="FAILED"){ $('#model-delete-'+jobID).removeClass('disabled') $('#model-delete-'+jobID).addClass('blue') + $('#stop-model-debug-'+jobID).removeClass('blue') + $('#stop-model-debug-'+jobID).addClass('disabled') } if(status!=="RUNNING"){ $('#model-debug-'+jobID).removeClass('blue') @@ -569,14 +567,6 @@ if(status!=="STOPPED" || 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=="STOPPED" || status=="FAILED"){ - $('#stop-model-debug-'+jobID).removeClass('blue') - $('#stop-model-debug-'+jobID).addClass('disabled') - // $('#model-delete-'+jobID).removeClass('disabled') - // $('#model-delete-'+jobID).addClass('red') } }).fail(function(err) { console.log(err); From c539c86686e5b83c42fb189354e8ba9790809f8e Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 8 Dec 2021 17:31:42 +0800 Subject: [PATCH 2/4] fix issue --- templates/repo/cloudbrain/index.tmpl | 6 +-- templates/repo/modelarts/notebook/index.tmpl | 76 +++++----------------------- 2 files changed, 15 insertions(+), 67 deletions(-) diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 641fefb79..67190b7da 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -363,12 +363,12 @@ {{$.CsrfTokenHtml}} {{if .CanDebug}} - - {{.CanDebug}}{{$.i18n.Tr "repo.debug"}} + + {{$.i18n.Tr "repo.debug"}} {{else}} - {{.CanDebug}}{{$.i18n.Tr "repo.debug"}} + {{$.i18n.Tr "repo.debug"}} {{end}} diff --git a/templates/repo/modelarts/notebook/index.tmpl b/templates/repo/modelarts/notebook/index.tmpl index 56e0e1a06..502fb257f 100755 --- a/templates/repo/modelarts/notebook/index.tmpl +++ b/templates/repo/modelarts/notebook/index.tmpl @@ -63,25 +63,8 @@
- - - -
-
@@ -104,9 +87,7 @@
{{$.i18n.Tr "repo.cloudbrain_operate"}}
-
-
{{range .Tasks}}
@@ -124,16 +105,10 @@ {{.Status}}
-
- - - +
{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
-
{{.ComputeResource}} @@ -147,49 +122,33 @@
- - {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} - + {{if .CanDebug}} + {{$.i18n.Tr "repo.debug"}} {{else}} - + {{$.i18n.Tr "repo.debug"}} {{end}} - {{$.CsrfTokenHtml}} - {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} - + {{if .CanDel}} + {{$.i18n.Tr "repo.stop"}} {{else}} - + {{$.i18n.Tr "repo.stop"}} {{end}}
- - - - - - - - -
{{$.CsrfTokenHtml}} - {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} + {{if .CanDel}} {{$.i18n.Tr "repo.delete"}} @@ -213,9 +172,7 @@
-
-
- - - - - - {{if .CanDel}} - {{$.i18n.Tr "repo.submit_image"}} - {{else}} - {{$.i18n.Tr "repo.submit_image"}} - {{end}} +
- - -
- {{$.CsrfTokenHtml}} - {{if .CanDel}} - - {{.CanDel}}{{$.i18n.Tr "repo.delete"}} - - {{else}} - - {{$.i18n.Tr "repo.delete"}} - - {{end}} -
-
+ {{end}} -
-
- @@ -496,7 +504,12 @@ return } } - + $(document).ready(function(){ + $('.ui.dropdown') + .dropdown({ + action: 'hide', + }) + }) // 删除时用户确认 function assertDelete(obj) { if (obj.style.color == "rgb(204, 204, 204)") { @@ -539,12 +552,10 @@ const jobID = data.JobID const status = data.JobStatus if (status != job.textContent.trim()) { - console.log("---------") $('#' + jobID+'-icon').removeClass().addClass(status) $('#' + jobID+ '-text').text(status) } if(status==="RUNNING"){ - console.log("----------",status,$('#model-debug-'+jobID)) $('#model-debug-'+jobID).removeClass('disabled') $('#model-debug-'+jobID).addClass('blue') $('#model-image-'+jobID).removeClass('disabled') diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index dbd9dde0a..3bb2eb4f6 100644 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -312,9 +312,15 @@ {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} {{if eq .ComputeResource "CPU/GPU"}} - - {{$.i18n.Tr "repo.debug"}} - + {{if .CanDebug}} + + {{$.i18n.Tr "repo.debug"}} + + {{else}} + + {{$.i18n.Tr "repo.debug"}} + + {{end}} {{else}} {{$.i18n.Tr "repo.debug"}} @@ -329,7 +335,7 @@
{{$.CsrfTokenHtml}} {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} - + {{$.i18n.Tr "repo.stop"}} {{else}} @@ -338,39 +344,64 @@ {{end}} +
+ +
+ + {{$.CsrfTokenHtml}} + {{if .CanDel}} + + {{$.i18n.Tr "repo.delete"}} + + {{else}} + + {{$.i18n.Tr "repo.delete"}} + + + {{end}}
-
- - + + - {{if $.Permission.CanWrite $.UnitTypeCloudBrain}} {{$.i18n.Tr "repo.submit_image"}} {{else}} {{$.i18n.Tr "repo.submit_image"}} {{end}} -
+ --> -
- - {{$.CsrfTokenHtml}} - {{if .CanDel}} - - - {{$.i18n.Tr "repo.delete"}} - - {{else}} - - {{$.i18n.Tr "repo.delete"}} - - - {{end}} -
+
+ +
-