diff --git a/models/action.go b/models/action.go index b54464ae9..4821910db 100755 --- a/models/action.go +++ b/models/action.go @@ -364,11 +364,12 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) { return actions, nil } -func GetLast20PublicFeeds() ([]*Action, error) { +func GetLast20PublicFeeds(opTypes []int) ([]*Action, error) { cond := builder.NewCond() cond = cond.And(builder.Eq{"is_private": false}) cond = cond.And(builder.Eq{"is_deleted": false}) - + cond = cond.And(builder.Expr("user_id=act_user_id")) + cond = cond.And(builder.In("op_type", opTypes)) actions := make([]*Action, 0, 20) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index d04e350c2..288762161 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -387,7 +387,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, CommitCodeSizeMap map[s OpenIIndexMap := queryUserRepoOpenIIndex(startTime.Unix(), end_unix) - DataDate := currentTimeNow.Format("2006-01-02") + DataDate := currentTimeNow.Format("2006-01-02") + " 00:01" cond := "type != 1 and is_active=true" count, err := sess.Where(cond).Count(new(User)) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1756b9533..9eb99cb69 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -222,42 +222,42 @@ issues.in_your_repos = In your repositories contributors = Contributors page_title=Explore Better AI -page_small_title=OpenI AI development cooperation platform +page_small_title=OpenI AI Development Cooperation Platform page_description=The one-stop collaborative development environment for AI field provides AI development pipeline integrating code development, data management, model debugging, reasoning and evaluation page_use=Use Now -page_only_dynamic=Show only open source project dynamics -page_recommend_org=Recommended organization -page_recommend_org_desc=These excellent organizations are using Qizhi AI to develop collaboration platforms; Your organization also wants to show here, -page_recommend_org_commit=Click here to submit -page_recommend_org_more=More organizations -page_recommend_repo=Recommended projects -page_recommend_repo_desc=Excellent AI project recommendation; Your project also wants to show here, -page_recommend_repo_commit=Click here to submit -page_recommend_repo_go=. Click here -page_recommend_repo_more=Project Square -page_dev_env=Collaborative development environment -page_dev_env_desc=The biggest difference between Qizhi AI collaborative development platform and traditional git platform is that it provides a collaborative development environment for AI development -page_dev_env_desc_title=Unified management of development elements -page_dev_env_desc_desc=The platform provides four elements of AI development: unified management of model code, data set, model and execution environment -page_dev_env_desc1_title=Data collaboration and sharing -page_dev_env_desc1_desc=By uploading data sets in the project, many project members cooperate to complete data preprocessing; You can also establish a better model with community developers by setting the data as a public dataset -page_dev_env_desc2_title=Model management and sharing -page_dev_env_desc2_desc=Associate the model with the code version, adjust the model in different ways based on the code history version, and save the results; The trained model can be open and shared, so that more people can use the model to test and give feedback -page_dev_env_desc3_title=One configuration, multiple use -page_dev_env_desc3_desc=Provide execution environment sharing, one-time configuration and multiple use, reduce the threshold of model development, and avoid spending repeated time configuring complex environments -page_dev_yunlao=PengCheng Cloudbrain open source collaboration -page_dev_yunlao_desc1=The platform has been connected with Pengcheng Cloudbrain and can use the rich computing resources of Pengcheng Cloudbrain to complete AI development tasks -page_dev_yunlao_desc2=Pengcheng Cloudbrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure is composed of GPU server equipped with NVIDIA Tesla V100 and Atlas 900 AI cluster equipped with Kunpeng and shengteng processors -page_dev_yunlao_desc3=Developers can freely choose the corresponding computing resources according to the use requirements, and can test the adaptability, performance and stability of the model in different hardware environments -page_dev_yunlao_desc4=If your model needs more computing resources, you can also apply separately -page_dev_yunlao_apply=Separate apply +page_only_dynamic=Only show the dynamics of open source projects +page_recommend_org=Recommended Organization +page_recommend_org_desc=These excellent organizations are using the OpenI AI Collaboration Platform for collaborative development of projects. To show your organization here, +page_recommend_org_commit=Click here to submit. +page_recommend_org_more=More Organizations +page_recommend_repo=Recommended Projects +page_recommend_repo_desc=Excellent AI projects recommendation. To show your project here, +page_recommend_repo_commit=Click here to submit. +page_recommend_repo_go=Click here to +page_recommend_repo_more=explore more projects. +page_dev_env=Collaborative Development Environment +page_dev_env_desc=Provide a collaborative development environment for AI development, which is the biggest highlight that distinguishes the OpenI AI Collaboration Platform from other traditional Git platforms. +page_dev_env_desc_title=Unified Management of Development Elements +page_dev_env_desc_desc=The platform provides four elements of AI development: unified management of model code, data set, model and execution environment. +page_dev_env_desc1_title=Data Collaboration and Sharing +page_dev_env_desc1_desc=By uploading data sets in the project, many project members cooperate to complete data preprocessing. You can also establish a better model with community developers by setting the data as a public dataset. +page_dev_env_desc2_title=Model Management and Sharing +page_dev_env_desc2_desc=Associate the model with the code version, you can adjust the model in different ways based on the historical version of the code and save the results. The trained model can be open and shared, so that more people can use the model to test and give feedback. +page_dev_env_desc3_title=Once Configuration, Multiple Reuse +page_dev_env_desc3_desc=Provide execution environment sharing, Once Configuration, Multiple Reuse. Lower the threshold of model development, and avoid spending repetitive time configuring complex environments. +page_dev_yunlao=PengCheng Cloudbrain Open Source Collaboration +page_dev_yunlao_desc1=The platform has been connected with Pengcheng Cloudbrain and can use the rich computing resources of Pengcheng Cloudbrain to complete AI development tasks. +page_dev_yunlao_desc2=Pengcheng Cloudbrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure is composed of GPU server equipped with NVIDIA Tesla V100 and Atlas 900 AI cluster equipped with Kunpeng and Ascend processors. +page_dev_yunlao_desc3=Developers can freely choose the corresponding computing resources according to their needs, and can test the adaptability, performance, stability of the model in different hardware environments. +page_dev_yunlao_desc4=If your model requires more computing resources, you can also apply for it separately. +page_dev_yunlao_apply=Apply Separately [explore] repos = Repositories select_repos = Select the project users = Users organizations = Organizations -images = CloudImages +images = Cloudbrain Mirror search = Search code = Code repo_no_results = No matching repositories found. @@ -348,6 +348,8 @@ modify = Update [form] UserName = Username Alias = Repository name +courseAlias = Course Name +courseAdress = Course Path RepoPath = Repository path RepoAdress = Repository Adress Email = Email address @@ -2703,6 +2705,7 @@ error.unit_not_allowed = You are not allowed to access this repository section. head.community = Community head.project = Repositories head.openi = OpenI +head.openi.repo = OpenI Projects head.dataset = Datasets foot.council = Council foot.technical_committee = Technical Committee diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index d034b1722..77c2c66e3 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -353,6 +353,8 @@ modify=更新 UserName=用户名 RepoName=项目路径 Alias=项目名称 +courseAlias=课程名称 +courseAdress=课程地址 RepoPath=项目路径 RepoAdress=项目地址 Email=邮箱地址 @@ -802,6 +804,7 @@ generate_from=生成自 repo_desc=项目描述 repo_lang=项目语言 repo_gitignore_helper=选择 .gitignore 模板。 +repo_label_helpe=输入完成后回车键完成标签确定。 issue_labels=任务标签 issue_labels_helper=选择一个任务标签集 license=授权许可 @@ -2050,6 +2053,7 @@ team_access_desc=项目权限 team_permission_desc=权限 team_unit_desc=允许访问项目单元 team_unit_disabled=(已禁用) +selected_couse=精选课程 form.name_reserved=组织名称 '%s' 是被保留的。 form.name_pattern_not_allowed=组织名称中不允许使用 "%s"。 @@ -2136,6 +2140,9 @@ teams.all_repositories_read_permission_desc=此团队授予读取修改所有项目的访问权限: 成员可以查看和推送至项目。 teams.all_repositories_admin_permission_desc=该团队拥有 管理 所有项目的权限:团队成员可以读取、克隆、推送以及添加其它项目协作者。 +teams.join_teams=加入该组织 + + [admin] dashboard=管理面板 users=帐户管理 diff --git a/public/home/home.js b/public/home/home.js index f38e6f18e..717d57682 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -42,10 +42,10 @@ if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("http var socket = new WebSocket(url); socket.onopen = function () { + messageQueue = []; console.log("message has connected."); }; -var messageQueue = []; var maxSize = 20; var html =document.documentElement; var lang = html.attributes["lang"] @@ -165,12 +165,12 @@ function getTime(UpdatedUnix,currentTime){ var seconds= leave3; if(hours == 0 && minutes == 0){ - return seconds + getRepoOrOrg(6,isZh); + return seconds + getRepoOrOrg(6,isZh,seconds); }else{ if(hours > 0){ - return hours + getRepoOrOrg(4,isZh); + return hours + getRepoOrOrg(4,isZh,hours); }else{ - return minutes + getRepoOrOrg(5,isZh); + return minutes + getRepoOrOrg(5,isZh,minutes); } } } @@ -239,7 +239,7 @@ var actionNameZH={ "5":"推送了 {branch} 分支的代码到", "6":"创建了任务", "7":"创建了合并请求", - "9":"推送了 {branch} 分支的代码到", + "9":"推送了标签 {branch} 到", "10":"评论了任务", "11":"合并了合并请求", "12":"关闭了任务", @@ -257,7 +257,7 @@ var actionNameEN={ "5":" pushed to {branch} at", "6":" opened issue", "7":" created pull request", - "9":" pushed to {branch} at", + "9":" pushed tag {branch} to ", "10":" commented on issue", "11":" merged pull request", "12":" closed issue", @@ -273,18 +273,30 @@ var repoAndOrgZH={ "1":"项目", "2":"成员", "3":"团队", + "11":"项目", + "21":"成员", + "31":"团队", "4":"小时前", "5":"分钟前", - "6":"秒前" + "6":"秒前", + "41":"小时前", + "51":"分钟前", + "61":"秒前" }; var repoAndOrgEN={ - "1":"repository", - "2":"Members ", - "3":"Teams", - "4":" hours ago", - "5":" minutes ago", - "6":" seconds ago" + "1":"Repository", + "2":"Member ", + "3":"Team", + "11":"Repositorys", + "22":"Members ", + "31":"Teams", + "4":" hour ago", + "5":" minute ago", + "6":" second ago", + "41":" hours ago", + "51":" minutes ago", + "61":" seconds ago" }; @@ -415,7 +427,10 @@ function displayRepo(json){ //var repoAndOrgEN = new Map([['1', "Repository"], ['2', "Members"], ['3', "Teams"]]); -function getRepoOrOrg(key,isZhLang){ +function getRepoOrOrg(key,isZhLang,numbers=1){ + if(numbers > 1){ + key+="1"; + } if(isZhLang){ return repoAndOrgZH[key]; }else{ @@ -436,7 +451,7 @@ function displayOrg(json){ html += " "; html += "
"; html += " " + record["Name"] + " " + record["FullName"]; - html += "
" + record["NumRepos"] +" " + getRepoOrOrg(1,isZh) + " ・ " + record["NumMembers"] +" " + getRepoOrOrg(2,isZh) + " ・ " + record["NumTeams"] + " " + getRepoOrOrg(3,isZh) + "
"; + html += "
" + record["NumRepos"] +" " + getRepoOrOrg(1,isZh,record["NumRepos"]) + " ・ " + record["NumMembers"] +" " + getRepoOrOrg(2,isZh,record["NumMembers"]) + " ・ " + record["NumTeams"] + " " + getRepoOrOrg(3,isZh,record["NumTeams"]) + "
"; html += "
"; html += " "; html += " "; diff --git a/routers/repo/repo_statistic.go b/routers/repo/repo_statistic.go index 11b421659..dce183f49 100755 --- a/routers/repo/repo_statistic.go +++ b/routers/repo/repo_statistic.go @@ -51,12 +51,14 @@ func RepoStatisticDaily(date string) { isInitMinMaxRadar := false + var error_projects = make([]string, 0) for _, repo := range repos { - log.Info("start statistic: %s", getDistinctProjectName(repo)) + projectName := getDistinctProjectName(repo) + log.Info("start statistic: %s", projectName) var numDevMonths, numWikiViews, numContributor, numKeyContributor, numCommitsGrowth, numCommitLinesGrowth, numContributorsGrowth, numCommits int64 repoGitStat, err := models.GetRepoKPIStats(repo) if err != nil { - log.Error("GetRepoKPIStats failed: %s", getDistinctProjectName(repo)) + log.Error("GetRepoKPIStats failed: %s", projectName) } else { numDevMonths = repoGitStat.DevelopAge numKeyContributor = repoGitStat.KeyContributors @@ -79,26 +81,26 @@ func RepoStatisticDaily(date string) { var numVersions int64 numVersions, err = models.GetReleaseCountByRepoID(repo.ID, models.FindReleasesOptions{}) if err != nil { - log.Error("GetReleaseCountByRepoID failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("GetReleaseCountByRepoID failed(%s): %v", projectName, err) } var datasetSize int64 datasetSize, err = getDatasetSize(repo) if err != nil { - log.Error("getDatasetSize failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("getDatasetSize failed(%s): %v", projectName, err) } var numComments int64 numComments, err = models.GetCommentCountByRepoID(repo.ID) if err != nil { - log.Error("GetCommentCountByRepoID failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("GetCommentCountByRepoID failed(%s): %v", projectName, err) } beginTime, endTime := getStatTime(date) var numVisits int numVisits, err = repository.AppointProjectView(repo.OwnerName, repo.Name, beginTime, endTime) if err != nil { - log.Error("AppointProjectView failed(%s): %v", getDistinctProjectName(repo), err) + log.Error("AppointProjectView failed(%s): %v", projectName, err) } repoStat := models.RepoStatistic{ @@ -162,9 +164,10 @@ func RepoStatisticDaily(date string) { } if _, err = models.InsertRepoStat(&repoStat); err != nil { - log.Error("InsertRepoStat failed(%s): %v", getDistinctProjectName(repo), err) - log.Error("failed statistic: %s", getDistinctProjectName(repo)) - mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) + log.Error("InsertRepoStat failed(%s): %v", projectName, err) + log.Error("failed statistic: %s", projectName) + error_projects = append(error_projects, projectName) + continue } @@ -247,6 +250,10 @@ func RepoStatisticDaily(date string) { log.Info("finish statistic: %s", getDistinctProjectName(repo)) } + if len(error_projects) > 0 { + mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) + } + //radar map log.Info("begin statistic radar") for _, radarInit := range reposRadar { diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 7df384cc4..e2d44ab0a 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -88,7 +88,7 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac xlsx.SetCellValue(sheetName, "P"+rows, formatTime[0:len(formatTime)-3]) formatTime = userRecord.DataDate - xlsx.SetCellValue(sheetName, "Q"+rows, formatTime+" 00:01") + xlsx.SetCellValue(sheetName, "Q"+rows, formatTime) } //设置默认打开的表单 diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go index eeb496108..c59936581 100644 --- a/services/socketwrap/clientManager.go +++ b/services/socketwrap/clientManager.go @@ -10,6 +10,8 @@ import ( "github.com/elliotchance/orderedmap" ) +var opTypes = []int{1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 22, 23} + type ClientsManager struct { Clients *orderedmap.OrderedMap Register chan *Client @@ -47,13 +49,15 @@ func (h *ClientsManager) Run() { close(client.Send) } case message := <-models.ActionChan: - LastActionsQueue.Push(message) - for _, client := range h.Clients.Keys() { - select { - case client.(*Client).Send <- message: - default: - close(client.(*Client).Send) - h.Clients.Delete(client) + if isInOpTypes(opTypes, message.OpType) { + LastActionsQueue.Push(message) + for _, client := range h.Clients.Keys() { + select { + case client.(*Client).Send <- message: + default: + close(client.(*Client).Send) + h.Clients.Delete(client) + } } } case s := <-sig: @@ -71,8 +75,19 @@ func (h *ClientsManager) Run() { } } +func isInOpTypes(types []int, opType models.ActionType) bool { + isFound := false + for _, value := range types { + if value == int(opType) { + isFound = true + break + } + } + return isFound +} + func initActionQueue() { - actions, err := models.GetLast20PublicFeeds() + actions, err := models.GetLast20PublicFeeds(opTypes) if err == nil { for i := len(actions) - 1; i >= 0; i-- { diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index d1d40d1d6..d8d9d50f2 100755 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -43,7 +43,7 @@ {{if .IsOperator}} {{.i18n.Tr "explore.data_analysis"}} {{end}} - {{.i18n.Tr "custom.head.openi"}} + {{.i18n.Tr "custom.head.openi.repo"}} {{else if .IsLandingPageHome}} diff --git a/templates/home.tmpl b/templates/home.tmpl index 3a1cca49e..2737afd54 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -57,7 +57,7 @@

{{.page_recommend_repo}}

-

{{.page_recommend_repo_desc}}{{.page_recommend_repo_commit}}{{.page_recommend_repo_go}}{{.page_recommend_repo_more}}

+

{{.page_recommend_repo_desc}}{{.page_recommend_repo_commit}}{{.page_recommend_repo_go}} {{.page_recommend_repo_more}}

diff --git a/templates/org/course_list.tmpl b/templates/org/course_list.tmpl new file mode 100644 index 000000000..a371ec4ff --- /dev/null +++ b/templates/org/course_list.tmpl @@ -0,0 +1,334 @@ + +
+ + +
+ +
+ {{range .Repos}} +
+ +
+
+ {{if .Topics }} +
+ {{range .Topics}} + {{if ne . "" }}{{.}}{{end}} + {{end}} + +
+ {{end}} + +
+ + + +
+ {{.Description}} + +
+ + + + +
+
+

+ {{$.i18n.Tr "org.repo_updated"}}{{.CreatedUnix.FormatShort}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}} + +

+ +
+
+ {{end}} +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/templates/org/home_courses.tmpl b/templates/org/home_courses.tmpl new file mode 100644 index 000000000..0f9b70f67 --- /dev/null +++ b/templates/org/home_courses.tmpl @@ -0,0 +1,479 @@ + +{{template "base/head" .}} +
+ {{/* overflow: auto is the clearfix - this avoids the image going beyond + the container where it is supposed to stay inside. */}} + + +
+
+ +
+
+ {{.Org.DisplayName}} + +
+
+ {{if .Org.Description}}

{{.Org.Description}}

{{end}} +
+ +
+ {{if .Org.Location}}
{{svg "octicon-location" 16}} {{.Org.Location}}
{{end}} + {{if .Org.Website}}
{{svg "octicon-link" 16}} {{.Org.Website}}
{{end}} +
+
+
+ + +
+ + +
+ + +
+ +
+
+
+ 全部关键字 + {{range .CoursesKeywords}} + {{.}} + {{end}} +
+ + +
+
+
+ + + +
+ +
+
+
+ + {{template "org/course_list" .}} + {{template "base/paginate" .}} +
+ +
+ +

+ {{.i18n.Tr "org.selected_couse"}} + + + + +

+ +
+ {{range $i, $v := .RecommendCourses}} + + {{if gt $i 0}} +
+ {{end}} +
+ +
+ {{.Alias}} +

+ 贡献者:{{.Creator.Name}} +

+
+
+ + {{end}} + + +
+ + +

+ {{.i18n.Tr "org.people"}} + + + + +

+
+ {{$isMember := .IsOrganizationMember}} + {{range .Members}} + {{if or $isMember (.IsPublicMember $.Org.ID)}} + + {{end}} + {{end}} + + +
+ + {{if .IsOrganizationMember}} +
+ {{.i18n.Tr "org.teams"}} + +
+ + {{if .IsOrganizationOwner}} + + {{end}} + {{end}} +
+
+
+ +
+
+
+ + + +{{template "base/footer" .}} + \ No newline at end of file diff --git a/templates/org/member/course_members.tmpl b/templates/org/member/course_members.tmpl new file mode 100644 index 000000000..e69de29bb diff --git a/templates/org/team/courseTeams.tmpl b/templates/org/team/courseTeams.tmpl new file mode 100644 index 000000000..e69de29bb diff --git a/templates/repo/createCourse.tmpl b/templates/repo/createCourse.tmpl new file mode 100644 index 000000000..5ce7d010b --- /dev/null +++ b/templates/repo/createCourse.tmpl @@ -0,0 +1,98 @@ +{{template "base/head" .}} +
+
+
+
+ {{.CsrfTokenHtml}} +

+ {{.i18n.Tr "new_course"}} +

+
+ {{template "base/alert" .}} +
+ + + {{.i18n.Tr "form.reponame_dash_dot_error"}} +
+ +
+ +
+ +
+
/
+
+ +
+
+ {{.i18n.Tr "form.repoadd_dash_dot_error"}} + + +
+ + +
+ +
+ + +
+
+ + + {{.i18n.Tr "cancel"}} +
+
+
+
+
+
+{{template "base/footer" .}} + + \ No newline at end of file diff --git a/web_src/js/components/UserAnalysis.vue b/web_src/js/components/UserAnalysis.vue index c4c5608f1..5650e164f 100755 --- a/web_src/js/components/UserAnalysis.vue +++ b/web_src/js/components/UserAnalysis.vue @@ -135,13 +135,10 @@ -