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 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 return nil, err
} }
} }


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

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


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


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

@@ -394,7 +394,7 @@ var (
DefaultGitTreesPerPage int DefaultGitTreesPerPage int
DefaultMaxBlobSize int64 DefaultMaxBlobSize int64
}{ }{
EnableSwagger: true,
EnableSwagger: false,
SwaggerURL: "", SwaggerURL: "",
MaxResponseItems: 50, MaxResponseItems: 50,
DefaultPagingNum: 30, 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) r := bufio.NewReader(reader)
for i := 0; i < endLine; i++ { for i := 0; i < endLine; i++ {
line, error := r.ReadString('\n') line, error := r.ReadString('\n')
//log.Info("line=" + line)
if error == io.EOF { if error == io.EOF {
if i >= startLine { if i >= startLine {
fileEndLine = i fileEndLine = i


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

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


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


"code.gitea.io/gitea/models" "code.gitea.io/gitea/models"
@@ -118,7 +119,7 @@ func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
forker = org 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 { if err != nil {
ctx.Error(http.StatusInternalServerError, "ForkRepository", err) ctx.Error(http.StatusInternalServerError, "ForkRepository", err)
return 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 ctx.Data["ExitDiagnostics"] = taskRes.TaskStatuses[0].ExitDiagnostics
oldStatus := task.Status oldStatus := task.Status
task.Status = taskRes.TaskStatuses[0].State task.Status = taskRes.TaskStatuses[0].State
task.ContainerIp = ""
task.ContainerID = taskRes.TaskStatuses[0].ContainerID task.ContainerID = taskRes.TaskStatuses[0].ContainerID
task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP
models.ParseAndSetDurationFromCloudBrainOne(jobRes, task) models.ParseAndSetDurationFromCloudBrainOne(jobRes, task)


if task.DeletedAt.IsZero() { //normal record 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) { 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 { } else {
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) 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)) ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(models.UnitTypePullRequests) { 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 { } else {
treePath := filepath.Dir(ctx.Repo.TreePath) treePath := filepath.Dir(ctx.Repo.TreePath)
if 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) { 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 { } else {
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath)) 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) ctx.NotFound(ctx.Req.URL.RequestURI(), nil)
return return
} }
task.ContainerIp = ""


if task.DeletedAt.IsZero() { //normal record if task.DeletedAt.IsZero() { //normal record
result, err := grampus.GetJob(task.JobID) 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)) datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false))
VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain)
VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain)
VersionListTasks[i].ContainerIp = ""
//add spec //add spec
s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID) s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID)
if err != nil { if err != nil {


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

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


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


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

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


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

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


import ( import (
"code.gitea.io/gitea/modules/util"
"fmt" "fmt"
"strings" "strings"
"time" "time"
@@ -192,7 +193,7 @@ func SettingsProtectedBranchPost(ctx *context.Context, f auth.ProtectBranchForm)
} }
if f.RequiredApprovals < 0 { if f.RequiredApprovals < 0 {
ctx.Flash.Error(ctx.Tr("repo.settings.protected_branch_required_approvals_min")) 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 var whitelistUsers, whitelistTeams, mergeWhitelistUsers, mergeWhitelistTeams, approvalsWhitelistUsers, approvalsWhitelistTeams []int64
@@ -263,7 +264,7 @@ func SettingsProtectedBranchPost(ctx *context.Context, f auth.ProtectBranchForm)
return return
} }
ctx.Flash.Success(ctx.Tr("repo.settings.update_protect_branch_success", branch)) 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 { } else {
if protectBranch != nil { if protectBranch != nil {
if err := ctx.Repo.Repository.DeleteProtectedBranch(protectBranch.ID); err != 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;"> <div style="float: right;">
{{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} {{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }}
<a class="ti-action-menu-item" id="{{.VersionName}}-create-model" <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}} {{else}}
<a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
{{end}} {{end}}


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

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


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

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


Loading…
Cancel
Save