diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index e048b98f4..5ad5a215e 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -479,12 +479,12 @@ func trainJobNewVersionDataPrepare(ctx *context.Context) error { ctx.Data["PageIsCloudBrain"] = true var jobID = ctx.Params(":jobid") var versionName = ctx.Query("version_name") + // canNewJob, err := canUserCreateTrainJobVersion(ctx, jobID, versionName) // if err != nil { // ctx.ServerError("canNewJob can info failed", err) // return err // } - // ctx.Data["canNewJob"] = canNewJob task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) if err != nil { @@ -643,6 +643,7 @@ func VersionErrorDataPrepare(ctx *context.Context, form auth.CreateModelArtsTrai ctx.Data["engine_name"] = form.EngineName ctx.Data["flavor_code"] = task.FlavorCode ctx.Data["engine_id"] = task.EngineID + ctx.Data["version_name"] = form.VersionName ctx.Data["bootFile"] = form.BootFile ctx.Data["uuid"] = form.Attachment @@ -881,6 +882,13 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ EngineName := form.EngineName isLatestVersion := modelarts.IsLatestVersion + //判断权限 + canNewJob, _ := canUserCreateTrainJobVersion(ctx, latestTask.UserID) + if !canNewJob { + ctx.RenderWithErr("user cann't new trainjob", tplModelArtsTrainJobVersionNew, &form) + return + } + if err := paramCheckCreateTrainJob(form); err != nil { log.Error("paramCheckCreateTrainJob failed:(%v)", err) VersionErrorDataPrepare(ctx, form) @@ -927,6 +935,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ } parentDir := VersionOutputPath + "/" + // parentDir := "" // if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) @@ -1183,7 +1192,7 @@ func TrainJobShow(ctx *context.Context) { if len(parameters.Parameter) > 0 { paramTemp := "" for _, Parameter := range parameters.Parameter { - param := Parameter.Label + " = " + Parameter.Value + ", " + param := Parameter.Label + " = " + Parameter.Value + "; " paramTemp = paramTemp + param } VersionListTasks[i].Parameters = paramTemp[:len(paramTemp)-2] @@ -1328,7 +1337,6 @@ func canUserCreateTrainJobVersion(ctx *context.Context, userID int64) (bool, err return true, nil } else { log.Error("Only user itself and admin can new trainjob!") - // ctx.ServerError("Only user itself and admin can new trainjob!", nil) return false, nil } } diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index ddf887b51..fbc601cc5 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -54,7 +54,7 @@
- +
diff --git a/templates/repo/migrate.tmpl b/templates/repo/migrate.tmpl index ba17fd83f..e8771fdbe 100644 --- a/templates/repo/migrate.tmpl +++ b/templates/repo/migrate.tmpl @@ -122,7 +122,7 @@
- +
diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index 4c9f38bb0..a3fdddf38 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -549,7 +549,6 @@ td, th { function refreshStatus(version_name){ $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`,(data)=>{ - console.log(data) // header status and duration $(`#${version_name}-duration-span`).text(data.JobDuration) $(`#${version_name}-status-span span`).text(data.JobStatus) @@ -714,8 +713,7 @@ td, th { let scrollTop = container.scrollTop let scrollHeight = container.scrollHeight let clientHeight = container.clientHeight - - if(parseInt(scrollTop) + clientHeight == scrollHeight && scrollHeight>clientHeight){ + if(parseInt(scrollTop) + clientHeight == scrollHeight || parseInt(scrollTop) + clientHeight +1 == scrollHeight || parseInt(scrollTop) + clientHeight - 1 == scrollHeight){ let end_line = $(`#log${version_name} input[name=end_line]`).val() $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, (data) => { if (data.Lines == 0){ diff --git a/templates/repo/modelarts/trainjob/version_new.tmpl b/templates/repo/modelarts/trainjob/version_new.tmpl index 51f468c4d..d9a0d3e50 100644 --- a/templates/repo/modelarts/trainjob/version_new.tmpl +++ b/templates/repo/modelarts/trainjob/version_new.tmpl @@ -156,7 +156,11 @@
{{.CsrfTokenHtml}} + {{if .version_name}} + + {{else}} + {{end}}

{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:

@@ -167,8 +171,11 @@
- + {{if .version_name}} + + {{else}} + {{end}}
@@ -521,8 +528,8 @@ identifier : 'run_para_list', rules: [ { - type: 'maxLength[256]', - prompt : '所有字符最长不超过256个字符。' + type: 'maxLength[255]', + prompt : '所有字符最长不超过255个字符。' } ] }, @@ -578,8 +585,8 @@ identifier : 'run_para_list', rules: [ { - type: 'maxLength[256]', - prompt : '所有字符最长不超过256个字符。' + type: 'maxLength[255]', + prompt : '所有字符最长不超过255个字符。' } ] }, @@ -614,7 +621,6 @@ function get_name(){ let name1=$("#engine_name .text").text() let name2=$("#flaver_name .text").text() - console.log(name1,name2) $("input#ai_engine_name").val(name1) $("input#ai_flaver_name").val(name2) diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl index c7ad0f087..a7c79bc73 100644 --- a/templates/repo/pulls/fork.tmpl +++ b/templates/repo/pulls/fork.tmpl @@ -53,7 +53,7 @@
- +
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl index 6aea5214e..2a501a1e4 100644 --- a/templates/repo/settings/options.tmpl +++ b/templates/repo/settings/options.tmpl @@ -41,7 +41,7 @@ {{end}}
- +
diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index ff677f35f..54c6695ec 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -34,7 +34,7 @@
- +