From 06d52fbd1453632cb093464701dc20412725c989 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Fri, 5 Nov 2021 11:50:41 +0800 Subject: [PATCH 01/28] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E5=A2=9E=E9=87=8F=E6=95=B0=E6=8D=AE=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/repo_statistic.go | 4 ++-- routers/repo/repo_statistic.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/repo_statistic.go b/models/repo_statistic.go index adef672e0..825ef48a8 100755 --- a/models/repo_statistic.go +++ b/models/repo_statistic.go @@ -81,9 +81,9 @@ func DeleteRepoStatDaily(date string) error { return nil } -func GetRepoStatisticByDate(date string) ([]*RepoStatistic, error) { +func GetRepoStatisticByDate(date string, repoId int64) ([]*RepoStatistic, error) { repoStatistics := make([]*RepoStatistic, 0) - err := xStatistic.Where("date = ?", date).Find(&repoStatistics) + err := xStatistic.Where("date = ? and repo_id=?", date, repoId).Find(&repoStatistics) return repoStatistics, err } diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 2de22a1ee..6dbdc1ca2 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -115,7 +115,7 @@ func RepoStatisticDaily(date string) { } dayBeforeDate := t.AddDate(0, 0, -1).Format("2006-01-02") - repoStatisticsBefore, err := models.GetRepoStatisticByDate(dayBeforeDate) + repoStatisticsBefore, err := models.GetRepoStatisticByDate(dayBeforeDate, repo.ID) if err != nil { log.Error("get data of day before the date failed ", err) From c06dd3beba287df68a5897481bc606e14af5d8ba Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 29 Nov 2021 09:13:55 +0800 Subject: [PATCH 02/28] fix-990 fix-984 --- routers/api/v1/repo/repo_dashbord.go | 7 ++++--- routers/repo/repo_statistic.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index 2926fc4f2..a8887a744 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -5,6 +5,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "time" "github.com/360EntSecGroup-Skylar/excelize/v2" @@ -467,7 +468,7 @@ func generateCountSql(beginTime time.Time, endTime time.Time, latestDate string, "(SELECT repo_id,name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - countSql = countSql + " and B.name like '%" + q + "%'" + countSql = countSql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" } return countSql } @@ -488,7 +489,7 @@ func generateTypeAllSql(beginTime time.Time, endTime time.Time, latestDate strin " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and name like '%" + q + "%'" + sql = sql + " and LOWER(name) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql @@ -511,7 +512,7 @@ func generatePageSql(beginTime time.Time, endTime time.Time, latestDate string, "(SELECT repo_id,name,owner_name,is_private,radar_total from public.repo_statistic where date='" + latestDate + "') B" + " where A.repo_id=B.repo_id" if q != "" { - sql = sql + " and B.name like '%" + q + "%'" + sql = sql + " and LOWER(B.name) like '%" + strings.ToLower(q) + "%'" } sql = sql + " order by " + orderBy + " desc,A.repo_id" + " limit " + strconv.Itoa(pageSize) + " offset " + strconv.Itoa((page-1)*pageSize) return sql diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 92e29861d..11b421659 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -208,7 +208,7 @@ func RepoStatisticDaily(date string) { maxRepoRadar.Completeness = tempRepoStat.Completeness } - if tempRepoStat.Liveness < minRepoRadar.Completeness { + if tempRepoStat.Liveness < minRepoRadar.Liveness { minRepoRadar.Liveness = tempRepoStat.Liveness } From 884c57ac18aa728e412f44bee10371bde59eb6e8 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Nov 2021 10:12:05 +0800 Subject: [PATCH 03/28] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=89=93=E5=8D=B0=EF=BC=8C=E6=96=B9=E4=BE=BF?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E6=9C=8D=E5=8A=A1=E5=90=AF=E5=8A=A8=E7=AA=81?= =?UTF-8?q?=E7=84=B6=E5=8D=A1=E9=A1=BF=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- modules/setting/indexer.go | 1 + modules/setting/queue.go | 1 + modules/setting/webhook.go | 1 + routers/init.go | 6 ++++++ 4 files changed, 9 insertions(+) diff --git a/modules/setting/indexer.go b/modules/setting/indexer.go index 4d4df6201..abca79b7d 100644 --- a/modules/setting/indexer.go +++ b/modules/setting/indexer.go @@ -83,6 +83,7 @@ func newIndexerService() { Indexer.UpdateQueueLength = sec.Key("UPDATE_BUFFER_LEN").MustInt(20) Indexer.MaxIndexerFileSize = sec.Key("MAX_FILE_SIZE").MustInt64(1024 * 1024) Indexer.StartupTimeout = sec.Key("STARTUP_TIMEOUT").MustDuration(30 * time.Second) + log.Info("New IndexerService Inited.") } // IndexerGlobFromString parses a comma separated list of patterns and returns a glob.Glob slice suited for repo indexing diff --git a/modules/setting/queue.go b/modules/setting/queue.go index 8bdca1017..999d1afe0 100644 --- a/modules/setting/queue.go +++ b/modules/setting/queue.go @@ -160,6 +160,7 @@ func NewQueueService() { if _, ok := sectionMap["LENGTH"]; !ok { _, _ = section.NewKey("LENGTH", fmt.Sprintf("%d", Repository.PullRequestQueueLength)) } + log.Info("New QueueService Inited.") } // ParseQueueConnStr parses a queue connection string diff --git a/modules/setting/webhook.go b/modules/setting/webhook.go index 4a0c593c8..34cf8a62d 100644 --- a/modules/setting/webhook.go +++ b/modules/setting/webhook.go @@ -48,4 +48,5 @@ func newWebhookService() { } } Webhook.ProxyHosts = sec.Key("PROXY_HOSTS").Strings(",") + log.Info("New WebhookService Inited.") } diff --git a/routers/init.go b/routers/init.go index 26829d228..8b93b64d8 100755 --- a/routers/init.go +++ b/routers/init.go @@ -60,11 +60,17 @@ func NewServices() { if err := storage.Init(); err != nil { log.Fatal("storage init failed: %v", err) } + log.Info("storage init succeed.") mailer.NewContext() + log.Info("mailer.NewContext() succeed.") _ = cache.NewContext() + log.Info("cache.NewContext() succeed.") notification.NewContext() + log.Info("notification.NewContext() succeed.") decompression.NewContext() + log.Info("decompression.NewContext() succeed.") labelmsg.Init() + log.Info("labelmsg.Init() succeed.") } // In case of problems connecting to DB, retry connection. Eg, PGSQL in Docker Container on Synology From b69e3d81f09217f65eb3699db3f6099f665f4969 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 29 Nov 2021 10:53:53 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- modules/storage/storage.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/storage/storage.go b/modules/storage/storage.go index e0e875650..191871d93 100755 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -51,6 +51,7 @@ func Init() error { switch setting.Attachment.StoreType { case LocalStorageType: Attachments, err = NewLocalStorage(setting.Attachment.Path) + log.Info("local storage inited.") case MinioStorageType: minio := setting.Attachment.Minio Attachments, err = NewMinioStorage( @@ -62,6 +63,7 @@ func Init() error { minio.BasePath, minio.UseSSL, ) + log.Info("minio storage inited.") default: return fmt.Errorf("Unsupported attachment store type: %s", setting.Attachment.StoreType) } @@ -71,6 +73,7 @@ func Init() error { log.Error("obs.New failed:", err) return err } + log.Info("obs cli inited.") if err != nil { return err From 2bbd2e38061e6da5e710343be3ff68dbd12ecf4b Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Mon, 29 Nov 2021 11:49:58 +0800 Subject: [PATCH 05/28] fix 992 --- routers/repo/modelarts.go | 8 ++++++-- templates/repo/modelarts/trainjob/new.tmpl | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 069a1a0b5..ec65baaad 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -364,13 +364,17 @@ func trainJobNewDataPrepare(ctx *context.Context) error { Branches, err := ctx.Repo.GitRepo.GetBranches() if err != nil { + log.Error("GetBranches failed:%v", err) ctx.ServerError("GetBranches error:", err) return err } - ctx.Data["Branches"] = Branches + if Branches != nil { + ctx.Data["Branches"] = Branches + } + ctx.Data["BranchesCount"] = len(Branches) ctx.Data["params"] = "" - ctx.Data["BranchName"] = ctx.Repo.BranchName + ctx.Data["branchName"] = ctx.Repo.BranchName configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) if err != nil { diff --git a/templates/repo/modelarts/trainjob/new.tmpl b/templates/repo/modelarts/trainjob/new.tmpl index 1a2a3c9ce..537424859 100755 --- a/templates/repo/modelarts/trainjob/new.tmpl +++ b/templates/repo/modelarts/trainjob/new.tmpl @@ -183,9 +183,9 @@ {{end}} {{end}} {{else}} - + {{range $k, $v :=.Branches}} - {{ if ne $v $.BranchName }} + {{ if ne $v $.branchName }} {{end}} {{end}} From 388071465493e8574b678861b3edd1c8fa9c99db Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Mon, 29 Nov 2021 17:05:32 +0800 Subject: [PATCH 06/28] fix 902 --- models/user.go | 1 + modules/context/auth.go | 3 +-- modules/context/context.go | 1 + routers/api/v1/api.go | 20 ++++++++++++-------- routers/routes/routes.go | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/models/user.go b/models/user.go index 1ee20d74c..8968f7c02 100755 --- a/models/user.go +++ b/models/user.go @@ -145,6 +145,7 @@ type User struct { AllowImportLocal bool // Allow migrate repository by local path AllowCreateOrganization bool `xorm:"DEFAULT true"` ProhibitLogin bool `xorm:"NOT NULL DEFAULT false"` + IsOperator bool `xorm:"NOT NULL DEFAULT false"` //运营人员 // Avatar Avatar string `xorm:"VARCHAR(2048) NOT NULL"` diff --git a/modules/context/auth.go b/modules/context/auth.go index 3f53e6fce..9877657eb 100755 --- a/modules/context/auth.go +++ b/modules/context/auth.go @@ -145,8 +145,7 @@ func Toggle(options *ToggleOptions) macaron.Handler { } if options.OperationRequired { - //todo: add isOperator judgement - if !ctx.User.IsAdmin { + if !ctx.User.IsOperator { ctx.Error(403) return } diff --git a/modules/context/context.go b/modules/context/context.go index 6877780e3..5f09e190d 100755 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -310,6 +310,7 @@ func Contexter() macaron.Handler { ctx.Data["SignedUserID"] = ctx.User.ID ctx.Data["SignedUserName"] = ctx.User.Name ctx.Data["IsAdmin"] = ctx.User.IsAdmin + ctx.Data["IsOperator"] = ctx.User.IsOperator c.Data["SignedUserName"] = ctx.User.Name } else { ctx.Data["SignedUserID"] = int64(0) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index b7ef8d48f..518c63e4f 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -75,6 +75,7 @@ import ( "code.gitea.io/gitea/routers/api/v1/repo" _ "code.gitea.io/gitea/routers/api/v1/swagger" // for swagger generation "code.gitea.io/gitea/routers/api/v1/user" + repo_ext "code.gitea.io/gitea/routers/repo" "gitea.com/macaron/binding" "gitea.com/macaron/macaron" @@ -523,23 +524,26 @@ func RegisterRoutes(m *macaron.Macaron) { Get(notify.GetThread). Patch(notify.ReadThread) }, reqToken()) - adminReq := context.Toggle(&context.ToggleOptions{SignInRequired: true, AdminRequired: true}) + + operationReq := context.Toggle(&context.ToggleOptions{SignInRequired: true, OperationRequired: true}) //Project board m.Group("/projectboard", func() { - m.Get("/restoreFork", adminReq, repo.RestoreForkNumber) - m.Get("/downloadAll", adminReq, repo.ServeAllProjectsPeriodStatisticsFile) - m.Get("/downloadAllOpenI", adminReq, repo.ServeAllProjectsOpenIStatisticsFile) + m.Get("/restoreFork", repo.RestoreForkNumber) + m.Get("/downloadAll", repo.ServeAllProjectsPeriodStatisticsFile) + m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) m.Group("/project", func() { - m.Get("", adminReq, repo.GetAllProjectsPeriodStatistics) + m.Get("", repo.GetAllProjectsPeriodStatistics) m.Group("/:id", func() { - m.Get("", adminReq, repo.GetProjectLatestStatistics) - m.Get("/period", adminReq, repo.GetProjectPeriodStatistics) + m.Get("", repo.GetProjectLatestStatistics) + m.Get("/period", repo.GetProjectPeriodStatistics) }) }) - }) + }, operationReq) + + m.Get("/query_user_static_page", operationReq, repo_ext.QueryUserStaticDataPage) // Users m.Group("/users", func() { diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 3bacb7549..67794bf88 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -792,7 +792,7 @@ func RegisterRoutes(m *macaron.Macaron) { }, reqSignIn, context.RepoAssignment(), context.UnitTypes(), reqRepoAdmin, context.RepoRef()) m.Post("/:username/:reponame/action/:action", reqSignIn, context.RepoAssignment(), context.UnitTypes(), repo.Action) - m.Get("/tool/query_user_static_page", adminReq, repo.QueryUserStaticDataPage) + // Grouping for those endpoints not requiring authentication m.Group("/:username/:reponame", func() { m.Get("/contributors", repo.Contributors) From ee95b280707779c4c800750d16b039536a5338a2 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 30 Nov 2021 10:35:52 +0800 Subject: [PATCH 07/28] fix-982 --- modules/auth/auth.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/auth/auth.go b/modules/auth/auth.go index 16ea9f15e..352e50ca0 100644 --- a/modules/auth/auth.go +++ b/modules/auth/auth.go @@ -9,6 +9,9 @@ import ( "reflect" "strings" + "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth/sso" "code.gitea.io/gitea/modules/validation" @@ -31,6 +34,8 @@ func SignedInUser(ctx *macaron.Context, sess session.Store) (*models.User, bool) return nil, false } + checkAutoLogin(ctx, sess) + // Try to sign in with each of the enabled plugins for _, ssoMethod := range sso.Methods() { if !ssoMethod.IsEnabled() { @@ -46,6 +51,23 @@ func SignedInUser(ctx *macaron.Context, sess session.Store) (*models.User, bool) return nil, false } +func checkAutoLogin(ctx *macaron.Context, sess session.Store) { + uid := sess.Get("uid") + if uid == nil { + uname := ctx.GetCookie(setting.CookieUserName) + + u, err := models.GetUserByName(uname) + if err == nil { + + if val, ok := ctx.GetSuperSecureCookie( + base.EncodeMD5(u.Rands+u.Passwd), setting.CookieRememberName); ok && val == u.Name { + sess.Set("uid", u.ID) + } + } + } + +} + // Form form binding interface type Form interface { binding.Validator From 42753155060d3062f0aa6e9c61ecebe07852eff8 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 30 Nov 2021 16:34:42 +0800 Subject: [PATCH 08/28] sync_cb_status --- models/cloudbrain.go | 36 ++++++++++++++++++ modules/cron/tasks_basic.go | 13 +++++++ routers/repo/cloudbrain.go | 75 +++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index bb1241247..dd3d3531c 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -31,6 +31,7 @@ const ( JobTypeBrainScore JobType = "BRAINSCORE" JobTypeTrain JobType = "TRAIN" + //notebook ModelArtsCreateQueue ModelArtsJobStatus = "CREATE_QUEUING" //免费资源创建排队中 ModelArtsCreating ModelArtsJobStatus = "CREATING" //创建中 ModelArtsCreateFailed ModelArtsJobStatus = "CREATE_FAILED" //创建失败 @@ -46,6 +47,30 @@ const ( ModelArtsDeleted ModelArtsJobStatus = "DELETED" //已删除 ModelArtsResizing ModelArtsJobStatus = "RESIZING" //规格变更中 ModelArtsResizFailed ModelArtsJobStatus = "RESIZE_FAILED" //规格变更失败 + + //trainjob + ModelArtsTrainJobUnknown ModelArtsJobStatus = "UNKNOWN" //作业状态未知 + ModelArtsTrainJobInit ModelArtsJobStatus = "INIT" //作业初始化状态 + ModelArtsTrainJobImageCreating ModelArtsJobStatus = "IMAGE_CREATING" //作业镜像正在创建 + ModelArtsTrainJobImageFailed ModelArtsJobStatus = "IMAGE_FAILED" //作业镜像创建失败 + ModelArtsTrainJobSubmitTrying ModelArtsJobStatus = "SUBMIT_TRYING" //作业正在提交 + ModelArtsTrainJobSubmitFailed ModelArtsJobStatus = "SUBMIT_FAILED" //作业提交失败 + ModelArtsTrainJobDeleteFailed ModelArtsJobStatus = "DELETE_FAILED" //作业删除失败 + ModelArtsTrainJobWaiting ModelArtsJobStatus = "WAITING" //作业正在排队中 + ModelArtsTrainJobRunning ModelArtsJobStatus = "RUNNING" //作业正在运行中 + ModelArtsTrainJobKilling ModelArtsJobStatus = "KILLING" //作业正在取消 + ModelArtsTrainJobCompleted ModelArtsJobStatus = "COMPLETED" //作业已经完成 + ModelArtsTrainJobFailed ModelArtsJobStatus = "FAILED" //作业运行失败 + ModelArtsTrainJobKilled ModelArtsJobStatus = "KILLED" //作业取消成功 + ModelArtsTrainJobCanceled ModelArtsJobStatus = "CANCELED" //作业取消 + ModelArtsTrainJobLost ModelArtsJobStatus = "LOST" //作业丢失 + ModelArtsTrainJobScaling ModelArtsJobStatus = "SCALING" //作业正在扩容 + ModelArtsTrainJobSubmitModelFailed ModelArtsJobStatus = "SUBMIT_MODEL_FAILED" //提交模型失败 + ModelArtsTrainJobDeployServiceFailed ModelArtsJobStatus = "DEPLOY_SERVICE_FAILED" //部署服务失败 + ModelArtsTrainJobCheckInit ModelArtsJobStatus = "CHECK_INIT" //审核作业初始化 + ModelArtsTrainJobCheckRunning ModelArtsJobStatus = "CHECK_RUNNING" //审核作业正在运行中 + ModelArtsTrainJobCheckRunningCompleted ModelArtsJobStatus = "CHECK_RUNNING_COMPLETED" //审核作业已经完成 + ModelArtsTrainJobCheckFailed ModelArtsJobStatus = "CHECK_FAILED" //审核作业失败 ) type Cloudbrain struct { @@ -1091,3 +1116,14 @@ func CanDelJob(isSigned bool, user *User, job *CloudbrainInfo) bool { } return false } + +func GetCloudBrainUnStoppedJob() ([]*Cloudbrain, error) { + cloudbrains := make([]*Cloudbrain, 0, 10) + return cloudbrains, x. + NotIn("status", + JobStopped, JobSucceeded, JobFailed, ModelArtsCreateFailed, ModelArtsStartFailed, ModelArtsUnavailable, ModelArtsResizFailed, ModelArtsDeleted, + ModelArtsStopped, ModelArtsTrainJobCanceled, ModelArtsTrainJobCheckFailed, ModelArtsTrainJobCompleted, ModelArtsTrainJobDeleteFailed, ModelArtsTrainJobDeployServiceFailed, + ModelArtsTrainJobFailed, ModelArtsTrainJobImageFailed, ModelArtsTrainJobKilled, ModelArtsTrainJobLost, ModelArtsTrainJobSubmitFailed, ModelArtsTrainJobSubmitModelFailed). + Limit(100). + Find(&cloudbrains) +} diff --git a/modules/cron/tasks_basic.go b/modules/cron/tasks_basic.go index 207018c20..294690d45 100755 --- a/modules/cron/tasks_basic.go +++ b/modules/cron/tasks_basic.go @@ -185,6 +185,17 @@ func registerHandleSummaryStatistic() { }) } +func registerSyncCloudbrainStatus() { + RegisterTaskFatal("sync_cloudbrain_status", &BaseConfig{ + Enabled: true, + RunAtStart: false, + Schedule: "@every 10m", + }, func(ctx context.Context, _ *models.User, _ Config) error { + repo.SyncCloudbrainStatus() + return nil + }) +} + func initBasicTasks() { registerUpdateMirrorTask() registerRepoHealthCheck() @@ -202,4 +213,6 @@ func initBasicTasks() { registerHandleRepoAndUserStatistic() registerHandleSummaryStatistic() + + registerSyncCloudbrainStatus() } diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 28f3a0184..bf0fffc18 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -715,3 +715,78 @@ func downloadRateCode(repo *models.Repository, taskName, gitPath, codePath, benc return nil } + +func SyncCloudbrainStatus() { + cloudBrains, err := models.GetCloudBrainUnStoppedJob() + if err != nil { + log.Error("GetCloudBrainUnStoppedJob failed:", err.Error()) + return + } + + for _, task := range cloudBrains { + if task.Type == models.TypeCloudBrainOne { + result, err := cloudbrain.GetJob(task.JobID) + if err != nil { + log.Error("GetJob(%s) failed:%v", task.JobName, err) + continue + } + + if result != nil { + jobRes, _ := models.ConvertToJobResultPayload(result.Payload) + taskRoles := jobRes.TaskRoles + taskRes, _ := models.ConvertToTaskPod(taskRoles[cloudbrain.SubTaskName].(map[string]interface{})) + task.Status = taskRes.TaskStatuses[0].State + if task.Status != string(models.JobWaiting) { + err = models.UpdateJob(task) + if err != nil { + log.Error("UpdateJob(%s) failed:%v", task.JobName, err) + continue + } + } + } + } else if task.Type == models.TypeCloudBrainTwo { + if task.JobType == string(models.JobTypeDebug) { + result, err := modelarts.GetJob(task.JobID) + if err != nil { + log.Error("GetJob(%s) failed:%v", task.JobName, err) + continue + } + + if result != nil { + task.Status = result.Status + + err = models.UpdateJob(task) + if err != nil { + log.Error("UpdateJob(%s) failed:%v", task.JobName, err) + continue + } + } + } else if task.JobType == string(models.JobTypeTrain) { + result, err := modelarts.GetTrainJob(task.JobID, strconv.FormatInt(task.VersionID, 10)) + if err != nil { + log.Error("GetTrainJob(%s) failed:%v", task.JobName, err) + continue + } + + if result != nil { + task.Status = modelarts.TransTrainJobStatus(result.IntStatus) + task.Duration = result.Duration + task.TrainJobDuration = result.TrainJobDuration + + err = models.UpdateJob(task) + if err != nil { + log.Error("UpdateJob(%s) failed:%v", task.JobName, err) + continue + } + } + } else { + log.Error("task.JobType(%s) is error:%s", task.JobName, task.JobType) + } + + } else { + log.Error("task.Type(%s) is error:%d", task.JobName, task.Type) + } + } + + return +} From 791ef137ce54cf16ad23863309d320d9c0fee88f Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 30 Nov 2021 19:42:38 +0800 Subject: [PATCH 09/28] cb_limit --- models/cloudbrain.go | 53 ++++++++++++++++++++++++++++++++++++++ routers/repo/cloudbrain.go | 17 +++++++++++- routers/repo/modelarts.go | 32 ++++++++++++++++++++++- 3 files changed, 100 insertions(+), 2 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index bb1241247..7b196a321 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -31,6 +31,7 @@ const ( JobTypeBrainScore JobType = "BRAINSCORE" JobTypeTrain JobType = "TRAIN" + //notebook ModelArtsCreateQueue ModelArtsJobStatus = "CREATE_QUEUING" //免费资源创建排队中 ModelArtsCreating ModelArtsJobStatus = "CREATING" //创建中 ModelArtsCreateFailed ModelArtsJobStatus = "CREATE_FAILED" //创建失败 @@ -46,6 +47,30 @@ const ( ModelArtsDeleted ModelArtsJobStatus = "DELETED" //已删除 ModelArtsResizing ModelArtsJobStatus = "RESIZING" //规格变更中 ModelArtsResizFailed ModelArtsJobStatus = "RESIZE_FAILED" //规格变更失败 + + //trainjob + ModelArtsTrainJobUnknown ModelArtsJobStatus = "UNKNOWN" //作业状态未知 + ModelArtsTrainJobInit ModelArtsJobStatus = "INIT" //作业初始化状态 + ModelArtsTrainJobImageCreating ModelArtsJobStatus = "IMAGE_CREATING" //作业镜像正在创建 + ModelArtsTrainJobImageFailed ModelArtsJobStatus = "IMAGE_FAILED" //作业镜像创建失败 + ModelArtsTrainJobSubmitTrying ModelArtsJobStatus = "SUBMIT_TRYING" //作业正在提交 + ModelArtsTrainJobSubmitFailed ModelArtsJobStatus = "SUBMIT_FAILED" //作业提交失败 + ModelArtsTrainJobDeleteFailed ModelArtsJobStatus = "DELETE_FAILED" //作业删除失败 + ModelArtsTrainJobWaiting ModelArtsJobStatus = "WAITING" //作业正在排队中 + ModelArtsTrainJobRunning ModelArtsJobStatus = "RUNNING" //作业正在运行中 + ModelArtsTrainJobKilling ModelArtsJobStatus = "KILLING" //作业正在取消 + ModelArtsTrainJobCompleted ModelArtsJobStatus = "COMPLETED" //作业已经完成 + ModelArtsTrainJobFailed ModelArtsJobStatus = "FAILED" //作业运行失败 + ModelArtsTrainJobKilled ModelArtsJobStatus = "KILLED" //作业取消成功 + ModelArtsTrainJobCanceled ModelArtsJobStatus = "CANCELED" //作业取消 + ModelArtsTrainJobLost ModelArtsJobStatus = "LOST" //作业丢失 + ModelArtsTrainJobScaling ModelArtsJobStatus = "SCALING" //作业正在扩容 + ModelArtsTrainJobSubmitModelFailed ModelArtsJobStatus = "SUBMIT_MODEL_FAILED" //提交模型失败 + ModelArtsTrainJobDeployServiceFailed ModelArtsJobStatus = "DEPLOY_SERVICE_FAILED" //部署服务失败 + ModelArtsTrainJobCheckInit ModelArtsJobStatus = "CHECK_INIT" //审核作业初始化 + ModelArtsTrainJobCheckRunning ModelArtsJobStatus = "CHECK_RUNNING" //审核作业正在运行中 + ModelArtsTrainJobCheckRunningCompleted ModelArtsJobStatus = "CHECK_RUNNING_COMPLETED" //审核作业已经完成 + ModelArtsTrainJobCheckFailed ModelArtsJobStatus = "CHECK_FAILED" //审核作业失败 ) type Cloudbrain struct { @@ -1091,3 +1116,31 @@ func CanDelJob(isSigned bool, user *User, job *CloudbrainInfo) bool { } return false } + +func GetCloudBrainUnStoppedJob() ([]*Cloudbrain, error) { + cloudbrains := make([]*Cloudbrain, 0, 10) + return cloudbrains, x. + NotIn("status", + JobStopped, JobSucceeded, JobFailed, ModelArtsCreateFailed, ModelArtsStartFailed, ModelArtsUnavailable, ModelArtsResizFailed, ModelArtsDeleted, + ModelArtsStopped, ModelArtsTrainJobCanceled, ModelArtsTrainJobCheckFailed, ModelArtsTrainJobCompleted, ModelArtsTrainJobDeleteFailed, ModelArtsTrainJobDeployServiceFailed, + ModelArtsTrainJobFailed, ModelArtsTrainJobImageFailed, ModelArtsTrainJobKilled, ModelArtsTrainJobLost, ModelArtsTrainJobSubmitFailed, ModelArtsTrainJobSubmitModelFailed). + Limit(100). + Find(&cloudbrains) +} + +func GetCloudbrainCountByUserID(userID int64) (int, error) { + count, err := x.In("status", JobWaiting, JobRunning).And("job_type = ? and user_id = ? and type = ?", JobTypeDebug, userID, TypeCloudBrainOne).Count(new(Cloudbrain)) + return int(count), err +} + +func GetCloudbrainNotebookCountByUserID(userID int64) (int, error) { + count, err := x.In("status", ModelArtsCreateQueue, ModelArtsCreating, ModelArtsStarting, ModelArtsReadyToStart, ModelArtsResizing, ModelArtsStartQueuing, ModelArtsRunning, ModelArtsRestarting). + And("job_type = ? and user_id = ? and type = ?", JobTypeDebug, userID, TypeCloudBrainTwo).Count(new(Cloudbrain)) + return int(count), err +} + +func GetCloudbrainTrainJobCountByUserID(userID int64) (int, error) { + count, err := x.In("status", ModelArtsTrainJobInit, ModelArtsTrainJobImageCreating, ModelArtsTrainJobSubmitTrying, ModelArtsTrainJobWaiting, ModelArtsTrainJobRunning, ModelArtsTrainJobScaling, ModelArtsTrainJobCheckInit, ModelArtsTrainJobCheckRunning, ModelArtsTrainJobCheckRunningCompleted). + And("job_type = ? and user_id = ? and type = ?", JobTypeTrain, userID, TypeCloudBrainTwo).Count(new(Cloudbrain)) + return int(count), err +} diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 28f3a0184..d704ee0d9 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -216,7 +216,22 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { return } - _, err := models.GetCloudbrainByName(jobName) + count, err := models.GetCloudbrainCountByUserID(ctx.User.ID) + if err != nil { + log.Error("GetCloudbrainCountByUserID failed:%v", err, ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr("system error", tplCloudBrainNew, &form) + return + } else { + if count >= 1 { + log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplCloudBrainNew, &form) + return + } + } + + _, err = models.GetCloudbrainByName(jobName) if err == nil { log.Error("the job name did already exist", ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 069a1a0b5..263bba85c 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -116,7 +116,22 @@ func NotebookCreate(ctx *context.Context, form auth.CreateModelArtsNotebookForm) description := form.Description flavor := form.Flavor - err := modelarts.GenerateTask(ctx, jobName, uuid, description, flavor) + count, err := models.GetCloudbrainNotebookCountByUserID(ctx.User.ID) + if err != nil { + log.Error("GetCloudbrainNotebookCountByUserID failed:%v", err, ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr("system error", tplModelArtsNotebookNew, &form) + return + } else { + if count >= 1 { + log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplModelArtsNotebookNew, &form) + return + } + } + + err = modelarts.GenerateTask(ctx, jobName, uuid, description, flavor) if err != nil { ctx.RenderWithErr(err.Error(), tplModelArtsNotebookNew, &form) return @@ -854,6 +869,21 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ ctx.Data["PageIsTrainJob"] = true var jobID = ctx.Params(":jobid") + count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) + if err != nil { + log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr("system error", tplModelArtsTrainJobVersionNew, &form) + return + } else { + if count >= 1 { + log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) + cloudBrainNewDataPrepare(ctx) + ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplModelArtsTrainJobVersionNew, &form) + return + } + } + latestTask, err := models.GetCloudbrainByJobIDAndIsLatestVersion(jobID, modelarts.IsLatestVersion) if err != nil { ctx.ServerError("GetCloudbrainByJobIDAndIsLatestVersion faild:", err) From ef4f5e0d84408e520476d92b200d5eda2151458b Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 1 Dec 2021 09:07:06 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E7=9C=8B=E6=9D=BF=E8=AE=BF=E9=97=AE=E6=9D=83=E9=99=90=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E5=88=86=E6=9E=90=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/base/head_navbar.tmpl | 4 ++-- templates/base/head_navbar_fluid.tmpl | 4 ++-- templates/base/head_navbar_home.tmpl | 4 ++-- web_src/js/components/UserAnalysis.vue | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index 49b3181e7..c0c1aff35 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -37,7 +37,7 @@ {{.i18n.Tr "explore.users"}} {{.i18n.Tr "explore.organizations"}} {{.i18n.Tr "explore.images"}} - {{if .IsAdmin}} + {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} @@ -55,7 +55,7 @@ {{.i18n.Tr "explore.users"}} {{.i18n.Tr "explore.organizations"}} {{.i18n.Tr "explore.images"}} - {{if .IsAdmin}} + {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} diff --git a/templates/base/head_navbar_fluid.tmpl b/templates/base/head_navbar_fluid.tmpl index 11f5e70da..3b44babaa 100644 --- a/templates/base/head_navbar_fluid.tmpl +++ b/templates/base/head_navbar_fluid.tmpl @@ -37,7 +37,7 @@ {{.i18n.Tr "explore.users"}} {{.i18n.Tr "explore.organizations"}} {{.i18n.Tr "explore.images"}} - {{if .IsAdmin}} + {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} @@ -55,7 +55,7 @@ {{.i18n.Tr "explore.users"}} {{.i18n.Tr "explore.organizations"}} {{.i18n.Tr "explore.images"}} - {{if .IsAdmin}} + {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} diff --git a/templates/base/head_navbar_home.tmpl b/templates/base/head_navbar_home.tmpl index c94ff269f..8bbeebec8 100644 --- a/templates/base/head_navbar_home.tmpl +++ b/templates/base/head_navbar_home.tmpl @@ -29,7 +29,7 @@ {{.i18n.Tr "explore.users"}} {{.i18n.Tr "explore.organizations"}} {{.i18n.Tr "explore.images"}} - {{if .IsAdmin}} + {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} @@ -47,7 +47,7 @@ {{.i18n.Tr "explore.users"}} {{.i18n.Tr "explore.organizations"}} {{.i18n.Tr "explore.images"}} - {{if .IsAdmin}} + {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} diff --git a/web_src/js/components/UserAnalysis.vue b/web_src/js/components/UserAnalysis.vue index f5a0bb4db..beb4de8e9 100755 --- a/web_src/js/components/UserAnalysis.vue +++ b/web_src/js/components/UserAnalysis.vue @@ -27,10 +27,10 @@ - + - 下载报告 + 下载报告 下载报告 @@ -335,7 +335,7 @@ } }; - this.$axios.get('../tool/query_user_static_page',{ + this.$axios.get('../api/v1/query_user_static_page',{ params:this.params }).then((res)=>{ this.tableData = res.data.data From 97e6e6804a7205671386bea8c11184b9afbe1702 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 1 Dec 2021 09:53:09 +0800 Subject: [PATCH 11/28] mod --- routers/repo/modelarts.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 263bba85c..48978b2e5 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -699,6 +699,21 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) VersionCount := modelarts.VersionCount EngineName := form.EngineName + count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) + if err != nil { + log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) + ErrorNewDataPrepare(ctx, form) + ctx.RenderWithErr("system error", tplModelArtsTrainJobNew, &form) + return + } else { + if count >= 1 { + log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) + ErrorNewDataPrepare(ctx, form) + ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplModelArtsTrainJobNew, &form) + return + } + } + if err := paramCheckCreateTrainJob(form); err != nil { log.Error("paramCheckCreateTrainJob failed:(%v)", err) ErrorNewDataPrepare(ctx, form) @@ -872,13 +887,13 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) if err != nil { log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) - cloudBrainNewDataPrepare(ctx) + VersionErrorDataPrepare(ctx, form) ctx.RenderWithErr("system error", tplModelArtsTrainJobVersionNew, &form) return } else { if count >= 1 { log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) - cloudBrainNewDataPrepare(ctx) + VersionErrorDataPrepare(ctx, form) ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplModelArtsTrainJobVersionNew, &form) return } From 13974937af528317bba73b75b1d152e98956e6e8 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Wed, 1 Dec 2021 11:37:01 +0800 Subject: [PATCH 12/28] #882 remove watcher from reviewers --- models/repo.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/models/repo.go b/models/repo.go index 1a5cf122c..05207fed1 100755 --- a/models/repo.go +++ b/models/repo.go @@ -667,15 +667,11 @@ func (repo *Repository) getReviewersPublic(e Engine, doerID, posterID int64) (_ users := make([]*User, 0) const SQLCmd = "SELECT * FROM `user` WHERE id IN ( " + - "SELECT user_id FROM `access` WHERE repo_id = ? AND mode >= ? AND user_id NOT IN ( ?, ?) " + - "UNION " + - "SELECT user_id FROM `watch` WHERE repo_id = ? AND user_id NOT IN ( ?, ?) AND mode IN (?, ?) " + - ") ORDER BY name" + "SELECT user_id FROM `access` WHERE repo_id = ? AND mode >= ? AND user_id NOT IN ( ?, ?) ) ORDER BY name " if err = e. SQL(SQLCmd, - repo.ID, AccessModeRead, doerID, posterID, - repo.ID, doerID, posterID, RepoWatchModeNormal, RepoWatchModeAuto). + repo.ID, AccessModeRead, doerID, posterID). Find(&users); err != nil { return nil, err } From 7fb520614633cb6d0018a50b7cb1fa2efde28f00 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Wed, 1 Dec 2021 16:36:06 +0800 Subject: [PATCH 13/28] change review request access from AccessModeRead to AccessModeWrite --- routers/repo/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 555cd065f..9483814d6 100755 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -1390,7 +1390,7 @@ func isLegalReviewRequest(reviewer, doer *models.User, isAdd bool, issue *models var pemResult bool if isAdd { - pemResult = permReviewer.CanAccessAny(models.AccessModeRead, models.UnitTypePullRequests) + pemResult = permReviewer.CanAccessAny(models.AccessModeWrite, models.UnitTypePullRequests) if !pemResult { return fmt.Errorf("Reviewer can't read [user_id: %d, repo_name: %s]", reviewer.ID, issue.Repo.Name) } From fd4a6770b86a7995af01be28b8dccd2c16246253 Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 1 Dec 2021 17:03:06 +0800 Subject: [PATCH 14/28] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E5=9B=9E?= =?UTF-8?q?=E9=80=80,=E5=9B=BE=E6=A0=87=E9=A2=9C=E8=89=B2=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/img/overview_rgb.svg | 1 + public/img/pro_rgb.svg | 1 + public/img/user_rgb.svg | 1 + web_src/js/components/DataAnalysis.vue | 16 ++++++++++++---- web_src/js/components/ProAnalysis.vue | 12 +++++++++++- 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 public/img/overview_rgb.svg create mode 100644 public/img/pro_rgb.svg create mode 100644 public/img/user_rgb.svg diff --git a/public/img/overview_rgb.svg b/public/img/overview_rgb.svg new file mode 100644 index 000000000..1a1257e23 --- /dev/null +++ b/public/img/overview_rgb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/pro_rgb.svg b/public/img/pro_rgb.svg new file mode 100644 index 000000000..2110c2115 --- /dev/null +++ b/public/img/pro_rgb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/user_rgb.svg b/public/img/user_rgb.svg new file mode 100644 index 000000000..e5cf24cf0 --- /dev/null +++ b/public/img/user_rgb.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web_src/js/components/DataAnalysis.vue b/web_src/js/components/DataAnalysis.vue index 026c02bd1..ae536db28 100755 --- a/web_src/js/components/DataAnalysis.vue +++ b/web_src/js/components/DataAnalysis.vue @@ -3,7 +3,7 @@ - + 概览 @@ -13,14 +13,14 @@ - + 项目分析 - + 用户分析 @@ -121,6 +121,14 @@ /deep/ .el-tabs__item { padding: 0px 20px 0px 20px; } - + /deep/ .el-tabs__item.is-active .el-image{ + filter:none + } + /deep/ .el-tabs__item:hover .el-image{ + filter:none + } + /deep/ .el-image{ + filter:grayscale(100%) + } \ No newline at end of file diff --git a/web_src/js/components/ProAnalysis.vue b/web_src/js/components/ProAnalysis.vue index 817c1a12c..074f8e326 100755 --- a/web_src/js/components/ProAnalysis.vue +++ b/web_src/js/components/ProAnalysis.vue @@ -1085,6 +1085,12 @@ return data[0]+''+data[1]+''+data[2] } }, + goBack(){ + if( $("#pro_detail").is(':visible') ){ + document.getElementById("pro_main").style.display = "block"; + document.getElementById("pro_detail").style.display = "none"; + } + }, }, filters:{ @@ -1125,7 +1131,7 @@ return " " +value.user+ "" } - }, + }, }, @@ -1140,6 +1146,10 @@ this.radarOpenI = this.$echarts.init(document.getElementById('radar_openi')) this.echartsOITd = this.$echarts.init(document.getElementById('line_openi')) this.echartsSelectData = this.$echarts.init(document.getElementById('selectData')) + if (window.history && window.history.pushState) { + history.pushState(null, null, document.URL); + window.addEventListener('popstate', this.goBack, false); + } // window.onresize=function(){ // this.radarOpenI.resize(); // this.echartsOITd.resize(); From 158dc25c342efaebb41c2a043fb7a3bd69eeebdf Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 1 Dec 2021 17:12:16 +0800 Subject: [PATCH 15/28] fix issue --- templates/repo/modelarts/trainjob/show.tmpl | 7 +++++-- templates/repo/modelarts/trainjob/version_new.tmpl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index a3fdddf38..cd85057de 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -474,6 +474,7 @@ td, th {