#529 增加云脑2任务删除权限判断

Merged
ychao_1983 merged 2 commits from judge_job_del into V20211018 2 years ago
  1. +2
    -0
      routers/repo/modelarts.go
  2. +1
    -1
      templates/repo/cloudbrain/index.tmpl
  3. +2
    -2
      templates/repo/modelarts/index.tmpl

+ 2
- 0
routers/repo/modelarts.go View File

@@ -57,6 +57,8 @@ func ModelArtsIndex(ctx *context.Context) {
} else {
ciTasks[i].CanDebug = false
}

ciTasks[i].CanDel = models.CanDelJob(ctx.IsSigned, ctx.User, task)
}

pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, 5)


+ 1
- 1
templates/repo/cloudbrain/index.tmpl View File

@@ -352,7 +352,7 @@

</div>
<!-- 删除镜像 -->
<!-- 删除任务 -->
<form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{if not .CanDel}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/del{{end}}" method="post">
{{$.CsrfTokenHtml}}
<a class="ui compact {{if not .CanDel}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;">


+ 2
- 2
templates/repo/modelarts/index.tmpl View File

@@ -312,9 +312,9 @@
</div>

<!-- 删除任务 -->
<form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{if ne .Status "STOPPED"}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/del{{end}}" method="post">
<form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{if not .CanDel}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/del{{end}}" method="post">
{{$.CsrfTokenHtml}}
<a class="ui compact {{if ne .Status "STOPPED"}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;">
<a class="ui compact {{if not .CanDel}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;">
删除
</a>
</form>


Loading…
Cancel
Save