From 2bbd2e38061e6da5e710343be3ff68dbd12ecf4b Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Mon, 29 Nov 2021 11:49:58 +0800 Subject: [PATCH] fix 992 --- routers/repo/modelarts.go | 8 ++++++-- templates/repo/modelarts/trainjob/new.tmpl | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 069a1a0b5..ec65baaad 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -364,13 +364,17 @@ func trainJobNewDataPrepare(ctx *context.Context) error { Branches, err := ctx.Repo.GitRepo.GetBranches() if err != nil { + log.Error("GetBranches failed:%v", err) ctx.ServerError("GetBranches error:", err) return err } - ctx.Data["Branches"] = Branches + if Branches != nil { + ctx.Data["Branches"] = Branches + } + ctx.Data["BranchesCount"] = len(Branches) ctx.Data["params"] = "" - ctx.Data["BranchName"] = ctx.Repo.BranchName + ctx.Data["branchName"] = ctx.Repo.BranchName configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) if err != nil { diff --git a/templates/repo/modelarts/trainjob/new.tmpl b/templates/repo/modelarts/trainjob/new.tmpl index 1a2a3c9ce..537424859 100755 --- a/templates/repo/modelarts/trainjob/new.tmpl +++ b/templates/repo/modelarts/trainjob/new.tmpl @@ -183,9 +183,9 @@ {{end}} {{end}} {{else}} - + {{range $k, $v :=.Branches}} - {{ if ne $v $.BranchName }} + {{ if ne $v $.branchName }} {{end}} {{end}}