From ecf1e08c4083948176ada4c875aaf07c37944161 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 11 Apr 2022 15:54:33 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/org.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/org.go b/models/org.go index 8b3e60ef8..28a6701c5 100755 --- a/models/org.go +++ b/models/org.go @@ -208,7 +208,7 @@ func FindTopNMembersOrgs(n int) ([]*OrgScore, error) { } func FindTopNOpenIOrgs(n int) ([]*OrgScore, error) { - sql := "select org_id id,num_score score from org_statistic order by num_score desc limit 10" + strconv.Itoa(n) + sql := "select org_id id,num_score score from org_statistic order by num_score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) } From 56dc0dcfb85da4afcd95097a324eaf2453e0c719 Mon Sep 17 00:00:00 2001 From: liuzx Date: Mon, 11 Apr 2022 17:16:58 +0800 Subject: [PATCH 02/20] fix-1656 --- models/cloudbrain.go | 64 ++++++++- options/locale/locale_zh-CN.ini | 4 +- routers/api/v1/api.go | 4 + routers/api/v1/repo/cloudbrain_dashboard.go | 138 ++++++++++++++++++++ 4 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 routers/api/v1/repo/cloudbrain_dashboard.go diff --git a/models/cloudbrain.go b/models/cloudbrain.go index 1662dcd96..aa5a0e6d0 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -1,13 +1,14 @@ package models import ( - "code.gitea.io/gitea/modules/util" "encoding/json" "fmt" "strconv" "strings" "time" + "code.gitea.io/gitea/modules/util" + "xorm.io/builder" "xorm.io/xorm" @@ -1564,3 +1565,64 @@ func RestartCloudbrain(old *Cloudbrain, new *Cloudbrain) (err error) { return nil } +func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { + sess := x.NewSession() + defer sess.Close() + var cond = builder.NewCond() + if (opts.Type) >= 0 { + cond = cond.And( + builder.Eq{"cloudbrain.type": opts.Type}, + ) + } + + var count int64 + var err error + condition := "cloudbrain.user_id = `user`.id" + if len(opts.Keyword) == 0 { + count, err = sess.Where(cond).Count(new(Cloudbrain)) + } else { + lowerKeyWord := strings.ToLower(opts.Keyword) + + cond = cond.And(builder.Or(builder.Like{"LOWER(cloudbrain.job_name)", lowerKeyWord}, builder.Like{"LOWER(cloudbrain.display_job_name)", lowerKeyWord}, builder.Like{"`user`.lower_name", lowerKeyWord})) + count, err = sess.Table(&Cloudbrain{}).Where(cond). + Join("left", "`user`", condition).Count(new(CloudbrainInfo)) + + } + + if err != nil { + return nil, 0, fmt.Errorf("Count: %v", err) + } + + if opts.Page >= 0 && opts.PageSize > 0 { + var start int + if opts.Page == 0 { + start = 0 + } else { + start = (opts.Page - 1) * opts.PageSize + } + sess.Limit(opts.PageSize, start) + } + + sess.OrderBy("cloudbrain.created_unix DESC") + cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) + if err := sess.Table(&Cloudbrain{}).Unscoped().Where(cond). + Join("left", "`user`", condition). + Find(&cloudbrains); err != nil { + return nil, 0, fmt.Errorf("Find: %v", err) + } + if opts.NeedRepoInfo { + var ids []int64 + for _, task := range cloudbrains { + ids = append(ids, task.RepoID) + } + repositoryMap, err := GetRepositoriesMapByIDs(ids) + if err == nil { + for _, task := range cloudbrains { + task.Repo = repositoryMap[task.RepoID] + } + } + + } + + return cloudbrains, count, nil +} diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index d26065363..63b5735c7 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1004,7 +1004,9 @@ modelarts.train_job.basic_info=基本信息 modelarts.train_job.job_status=任务状态 modelarts.train_job.job_name=任务名称 modelarts.train_job.version=任务版本 -modelarts.train_job.start_time=开始时间 +modelarts.train_job.start_time=开始运行时间 +modelarts.train_job.end_time=运行结束时间 +modelarts.train_job.wait_time=等待时间 modelarts.train_job.dura_time=运行时长 modelarts.train_job.description=任务描述 modelarts.train_job.parameter_setting=参数设置 diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 1868edcb5..6b9b7005e 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -555,6 +555,10 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/query_user_last_month", operationReq, repo_ext.QueryUserStaticLastMonth) m.Get("/query_user_yesterday", operationReq, repo_ext.QueryUserStaticYesterday) m.Get("/query_user_all", operationReq, repo_ext.QueryUserStaticAll) + //cloudbrain board + m.Group("/cloudbrainboard", func() { + m.Get("/downloadAll", repo.DownloadCloudBrainBoard) + }, operationReq) // Users m.Group("/users", func() { m.Get("/search", user.Search) diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go new file mode 100644 index 000000000..0760aa194 --- /dev/null +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -0,0 +1,138 @@ +package repo + +import ( + "fmt" + "net/http" + "net/url" + "time" + + "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/log" + "github.com/360EntSecGroup-Skylar/excelize/v2" +) + +func DownloadCloudBrainBoard(ctx *context.Context) { + + page := 1 + + pageSize := 300 + + var cloudBrain = ctx.Tr("repo.cloudbrain") + fileName := getCloudbrainFileName(cloudBrain) + + _, total, err := models.CloudbrainAll(&models.CloudbrainsOptions{ + ListOptions: models.ListOptions{ + Page: page, + PageSize: 1, + }, + Type: models.TypeCloudBrainAll, + NeedRepoInfo: false, + }) + + if err != nil { + log.Warn("Can not get cloud brain info", err) + ctx.Error(http.StatusBadRequest, ctx.Tr("repo.cloudbrain_query_fail")) + return + } + + totalPage := getTotalPage(total, pageSize) + fmt.Printf("total:%v", total) + fmt.Printf("totalPage:%v", totalPage) + + f := excelize.NewFile() + + index := f.NewSheet(cloudBrain) + f.DeleteSheet("Sheet1") + + for k, v := range allCloudbrainHeader(ctx) { + f.SetCellValue(cloudBrain, k, v) + } + + var row = 2 + for i := 0; i < totalPage; i++ { + + pageRecords, _, err := models.CloudbrainAll(&models.CloudbrainsOptions{ + ListOptions: models.ListOptions{ + Page: page, + PageSize: pageSize, + }, + Type: models.TypeCloudBrainAll, + NeedRepoInfo: true, + }) + if err != nil { + log.Warn("Can not get cloud brain info", err) + continue + } + for _, record := range pageRecords { + + for k, v := range allCloudbrainValues(row, record, ctx) { + f.SetCellValue(cloudBrain, k, v) + } + row++ + + } + + page++ + } + f.SetActiveSheet(index) + + ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(fileName)) + ctx.Resp.Header().Set("Content-Type", "application/octet-stream") + + f.WriteTo(ctx.Resp) +} +func getCloudbrainFileName(baseName string) string { + return baseName + "_" + time.Now().Format(EXCEL_DATE_FORMAT) + ".xlsx" + +} +func allCloudbrainHeader(ctx *context.Context) map[string]string { + + return map[string]string{"A1": ctx.Tr("repo.cloudbrain_task"), "B1": ctx.Tr("repo.cloudbrain_task_type"), "C1": ctx.Tr("repo.modelarts.status"), + "D1": ctx.Tr("repo.modelarts.createtime"), "E1": ctx.Tr("repo.modelarts.train_job.wait_time"), "F1": ctx.Tr("repo.modelarts.train_job.dura_time"), + "G1": ctx.Tr("repo.modelarts.train_job.start_time"), + "H1": ctx.Tr("repo.modelarts.train_job.end_time"), "I1": ctx.Tr("repo.modelarts.computing_resources"), + "J1": ctx.Tr("repo.cloudbrain_creator"), "K1": ctx.Tr("repo.repo_name"), "L1": ctx.Tr("repo.cloudbrain_task_name")} + +} +func allCloudbrainValues(row int, rs *models.CloudbrainInfo, ctx *context.Context) map[string]string { + return map[string]string{getCellName("A", row): rs.DisplayJobName, getCellName("B", row): rs.JobType, getCellName("C", row): rs.Status, + getCellName("D", row): time.Unix(int64(rs.Cloudbrain.CreatedUnix), 0).Format(CREATE_TIME_FORMAT), getCellName("E", row): getBrainWaitTime(rs), + getCellName("F", row): rs.TrainJobDuration, getCellName("G", row): getBrainStartTime(rs), + getCellName("H", row): getBrainEndTime(rs), + getCellName("I", row): rs.ComputeResource, getCellName("J", row): rs.Name, getCellName("K", row): getBrainRepo(rs), + getCellName("L", row): rs.JobName, + } +} +func getBrainRepo(rs *models.CloudbrainInfo) string { + if rs.Repo != nil { + return rs.Repo.OwnerName + "/" + rs.Repo.Alias + } + return "" +} +func getBrainStartTime(rs *models.CloudbrainInfo) string { + timeString := time.Unix(int64(rs.Cloudbrain.StartTime), 0).Format(CREATE_TIME_FORMAT) + if timeString != "1970/01/01 08:00:00" { + return timeString + } else { + return "0" + } + +} +func getBrainEndTime(rs *models.CloudbrainInfo) string { + timeString := time.Unix(int64(rs.Cloudbrain.EndTime), 0).Format(CREATE_TIME_FORMAT) + if timeString != "1970/01/01 08:00:00" { + return timeString + } else { + return "0" + } + +} +func getBrainWaitTime(rs *models.CloudbrainInfo) string { + waitTime := rs.Cloudbrain.StartTime - rs.Cloudbrain.CreatedUnix + if waitTime <= 0 { + return "0" + } else { + return models.ConvertDurationToStr(int64(waitTime)) + } +} From f8b3f313413a6306e3111eeb8fe881e7c825016a Mon Sep 17 00:00:00 2001 From: liuzx Date: Tue, 12 Apr 2022 10:11:37 +0800 Subject: [PATCH 03/20] fix-1656 --- web_src/js/components/BrainAnalysis.vue | 86 +++++++++++++++++++++++++ web_src/js/components/DataAnalysis.vue | 10 +++ 2 files changed, 96 insertions(+) create mode 100644 web_src/js/components/BrainAnalysis.vue diff --git a/web_src/js/components/BrainAnalysis.vue b/web_src/js/components/BrainAnalysis.vue new file mode 100644 index 000000000..4950c3241 --- /dev/null +++ b/web_src/js/components/BrainAnalysis.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/web_src/js/components/DataAnalysis.vue b/web_src/js/components/DataAnalysis.vue index ae536db28..7b81e9b9f 100755 --- a/web_src/js/components/DataAnalysis.vue +++ b/web_src/js/components/DataAnalysis.vue @@ -26,6 +26,14 @@ + + + + + + 云脑分析 + + @@ -33,12 +41,14 @@ + \ No newline at end of file diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 4f25e5ffd..9ca50780f 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -871,14 +871,13 @@ display: block; line-height: 28px; } .org_icon{ - margin-top: 10px; + margin-top: 2px; margin-right: 10px; padding-left: 15px; + width: 100% ; + text-align: center ; } -.org_icon_num{ - margin-left: 2px; - margin-right: 13px; -} + .org_icon_color{ color: #FA8C16; } @@ -894,6 +893,26 @@ display: block; list-style:none; margin-left: 2px; } +.score{ + position:absolute; + width: 50px; + right:50px; + text-align: center; +} +.wi{ + width: 15%; + line-height: 20px; +} + +.title_icon{ + vertical-align: sub; + font-size: 24px; +} +.title_word{ + vertical-align: middle; + font-size: 18px; + margin-top:1px; +} /**seach**/ /**搜索导航条适配窄屏**/ .seachnav{ From 095d71d752a54d2da0902ce3c32bc2e81c6d1553 Mon Sep 17 00:00:00 2001 From: wangjr Date: Tue, 12 Apr 2022 10:50:00 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 4 ++-- web_src/less/openi.less | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 7f99f1aee..1f8fe5132 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -130,7 +130,7 @@
-
+

