Browse Source

合并最新代码分支。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.10.1^2
zouap 3 years ago
parent
commit
0fbfb36149
15 changed files with 22 additions and 18 deletions
  1. +1
    -1
      models/repo.go
  2. +2
    -1
      modules/repository/create.go
  3. +1
    -1
      modules/setting/setting.go
  4. +0
    -1
      routers/api/v1/repo/cloudbrain.go
  5. +2
    -1
      routers/api/v1/repo/fork.go
  6. +1
    -1
      routers/repo/cloudbrain.go
  7. +3
    -3
      routers/repo/editor.go
  8. +1
    -0
      routers/repo/grampus.go
  9. +1
    -1
      routers/repo/modelarts.go
  10. +2
    -1
      routers/repo/repo.go
  11. +2
    -1
      routers/repo/setting.go
  12. +3
    -2
      routers/repo/setting_protected_branch.go
  13. +1
    -1
      templates/repo/cloudbrain/trainjob/show.tmpl
  14. +1
    -1
      templates/repo/grampus/trainjob/show.tmpl
  15. +1
    -2
      templates/repo/modelarts/trainjob/show.tmpl

+ 1
- 1
models/repo.go View File

@@ -679,7 +679,7 @@ func (repo *Repository) getAssignees(e Engine) (_ []*User, err error) {
userIDs[i] = accesses[i].UserID
}

if err = e.In("id", userIDs).Find(&users); err != nil {
if err = e.In("id", userIDs).OrderBy("name asc").Find(&users); err != nil {
return nil, err
}
}


+ 2
- 1
modules/repository/create.go View File

@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"strings"
"text/template"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
@@ -34,7 +35,7 @@ func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (_ *m
Name: opts.Name,
Alias: opts.Alias,
LowerName: strings.ToLower(opts.Name),
Description: opts.Description,
Description: template.HTMLEscapeString(opts.Description),
OriginalURL: opts.OriginalURL,
OriginalServiceType: opts.GitServiceType,
IsPrivate: opts.IsPrivate,


+ 1
- 1
modules/setting/setting.go View File

@@ -394,7 +394,7 @@ var (
DefaultGitTreesPerPage int
DefaultMaxBlobSize int64
}{
EnableSwagger: true,
EnableSwagger: false,
SwaggerURL: "",
MaxResponseItems: 50,
DefaultPagingNum: 30,


+ 0
- 1
routers/api/v1/repo/cloudbrain.go View File

@@ -704,7 +704,6 @@ func getLogFromModelDir(jobName string, startLine int, endLine int, resultPath s
r := bufio.NewReader(reader)
for i := 0; i < endLine; i++ {
line, error := r.ReadString('\n')
//log.Info("line=" + line)
if error == io.EOF {
if i >= startLine {
fileEndLine = i


+ 2
- 1
routers/api/v1/repo/fork.go View File

@@ -7,6 +7,7 @@ package repo

import (
"fmt"
"html/template"
"net/http"

"code.gitea.io/gitea/models"
@@ -118,7 +119,7 @@ func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
forker = org
}

fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, repo.Description, repo.Alias)
fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, template.HTMLEscapeString(repo.Description), repo.Alias)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ForkRepository", err)
return


+ 1
- 1
routers/repo/cloudbrain.go View File

@@ -769,8 +769,8 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
ctx.Data["ExitDiagnostics"] = taskRes.TaskStatuses[0].ExitDiagnostics
oldStatus := task.Status
task.Status = taskRes.TaskStatuses[0].State
task.ContainerIp = ""
task.ContainerID = taskRes.TaskStatuses[0].ContainerID
task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP
models.ParseAndSetDurationFromCloudBrainOne(jobRes, task)

if task.DeletedAt.IsZero() { //normal record


+ 3
- 3
routers/repo/editor.go View File

@@ -303,7 +303,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
}

if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName)
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
} else {
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))
}
@@ -475,7 +475,7 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {

ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName)
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
} else {
treePath := filepath.Dir(ctx.Repo.TreePath)
if treePath == "." {
@@ -686,7 +686,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
}

if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) {
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + ctx.Repo.BranchName + "..." + form.NewBranchName)
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
} else {
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))
}


