From 4bd09396e4b1aa51f1e09d58e36665bb6c5867ba Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Mon, 11 Oct 2021 11:42:03 +0800 Subject: [PATCH 1/5] add creator-name --- models/cloudbrain.go | 13 ++++++++++--- routers/repo/cloudbrain.go | 3 ++- templates/repo/cloudbrain/index.tmpl | 2 +- templates/repo/modelarts/index.tmpl | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index 5be07f741..4f615ed00 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -65,6 +65,11 @@ type Cloudbrain struct { Repo *Repository `xorm:"-"` } +type CloudbrainInfo struct { + Cloudbrain `xorm:"extends"` + User `xorm:"extends"` +} + type CloudBrainLoginResult struct { Code string Msg string @@ -523,7 +528,7 @@ type NotebookDelResult struct { InstanceID string `json:"instance_id"` } -func Cloudbrains(opts *CloudbrainsOptions) ([]*Cloudbrain, int64, error) { +func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { sess := x.NewSession() defer sess.Close() @@ -583,8 +588,10 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*Cloudbrain, int64, error) { } sess.OrderBy("cloudbrain.created_unix DESC") - cloudbrains := make([]*Cloudbrain, 0, setting.UI.IssuePagingNum) - if err := sess.Where(cond).Find(&cloudbrains); err != nil { + cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) + if err := sess.Table(&Cloudbrain{}).Where(cond). + Join("left", "`user`", "cloudbrain.user_id = `user`.id"). + Find(&cloudbrains); err != nil { return nil, 0, fmt.Errorf("Find: %v", err) } sess.Close() diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index c30906af4..ccd51a89f 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -69,7 +69,8 @@ func CloudBrainIndex(ctx *context.Context) { timestamp := time.Now().Unix() for i, task := range ciTasks { - if task.Status == string(models.JobRunning) && (timestamp-int64(task.CreatedUnix) > 10) { + log.Info("", task.User.Name) + if task.Status == string(models.JobRunning) && (timestamp-int64(task.Cloudbrain.CreatedUnix) > 10) { ciTasks[i].CanDebug = true } else { ciTasks[i].CanDebug = false diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 532a8f4ff..1130c23d0 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -269,7 +269,7 @@ {{.Status}} - {{TimeSinceUnix .CreatedUnix $.Lang}} + {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
diff --git a/templates/repo/modelarts/index.tmpl b/templates/repo/modelarts/index.tmpl index a42f502d8..a81e47827 100755 --- a/templates/repo/modelarts/index.tmpl +++ b/templates/repo/modelarts/index.tmpl @@ -262,7 +262,7 @@ {{.Status}} - {{TimeSinceUnix .CreatedUnix $.Lang}} + {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
From 8dd9408651785d25ae63b5d517ade3d6f092815e Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Mon, 11 Oct 2021 15:13:49 +0800 Subject: [PATCH 2/5] fix issue 455 --- options/locale/locale_en-US.ini | 3 ++- options/locale/locale_zh-CN.ini | 1 + templates/repo/cloudbrain/index.tmpl | 12 ++++++++---- web_src/less/openi.less | 9 +++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 50e85ba27..acaf9bbb2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -573,7 +573,7 @@ authorized_oauth2_applications_description = You've granted access to your perso revoke_key = Revoke revoke_oauth2_grant = Revoke Access revoke_oauth2_grant_description = Revoking access for this third party application will prevent this application from accessing your data. Are you sure? -revoke_oauth2_grant_success = You've revoked access successfully. +revoke_oauth2_grant_success = You have revoked access successfully. twofa_desc = Two-factor authentication enhances the security of your account. twofa_is_enrolled = Your account is currently enrolled in two-factor authentication. @@ -770,6 +770,7 @@ cloudbrain_selection = select cloudbrain cloudbrain_platform_selection = Select the cloudbrain platform you want to use: confirm_choice = confirm cloudbran1_tips = Only data in zip format can create cloudbrain tasks +cloudbrain_creator=Creator template.items = Template Items template.git_content = Git Content (Default Branch) diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 89a6282e5..b4c198c99 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -772,6 +772,7 @@ cloudbrain_selection=云脑选择 cloudbrain_platform_selection=选择您准备使用的云脑平台: confirm_choice=确定 cloudbran1_tips=只有zip格式的数据集才能发起云脑任务 +cloudbrain_creator=创建者 template.items=模板选项 template.git_content=Git数据(默认分支) diff --git a/templates/repo/cloudbrain/index.tmpl b/templates/repo/cloudbrain/index.tmpl index 1130c23d0..e9e5c6bbf 100755 --- a/templates/repo/cloudbrain/index.tmpl +++ b/templates/repo/cloudbrain/index.tmpl @@ -256,10 +256,10 @@
-
- + @@ -272,7 +272,11 @@ {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
-
+
+ {{$.i18n.Tr "repo.cloudbrain_creator"}}{{.User.Name}} + +
+
{{if and (ne .Status "WAITING") (ne .JobType "DEBUG")}} diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 3c82606e9..40771d7a5 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -220,3 +220,12 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} .ui.vertical.menu .dropdown.item .menu { left: 50%; } +.text_over{ + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; + white-space: nowrap; + display: inline-block; + width: 100%; +} + From 985cd7010cad9dd4a46d8354530cceef0b7d518f Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 12 Oct 2021 09:34:36 +0800 Subject: [PATCH 3/5] fix issue #327 --- templates/repo/issue/labels.tmpl | 26 +++++++++++++------- templates/repo/issue/list.tmpl | 9 +++++-- templates/repo/issue/milestone_issues.tmpl | 10 ++++++-- templates/repo/issue/milestone_new.tmpl | 28 +++++++++++++++++----- templates/repo/issue/milestones.tmpl | 27 ++++++++++++++------- templates/repo/issue/navbar.tmpl | 2 +- templates/repo/issue/new.tmpl | 18 +++++++++++--- templates/repo/issue/view.tmpl | 9 +++++-- 8 files changed, 97 insertions(+), 32 deletions(-) diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl index d3df3b594..36683ca9b 100644 --- a/templates/repo/issue/labels.tmpl +++ b/templates/repo/issue/labels.tmpl @@ -2,14 +2,24 @@
{{template "repo/header" .}}
- +
+
+ +
+
+ {{template "repo/issue/navbar" .}} + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} +
+
{{.i18n.Tr "repo.issues.new_label"}}
+
+ {{end}} +
+ +
{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} {{template "repo/issue/labels/label_new" .}} diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index f64de74e8..a99205eea 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -3,14 +3,19 @@ {{template "repo/header" .}}
-
- {{template "repo/issue/navbar" .}} +
{{template "repo/issue/search" .}}
{{if not .Repository.IsArchived}}
+ {{template "repo/issue/navbar" .}} {{if .PageIsIssueList}} {{.i18n.Tr "repo.issues.new"}} {{else}} diff --git a/templates/repo/issue/milestone_issues.tmpl b/templates/repo/issue/milestone_issues.tmpl index a35dacbce..b8f68e025 100755 --- a/templates/repo/issue/milestone_issues.tmpl +++ b/templates/repo/issue/milestone_issues.tmpl @@ -3,8 +3,14 @@ {{template "repo/header" .}}
-
-

{{.Milestone.Name}}

+
+
diff --git a/templates/repo/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl index ea704c056..6f17f1b71 100644 --- a/templates/repo/issue/milestone_new.tmpl +++ b/templates/repo/issue/milestone_new.tmpl @@ -2,13 +2,29 @@
{{template "repo/header" .}}
-