From ba2734bf5d8285ee97aa1b1bfa1b767c859e20b0 Mon Sep 17 00:00:00 2001 From: wangjr Date: Thu, 30 Dec 2021 15:24:31 +0800 Subject: [PATCH 1/6] #887 --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + templates/base/footer_content.tmpl | 1 + templates/base/footer_content_fluid.tmpl | 1 + templates/base/head_navbar.tmpl | 8 ++++++++ templates/base/head_navbar_fluid.tmpl | 8 ++++++++ templates/base/head_navbar_home.tmpl | 8 ++++++++ templates/base/head_navbar_pro.tmpl | 8 ++++++++ web_src/less/openi.less | 4 ++++ 9 files changed, 40 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 35f0a98bf..d15d97e38 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2659,3 +2659,4 @@ foot.member_news = Member news foot.industry_advisory = Industry Advisory foot.help = help foot.copyright= Copyright: New Generation Artificial Intelligence Open Source Open Platform (OpenI) +Platform_Tutorial=Platform Tutorial diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 0389471c2..ebfdb5281 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2667,3 +2667,4 @@ foot.member_news=成员动态 foot.industry_advisory=行业资讯 foot.help=帮助 foot.copyright= 版权所有:新一代人工智能开源开放平台(OpenI) +Platform_Tutorial=新手指引 diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl index 86ef0d98e..a5c1e060b 100755 --- a/templates/base/footer_content.tmpl +++ b/templates/base/footer_content.tmpl @@ -26,6 +26,7 @@ {{end}} + {{.i18n.Tr "custom.Platform_Tutorial"}} {{if .EnableSwagger}}API{{end}} {{template "custom/extra_links_footer" .}} diff --git a/templates/base/footer_content_fluid.tmpl b/templates/base/footer_content_fluid.tmpl index e07a4d5ab..f742a66e2 100644 --- a/templates/base/footer_content_fluid.tmpl +++ b/templates/base/footer_content_fluid.tmpl @@ -26,6 +26,7 @@ {{end}} + {{.i18n.Tr "custom.Platform_Tutorial"}} {{if .EnableSwagger}}API{{end}} {{template "custom/extra_links_footer" .}} diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 53d0f8839..506f8792a 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -168,6 +168,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/templates/base/head_navbar_fluid.tmpl b/templates/base/head_navbar_fluid.tmpl index 32ad7ca2f..f364518cc 100644 --- a/templates/base/head_navbar_fluid.tmpl +++ b/templates/base/head_navbar_fluid.tmpl @@ -166,6 +166,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/templates/base/head_navbar_home.tmpl b/templates/base/head_navbar_home.tmpl index 4cd35da76..539b8bc21 100644 --- a/templates/base/head_navbar_home.tmpl +++ b/templates/base/head_navbar_home.tmpl @@ -148,6 +148,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/templates/base/head_navbar_pro.tmpl b/templates/base/head_navbar_pro.tmpl index bacd19944..45b1e7925 100644 --- a/templates/base/head_navbar_pro.tmpl +++ b/templates/base/head_navbar_pro.tmpl @@ -169,6 +169,14 @@ {{svg "octicon-question" 16}} {{.i18n.Tr "help"}} + + + + + + + {{.i18n.Tr "custom.Platform_Tutorial"}} + {{if .IsAdmin}}
diff --git a/web_src/less/openi.less b/web_src/less/openi.less index ab788bcf4..4418f8205 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -585,3 +585,7 @@ display: block; margin-top: 0.7rem; color: #888888; } +.tutorial_icon{ + vertical-align: middle; + margin-right: 0.75em; +} \ No newline at end of file From 94077bafec3990bebad4d5c6e8415cb41bd511dc Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 30 Dec 2021 16:45:28 +0800 Subject: [PATCH 2/6] fix 1233 --- modules/util/util.go | 10 ++++++++++ routers/api/v1/repo/modelarts.go | 12 ++---------- routers/repo/cloudbrain.go | 8 ++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) mode change 100644 => 100755 modules/util/util.go diff --git a/modules/util/util.go b/modules/util/util.go old mode 100644 new mode 100755 index 6d02b5f52..017277281 --- a/modules/util/util.go +++ b/modules/util/util.go @@ -6,6 +6,7 @@ package util import ( "bytes" + "strconv" "strings" ) @@ -100,3 +101,12 @@ func NormalizeEOL(input []byte) []byte { } return tmp[:pos] } + +func AddZero(t int64) (m string) { + if t < 10 { + m = "0" + strconv.FormatInt(t, 10) + return m + } else { + return strconv.FormatInt(t, 10) + } +} diff --git a/routers/api/v1/repo/modelarts.go b/routers/api/v1/repo/modelarts.go index 283696007..05c31b5f5 100755 --- a/routers/api/v1/repo/modelarts.go +++ b/routers/api/v1/repo/modelarts.go @@ -6,6 +6,7 @@ package repo import ( + "code.gitea.io/gitea/modules/util" "net/http" "strconv" "strings" @@ -106,7 +107,7 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { job.TrainJobDuration = result.TrainJobDuration if result.Duration != 0 { - job.TrainJobDuration = addZero(result.Duration/3600000) + ":" + addZero(result.Duration%3600000/60000) + ":" + addZero(result.Duration%60000/1000) + job.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) } else { job.TrainJobDuration = "00:00:00" @@ -125,15 +126,6 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { } -func addZero(t int64) (m string) { - if t < 10 { - m = "0" + strconv.FormatInt(t, 10) - return m - } else { - return strconv.FormatInt(t, 10) - } -} - func TrainJobGetLog(ctx *context.APIContext) { var ( err error diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index ab3303408..5bf72ede6 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -2,6 +2,7 @@ package repo import ( "bufio" + "code.gitea.io/gitea/modules/util" "encoding/json" "errors" "fmt" @@ -949,6 +950,13 @@ func SyncCloudbrainStatus() { task.Duration = result.Duration task.TrainJobDuration = result.TrainJobDuration + if result.Duration != 0 { + task.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) + + } else { + task.TrainJobDuration = "00:00:00" + } + err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err) From b606b2fbf8e3d4a6c23f35b53f4b0b9daa5dfda4 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 30 Dec 2021 16:50:50 +0800 Subject: [PATCH 3/6] format --- routers/repo/cloudbrain.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 5bf72ede6..b24b4e90e 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -2,7 +2,6 @@ package repo import ( "bufio" - "code.gitea.io/gitea/modules/util" "encoding/json" "errors" "fmt" @@ -15,18 +14,17 @@ import ( "strings" "time" - "code.gitea.io/gitea/modules/modelarts" - - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/storage" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/cloudbrain" "code.gitea.io/gitea/modules/context" + "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/modelarts" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/storage" + "code.gitea.io/gitea/modules/util" ) const ( @@ -278,7 +276,7 @@ func CloudBrainRestart(ctx *context.Context) { break } - if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()){ + if !ctx.IsSigned || (ctx.User.ID != task.UserID && !ctx.IsUserSiteAdmin()) { log.Error("the user has no right ro restart the job", task.JobName, ctx.Data["MsgID"]) resultCode = "-1" errorMsg = "you have no right to restart the job" From 68d9c7d3b70b3eb3d7cd62d819efcfa903d1be5a Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 30 Dec 2021 18:30:59 +0800 Subject: [PATCH 4/6] mod computeresource --- modules/modelarts/modelarts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index 06eac1665..3f7ebfd91 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -357,7 +357,7 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job CommitID: req.CommitID, IsLatestVersion: req.IsLatestVersion, PreVersionName: req.PreVersionName, - ComputeResource: models.GPUResource, + ComputeResource: models.NPUResource, EngineID: req.EngineID, TrainUrl: req.TrainUrl, BranchName: req.BranchName, From 58d3fe517923b61ed37391f49bf03f1f18847796 Mon Sep 17 00:00:00 2001 From: wangjr Date: Fri, 31 Dec 2021 09:01:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?#886=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E6=84=8F=E8=A7=81=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_en-US.ini | 4 ++++ options/locale/locale_zh-CN.ini | 4 ++++ templates/base/footer_content.tmpl | 6 ++++++ templates/base/footer_content_fluid.tmpl | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d15d97e38..95c193dc9 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2659,4 +2659,8 @@ foot.member_news = Member news foot.industry_advisory = Industry Advisory foot.help = help foot.copyright= Copyright: New Generation Artificial Intelligence Open Source Open Platform (OpenI) +<<<<<<< Updated upstream Platform_Tutorial=Platform Tutorial +======= +foot.advice_feedback=advice feedback +>>>>>>> Stashed changes diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index ebfdb5281..d09c120b9 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2667,4 +2667,8 @@ foot.member_news=成员动态 foot.industry_advisory=行业资讯 foot.help=帮助 foot.copyright= 版权所有:新一代人工智能开源开放平台(OpenI) +<<<<<<< Updated upstream Platform_Tutorial=新手指引 +======= +foot.advice_feedback = 意见反馈 +>>>>>>> Stashed changes diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl index a5c1e060b..9a708fc2c 100755 --- a/templates/base/footer_content.tmpl +++ b/templates/base/footer_content.tmpl @@ -28,6 +28,12 @@ {{.i18n.Tr "custom.Platform_Tutorial"}} {{if .EnableSwagger}}API{{end}} + {{if .IsSigned}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{else}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{end}} + {{template "custom/extra_links_footer" .}} diff --git a/templates/base/footer_content_fluid.tmpl b/templates/base/footer_content_fluid.tmpl index f742a66e2..8d9f2ba40 100644 --- a/templates/base/footer_content_fluid.tmpl +++ b/templates/base/footer_content_fluid.tmpl @@ -28,6 +28,11 @@ {{.i18n.Tr "custom.Platform_Tutorial"}} {{if .EnableSwagger}}API{{end}} + {{if .IsSigned}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{else}} + {{.i18n.Tr "custom.foot.advice_feedback"}} + {{end}} {{template "custom/extra_links_footer" .}} From fcd0fb2eae96bb4900848a9e891eb16e0504c9a2 Mon Sep 17 00:00:00 2001 From: wangjr Date: Fri, 31 Dec 2021 09:08:54 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_en-US.ini | 3 --- options/locale/locale_zh-CN.ini | 3 --- 2 files changed, 6 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 95c193dc9..272957887 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2659,8 +2659,5 @@ foot.member_news = Member news foot.industry_advisory = Industry Advisory foot.help = help foot.copyright= Copyright: New Generation Artificial Intelligence Open Source Open Platform (OpenI) -<<<<<<< Updated upstream Platform_Tutorial=Platform Tutorial -======= foot.advice_feedback=advice feedback ->>>>>>> Stashed changes diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index d09c120b9..efa730002 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -2667,8 +2667,5 @@ foot.member_news=成员动态 foot.industry_advisory=行业资讯 foot.help=帮助 foot.copyright= 版权所有:新一代人工智能开源开放平台(OpenI) -<<<<<<< Updated upstream Platform_Tutorial=新手指引 -======= foot.advice_feedback = 意见反馈 ->>>>>>> Stashed changes