+ 1
- 0
routers/repo/grampus.go View File

@@ -837,6 +837,7 @@ func GrampusTrainJobShow(ctx *context.Context) {
ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return
}
task.ContainerIp = ""

if task.DeletedAt.IsZero() { //normal record
result, err := grampus.GetJob(task.JobID)


+ 1
- 1
routers/repo/modelarts.go View File

@@ -1795,7 +1795,7 @@ func TrainJobShow(ctx *context.Context) {
datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false))
VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain)
VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain)
VersionListTasks[i].ContainerIp = ""
//add spec
s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID)
if err != nil {


+ 2
- 1
routers/repo/repo.go View File

@@ -12,6 +12,7 @@ import (
"path"
"regexp"
"strings"
"text/template"
"unicode/utf8"

"code.gitea.io/gitea/modules/validation"
@@ -212,7 +213,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
opts := models.GenerateRepoOptions{
Name: form.RepoName,
Alias: form.Alias,
Description: form.Description,
Description: template.HTMLEscapeString(form.Description),
Private: form.Private,
GitContent: form.GitContent,
Topics: form.Topics,


+ 2
- 1
routers/repo/setting.go View File

@@ -8,6 +8,7 @@ package repo
import (
"errors"
"fmt"
"html/template"
"io/ioutil"
"net/url"
"regexp"
@@ -129,7 +130,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
// In case it's just a case change.
repo.Name = newRepoName
repo.LowerName = strings.ToLower(newRepoName)
repo.Description = form.Description
repo.Description = template.HTMLEscapeString(form.Description)
repo.Website = form.Website
repo.IsTemplate = form.Template
repo.Alias = newAlias


+ 3
- 2
routers/repo/setting_protected_branch.go View File

@@ -5,6 +5,7 @@
package repo

import (
"code.gitea.io/gitea/modules/util"
"fmt"
"strings"
"time"
@@ -192,7 +193,7 @@ func SettingsProtectedBranchPost(ctx *context.Context, f auth.ProtectBranchForm)
}
if f.RequiredApprovals < 0 {
ctx.Flash.Error(ctx.Tr("repo.settings.protected_branch_required_approvals_min"))
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, branch))
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, util.PathEscapeSegments(branch)))
}

var whitelistUsers, whitelistTeams, mergeWhitelistUsers, mergeWhitelistTeams, approvalsWhitelistUsers, approvalsWhitelistTeams []int64
@@ -263,7 +264,7 @@ func SettingsProtectedBranchPost(ctx *context.Context, f auth.ProtectBranchForm)
return
}
ctx.Flash.Success(ctx.Tr("repo.settings.update_protect_branch_success", branch))
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, branch))
ctx.Redirect(fmt.Sprintf("%s/settings/branches/%s", ctx.Repo.RepoLink, util.PathEscapeSegments(branch)))
} else {
if protectBranch != nil {
if err := ctx.Repo.Repository.DeleteProtectedBranch(protectBranch.ID); err != nil {


+ 1
- 1
templates/repo/cloudbrain/trainjob/show.tmpl View File

@@ -253,7 +253,7 @@
<div style="float: right;">
{{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }}
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model"
onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{else}}
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{end}}


+ 1
- 1
templates/repo/grampus/trainjob/show.tmpl View File

@@ -265,7 +265,7 @@
<div style="float: right;">
{{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }}
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model"
onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}},EngineName:{{.EngineName}},ComputeResource:{{.ComputeResource}},Type:{{.Type}}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{else}}
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{end}}


+ 1
- 2
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -249,7 +249,7 @@
{{$.CsrfTokenHtml}}
{{if and (.CanModify) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }}
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model"
onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}},EngineID:{{.EngineID}}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{else}}
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{end}}
@@ -783,7 +783,6 @@
}
let dirKey="isOnlyDir--:&";
function loadSelectedModelFile(trainJob){
console.log("trainJob=" + trainJob);
$('#choice_file').dropdown('clear')
$("#model-file").empty()
if(trainJob ==null || trainJob ==""){


Loading…
Cancel
Save