diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 29ef3fe6c..389f86b24 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -187,7 +187,10 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain var jobID = ctx.Params(":jobid") task, err := models.GetCloudbrainByJobID(jobID) if err != nil { - ctx.ServerError("GetCloudbrainByJobID failed", err) + ctx.JSON(200, map[string]string{ + "result_code": "-1", + "error_msg": "GetCloudbrainByJobID failed", + }) return } @@ -199,11 +202,17 @@ func CloudBrainCommitImage(ctx *context.Context, form auth.CommitImageCloudBrain }) if err != nil { log.Error("CommitImage(%s) failed:", task.JobName, err.Error()) - ctx.ServerError("CommitImage failed", err) + ctx.JSON(200, map[string]string{ + "result_code": "-1", + "error_msg": "CommitImage failed", + }) return } - ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain") + ctx.JSON(200, map[string]string{ + "result_code": "0", + "error_msg": "", + }) } func CloudBrainStop(ctx *context.Context) { diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 6a4ba1f50..5361db7dd 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -1,215 +1,357 @@ {{template "base/head" .}} + +
+
+
+
+
+
+
+
+
+ + +
+
- {{template "repo/header" .}} -
-
-
-

{{.i18n.Tr "repo.cloudbrain"}}

-
-
-
-
- {{if .Permission.CanWrite $.UnitTypeCloudBrain}} - {{.i18n.Tr "repo.cloudbrain.new"}} - {{end}} -
-
-
-
-
-
-
-
-
-
-
- + + + + + + 提交镜像 + + +
+
+ {{end}} {{template "base/paginate" .}} +
+
+
+
+
{{template "base/footer" .}} + + // 点击按钮打开弹窗 + for (i = 0; i < btns.length; i++) { + btns[i].onclick = function() { + modal.style.display = "block"; + } + } + // 点击 (x), 关闭弹窗 + for (i = 0; i < spans.length; i++) { + spans[i].onclick = function() { + modal.style.display = "none"; + } + } - \ No newline at end of file