{{$.i18n.Tr "org.member"}}

  • @@ -178,7 +178,7 @@
  • -
    +

    {{$.i18n.Tr "org.active"}}

  • diff --git a/web_src/less/openi.less b/web_src/less/openi.less index c173db1cb..70f643380 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -830,6 +830,7 @@ display: block; font-size: 14px; text-align: center; font-family: SourceHanSansSC-light; + font-weight: normal !important; } .title_re{ margin-top: 50px !important; From b867eee4a512365b0453c4d1d165bb10b169ca54 Mon Sep 17 00:00:00 2001 From: wangjr Date: Tue, 12 Apr 2022 10:54:30 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 1f8fe5132..61574d19a 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -83,7 +83,7 @@
    -

    {{$.i18n.Tr "org.star"}}

    +

    {{$.i18n.Tr "org.star"}}

  • {{ range $i,$user :=.StarOrgs}} From dd42863c11484e0284ceeafd82bf2b69bc67502a Mon Sep 17 00:00:00 2001 From: wangjr Date: Tue, 12 Apr 2022 11:46:06 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BC=94=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 11 +++++++---- web_src/less/openi.less | 6 +++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 61574d19a..6d308161d 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -117,7 +117,7 @@
  • -

    {{$user.Name}}

    + {{$user.Name}}
    • @@ -165,7 +165,7 @@
    • -

      {{$user.Name}}

      + {{$user.Name}}
    • @@ -273,4 +273,7 @@ window.onload = function() { } - \ No newline at end of file + + \ No newline at end of file diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 70f643380..f7283f69f 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -888,7 +888,11 @@ display: block; width: 100% ; text-align: center ; } - +.re_style{ + color: rgba(3, 102, 214, 100) !important; + font-family:SourceHanSansSC-medium; + font-weight: 700; +} .org_icon_color{ color: #FA8C16; } From 21d6b548cb42d33f2dff4967508b00c34695ca66 Mon Sep 17 00:00:00 2001 From: OpenIhu Date: Tue, 12 Apr 2022 14:33:54 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E5=85=AC=E5=91=8Adiv=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/base/head_notice.tmpl | 4 ++-- templates/org/member/members.tmpl | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/templates/base/head_notice.tmpl b/templates/base/head_notice.tmpl index 88615cc38..43c581e6e 100644 --- a/templates/base/head_notice.tmpl +++ b/templates/base/head_notice.tmpl @@ -1,7 +1,7 @@ {{if not .IsCourse}} {{ if .notices}}
      -
      +
      {{ $firstTag := true }} {{range .notices.Notices}} @@ -25,7 +25,7 @@
      - + {{end}} diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 87189c015..9c45007e5 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -4,18 +4,19 @@
      {{template "base/alert" .}} {{template "org/navber" .}} -
      - +
      {{ range .Members}}
      -
      +
      +
      {{.FullName}}
      -
      +
      +
      {{$.i18n.Tr "org.members.membership_visibility"}}
      @@ -29,14 +30,16 @@ {{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}({{$.i18n.Tr "org.members.private_helper"}}){{end}} {{end}}
      -
      +
      +
      {{$.i18n.Tr "org.members.member_role"}}
      {{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock" 16}} {{$.i18n.Tr "org.members.owner"}}{{else}}{{$.i18n.Tr "org.members.member"}}{{end}}
      -
      +
      +
      2FA
      @@ -49,7 +52,8 @@ {{end}}
      -
      +
      +
      {{if eq $.SignedUser.ID .ID}}
      From 21f369317f5de6ead8de5327b25e212f10c78c59 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 12 Apr 2022 15:02:26 +0800 Subject: [PATCH 09/20] fix issue --- web_src/js/index.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 7df46e139..71300de9f 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2768,8 +2768,13 @@ $(document).ready(async () => { const $dropzone = $('#dropzone'); if ($dropzone.length > 0) { const filenameDict = {}; - let maxFileTooltips=$dropzone.data('max-file-tooltips').format($dropzone.data('max-file'),$dropzone.data('max-size')) - let maxSizeTooltips=$dropzone.data('max-size-tooltips').format($dropzone.data('max-file')) + let maxFileTooltips + let maxSizeTooltips + if($dropzone.data('max-file-tooltips')&&$dropzone.data('max-size-tooltips')){ + maxFileTooltips=$dropzone.data('max-file-tooltips').format($dropzone.data('max-file'),$dropzone.data('max-size')) + maxSizeTooltips=$dropzone.data('max-size-tooltips').format($dropzone.data('max-file')) + } + await createDropzone('#dropzone', { url: $dropzone.data('upload-url'), headers: {'X-Csrf-Token': csrf}, @@ -2804,17 +2809,23 @@ $(document).ready(async () => { this.on('addedfile',(file)=>{ if(file.size/(1000*1000)>$dropzone.data('max-size')){ this.removeFile(file) - $('.maxfilesize.ui.red.message').text(maxFileTooltips) - $('.maxfilesize.ui.red.message').css('display','block') + if(maxFileTooltips){ + $('.maxfilesize.ui.red.message').text(maxFileTooltips) + $('.maxfilesize.ui.red.message').css('display','block') + } }else{ - $('.maxfilesize.ui.red.message').css('display','none') + if(maxFileTooltips){ + $('.maxfilesize.ui.red.message').css('display','none') + } } }); this.on('maxfilesexceeded',(file)=>{ this.removeFile(file) - $('.maxfilesize.ui.red.message').text(maxSizeTooltips) - $('.maxfilesize.ui.red.message').css('display','block') + if(maxSizeTooltips){ + $('.maxfilesize.ui.red.message').text(maxSizeTooltips) + $('.maxfilesize.ui.red.message').css('display','block') + } }) } From 94f71ebb94b999c7f3d3b3749432103c4d52f94a Mon Sep 17 00:00:00 2001 From: OpenIhu Date: Tue, 12 Apr 2022 15:03:02 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=88=90=E5=91=98=E6=A0=87=E7=AD=BE=E5=9C=A8=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E4=B8=8D=E8=83=BD=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/less/openi.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/openi.less b/web_src/less/openi.less index c50598bc8..9c9e8694a 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -717,7 +717,7 @@ display: block; #repo-files-table .age, #repo-files-table .ui.sha.label, #repo-files-table .commit-button, - .members + .repository .members { display: none !important; } From f14d5dc46d52672e4f842ead3cd1f7a4aa17a8de Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 13 Apr 2022 09:15:58 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/cloudbrain/trainjob/show.tmpl | 4 ++-- templates/repo/modelarts/notebook/show.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 324c19ac6..03673c072 100755 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -286,7 +286,7 @@ td, th {
      - {{$.resource_spec}} + {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{$.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{$.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{$.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{$.ShareMemMiB}}
      @@ -299,7 +299,7 @@ td, th { - 镜像 + {{$.i18n.Tr "cloudbrain.mirror"}} diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 4bb049a94..17002bef6 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -207,7 +207,7 @@ td, th {
      - +
      @@ -369,7 +369,7 @@ td, th { - {{$.i18n.Tr "repo.modelarts.train_job.start_time"}} + {{$.i18n.Tr "repo.cloudbrain.time.starttime"}} From da3876672f7b7200b6d3e922293783c2a75755fa Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 13 Apr 2022 09:34:37 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 0d007a27d..6a94943a0 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -438,7 +438,9 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo if cloudbrain.ResourceSpecs == nil { json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) } + for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { + log.Info("tmp.id=" + fmt.Sprint(tmp.Id) + " task.ResourceSpecId=" + fmt.Sprint(task.ResourceSpecId)) if tmp.Id == task.ResourceSpecId { ctx.Data["GpuNum"] = tmp.GpuNum ctx.Data["CpuNum"] = tmp.CpuNum From e18e2e061be7420905a65165946b72bcc5c4b017 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 13 Apr 2022 09:43:05 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 6a94943a0..25609b260 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -435,17 +435,30 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo return } - if cloudbrain.ResourceSpecs == nil { - json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) - } - - for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { - log.Info("tmp.id=" + fmt.Sprint(tmp.Id) + " task.ResourceSpecId=" + fmt.Sprint(task.ResourceSpecId)) - if tmp.Id == task.ResourceSpecId { - ctx.Data["GpuNum"] = tmp.GpuNum - ctx.Data["CpuNum"] = tmp.CpuNum - ctx.Data["MemMiB"] = tmp.MemMiB - ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB + if task.JobType == string(models.JobTypeTrain) { + if cloudbrain.TrainResourceSpecs == nil { + json.Unmarshal([]byte(setting.TrainResourceSpecs), &cloudbrain.TrainResourceSpecs) + } + for _, tmp := range cloudbrain.TrainResourceSpecs.ResourceSpec { + if tmp.Id == task.ResourceSpecId { + ctx.Data["GpuNum"] = tmp.GpuNum + ctx.Data["CpuNum"] = tmp.CpuNum + ctx.Data["MemMiB"] = tmp.MemMiB + ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB + } + } + } else { + if cloudbrain.ResourceSpecs == nil { + json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) + } + for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { + log.Info("tmp.id=" + fmt.Sprint(tmp.Id) + " task.ResourceSpecId=" + fmt.Sprint(task.ResourceSpecId)) + if tmp.Id == task.ResourceSpecId { + ctx.Data["GpuNum"] = tmp.GpuNum + ctx.Data["CpuNum"] = tmp.CpuNum + ctx.Data["MemMiB"] = tmp.MemMiB + ctx.Data["ShareMemMiB"] = tmp.ShareMemMiB + } } } From 49ca84fcaf7f59d5577473482a3f33cf03619824 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 13 Apr 2022 09:56:10 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 1 - 1 file changed, 1 deletion(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 25609b260..16127f366 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -452,7 +452,6 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo json.Unmarshal([]byte(setting.ResourceSpecs), &cloudbrain.ResourceSpecs) } for _, tmp := range cloudbrain.ResourceSpecs.ResourceSpec { - log.Info("tmp.id=" + fmt.Sprint(tmp.Id) + " task.ResourceSpecId=" + fmt.Sprint(task.ResourceSpecId)) if tmp.Id == task.ResourceSpecId { ctx.Data["GpuNum"] = tmp.GpuNum ctx.Data["CpuNum"] = tmp.CpuNum From 3e7061881cae03900fed4d8b0ba7d9aa6a68e52e Mon Sep 17 00:00:00 2001 From: liuzx Date: Wed, 13 Apr 2022 10:03:59 +0800 Subject: [PATCH 15/20] fix-1875 --- routers/api/v1/repo/cloudbrain_dashboard.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go index 0760aa194..b979729a8 100644 --- a/routers/api/v1/repo/cloudbrain_dashboard.go +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -1,7 +1,6 @@ package repo import ( - "fmt" "net/http" "net/url" "time" @@ -37,8 +36,6 @@ func DownloadCloudBrainBoard(ctx *context.Context) { } totalPage := getTotalPage(total, pageSize) - fmt.Printf("total:%v", total) - fmt.Printf("totalPage:%v", totalPage) f := excelize.NewFile() From dee2d4acbc26da4c10a26cce159cbdf947486c39 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 13 Apr 2022 10:20:02 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/org.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/org.go b/models/org.go index 28a6701c5..2a6528023 100755 --- a/models/org.go +++ b/models/org.go @@ -193,22 +193,22 @@ func (org *User) getOrgStatistics() (int, error) { } func FindTopNStarsOrgs(n int) ([]*OrgScore, error) { - sql := "select a.id,sum(b.num_stars) score from \"user\" a ,repository b where a.id=b.owner_id and a.type=1 group by a.id order by score desc limit " + strconv.Itoa(n) + sql := "select a.id,sum(b.num_stars) score from \"user\" a ,repository b where a.id=b.owner_id and a.type=1 and a.visibility=0 group by a.id order by score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) } func FindTopNMembersOrgs(n int) ([]*OrgScore, error) { sql := "select id, count(user_id) score from" + - " (select org_id as id, uid as user_id from org_user " + + " (select org_id as id, uid as user_id from org_user o, \"user\" u where o.org_id=u.id and u.visibility=0 " + "union select a.id,b.user_id from \"user\" a,collaboration b,repository c " + - "where a.type=1 and a.id=c.owner_id and b.repo_id=c.id) d " + + "where a.type=1 and a.visibility=0 and a.id=c.owner_id and b.repo_id=c.id) d " + "group by id order by score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) } func FindTopNOpenIOrgs(n int) ([]*OrgScore, error) { - sql := "select org_id id,num_score score from org_statistic order by num_score desc limit " + strconv.Itoa(n) + sql := "select org_id id,num_score score from org_statistic a, \"user\" b where a.org_id=b.id and b.visibility=0 order by num_score desc limit " + strconv.Itoa(n) return findTopNOrgs(sql) } From 6e36bb9f72fd8454c447f516244c0e4a4469ade3 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 13 Apr 2022 10:38:21 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- templates/repo/cloudbrain/show.tmpl | 54 +++++++++++++-------- templates/repo/modelarts/notebook/show.tmpl | 12 ++++- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index c2bd0744d..7e16c36ff 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -300,38 +300,32 @@ td, th {
      - + - {{$.i18n.Tr "repo.cloudbrain.time.starttime"}} + {{$.i18n.Tr "repo.modelarts.createtime"}} -
      - {{if not (eq .StartTime 0)}} - {{TimeSinceUnix1 .StartTime}} - {{else}} - -- - {{end}} +
      + {{TimeSinceUnix1 .CreatedUnix}}
      - + - {{$.i18n.Tr "repo.cloudbrain.time.endtime"}} + {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} -
      - {{if not (eq .EndTime 0)}} - {{TimeSinceUnix1 .EndTime}} - {{else}} - -- - {{end}} +
      + {{$.duration}}
      + +
      @@ -405,18 +399,38 @@ td, th {
      - - {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} + {{$.i18n.Tr "repo.cloudbrain.time.starttime"}} -
      - {{$.duration}} +
      + {{if not (eq .StartTime 0)}} + {{TimeSinceUnix1 .StartTime}} + {{else}} + -- + {{end}} +
      + + + + + + {{$.i18n.Tr "repo.cloudbrain.time.endtime"}} + + + +
      + {{if not (eq .EndTime 0)}} + {{TimeSinceUnix1 .EndTime}} + {{else}} + -- + {{end}}
      + diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 17002bef6..0d7a01efb 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -285,7 +285,17 @@ td, th {
      - + + + {{$.i18n.Tr "repo.modelarts.createtime"}} + + + +
      + {{TimeSinceUnix1 .CreatedUnix}} +
      + + From 6edd006ecddd41ddb44d7f9ddecd34fd98a729de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A00=E8=80=81=E8=99=8E?= Date: Wed, 13 Apr 2022 16:06:15 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=8F=8A=E5=9B=A2=E9=98=9F=E9=80=82=E9=85=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/org/member/members.tmpl | 12 ++++++------ templates/org/team/teams.tmpl | 2 +- web_src/less/openi.less | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 9c45007e5..3f5b44b95 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -9,14 +9,14 @@
      {{ range .Members}}
      -
      +
      -
      +
      {{.FullName}}
      -
      +
      {{$.i18n.Tr "org.members.membership_visibility"}}
      @@ -31,7 +31,7 @@ {{end}}
      -
      +
      {{$.i18n.Tr "org.members.member_role"}}
      @@ -39,7 +39,7 @@ {{if index $.MembersIsUserOrgOwner .ID}}{{svg "octicon-shield-lock" 16}} {{$.i18n.Tr "org.members.owner"}}{{else}}{{$.i18n.Tr "org.members.member"}}{{end}}
      -
      +
      2FA
      @@ -53,7 +53,7 @@
      -
      +
      {{if eq $.SignedUser.ID .ID}} diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index bc7f5febd..cac7729cc 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -9,7 +9,7 @@
      -
      +
      {{range .Teams}}
      diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 9c9e8694a..212d7be61 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -761,7 +761,7 @@ display: block; padding-top: 0; padding-bottom: 0; } - .ui.attached:not(.message)+.ui.attached.segment:not(.top){ + .repository .ui.attached:not(.message)+.ui.attached.segment:not(.top){ border: none; } .markdown:not(code).file-view{ From 8a06b1109abe1bc7e8f05e452ec10cf249f27a92 Mon Sep 17 00:00:00 2001 From: wangjr Date: Wed, 13 Apr 2022 16:26:16 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/explore/organizations.tmpl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/explore/organizations.tmpl b/templates/explore/organizations.tmpl index 6d308161d..5faf039af 100644 --- a/templates/explore/organizations.tmpl +++ b/templates/explore/organizations.tmpl @@ -91,19 +91,19 @@ {{if eq $i 0}}
    • - +
    • {{else if eq $i 1}}
    • - +
    • {{else if eq $i 2}}
    • - +
    • {{else }} @@ -139,19 +139,19 @@ {{if eq $i 0}}
    • - +
    • {{else if eq $i 1}}
    • - +
    • {{else if eq $i 2}}
    • - +
    • {{else }} @@ -187,19 +187,19 @@ {{if eq $i 0}}
    • - +
    • {{else if eq $i 1}}
    • - +
    • {{else if eq $i 2}}
    • - +
    • {{else }} From c893c3e00fa8dcb854d0ac9495edfa116698c5a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A00=E8=80=81=E8=99=8E?= Date: Wed, 13 Apr 2022 16:50:06 +0800 Subject: [PATCH 20/20] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=9C=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8D=A2=E8=A1=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/org/member/members.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 3f5b44b95..0f862da7a 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -12,7 +12,7 @@
      -
      +
      {{.FullName}}