hebintags/v1.21.12.1
| @@ -6,6 +6,8 @@ import ( | |||
| "strings" | |||
| "time" | |||
| "code.gitea.io/gitea/modules/log" | |||
| "code.gitea.io/gitea/modules/git" | |||
| ) | |||
| @@ -213,7 +215,8 @@ func GetAllUserKPIStats() (map[string]*git.UserKPIStats, error) { | |||
| for _, repository := range repositorys { | |||
| authorsOneRepo, err1 := git.GetUserKPIStats(repository.RepoPath()) | |||
| if err1 != nil { | |||
| return nil, err | |||
| log.Warn("get user kpi status err:"+repository.RepoPath(), err1.Error()) | |||
| continue | |||
| } | |||
| for key, value := range authorsOneRepo { | |||
| @@ -89,7 +89,7 @@ type UserBusinessAnalysis struct { | |||
| //action :ActionCommitRepo // 5 | |||
| CommitCount int `xorm:"NOT NULL DEFAULT 0"` | |||
| //action :ActionCreateIssue // 10 | |||
| //action :ActionCreateIssue // 6 | |||
| IssueCount int `xorm:"NOT NULL DEFAULT 0"` | |||
| //comment table current date | |||
| @@ -406,7 +406,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, | |||
| DataDate := startTime.Format("2006-01-02") | |||
| CodeMergeCountMap := queryPullRequest(start_unix, end_unix) | |||
| CommitCountMap := queryAction(start_unix, end_unix, 5) | |||
| CommitCountMap := queryCommitAction(start_unix, end_unix, 5) | |||
| IssueCountMap := queryAction(start_unix, end_unix, 6) | |||
| CommentCountMap := queryComment(start_unix, end_unix) | |||
| @@ -674,6 +674,24 @@ func queryPullRequest(start_unix int64, end_unix int64) map[int64]int { | |||
| return resultMap | |||
| } | |||
| func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { | |||
| sess := x.NewSession() | |||
| defer sess.Close() | |||
| sess.Select("id,user_id,op_type,act_user_id").Table("action").Where("user_id=act_user_id and op_type=" + fmt.Sprint(actionType) + " and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix)) | |||
| actionList := make([]*Action, 0) | |||
| sess.Find(&actionList) | |||
| resultMap := make(map[int64]int) | |||
| log.Info("query action size=" + fmt.Sprint(len(actionList))) | |||
| for _, actionRecord := range actionList { | |||
| if _, ok := resultMap[actionRecord.UserID]; !ok { | |||
| resultMap[actionRecord.UserID] = 1 | |||
| } else { | |||
| resultMap[actionRecord.UserID] += 1 | |||
| } | |||
| } | |||
| return resultMap | |||
| } | |||
| func queryAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { | |||
| sess := x.NewSession() | |||
| defer sess.Close() | |||
| @@ -0,0 +1 @@ | |||
| <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1637739132178" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1729" width="64" height="64" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"></style></defs><path d="M512 69.717333l383.018667 221.141334v442.282666L512 954.282667 128.981333 733.141333V290.858667L512 69.717333zM192.96 375.402667v320.768L480 861.888V541.141333l-287.04-165.76z m638.058667 0L544 541.162667V861.866667l287.018667-165.717334V375.424zM512 143.637333L215.722667 314.666667 512 485.717333l296.256-171.050666L512 143.616z" fill="#8a8a8a" p-id="1730"></path></svg> | |||
| @@ -4,7 +4,6 @@ import ( | |||
| "fmt" | |||
| "net/http" | |||
| "net/url" | |||
| "strings" | |||
| "time" | |||
| "code.gitea.io/gitea/models" | |||
| @@ -39,6 +38,7 @@ func QueryUserStaticDataPage(ctx *context.Context) { | |||
| endTime = time.Now() | |||
| } else { | |||
| startTime, _ = time.ParseInLocation("2006-01-02", startDate, time.Local) | |||
| startTime = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 12, 0, 0, 0, startTime.Location()) | |||
| settingStartTime, _ := time.Parse("2006-01-02", setting.RadarMap.RecordBeginTime) | |||
| if startTime.Unix() < settingStartTime.Unix() { | |||
| startTime = settingStartTime | |||
| @@ -46,6 +46,8 @@ func QueryUserStaticDataPage(ctx *context.Context) { | |||
| } | |||
| endTime, _ = time.ParseInLocation("2006-01-02", endDate, time.Local) | |||
| endTime = endTime.AddDate(0, 0, 1) | |||
| endTime = time.Date(endTime.Year(), endTime.Month(), endTime.Day(), 23, 59, 59, 0, startTime.Location()) | |||
| isAll = false | |||
| log.Info("startTime=" + fmt.Sprint(startTime.Unix()) + " endDate=" + fmt.Sprint(endTime.Unix())) | |||
| } | |||
| @@ -126,23 +128,8 @@ func QueryUserStaticDataPage(ctx *context.Context) { | |||
| //设置默认打开的表单 | |||
| xlsx.SetActiveSheet(index) | |||
| var filename string | |||
| nowTime := time.Now() | |||
| nowZeroTime := time.Date(nowTime.Year(), nowTime.Month(), nowTime.Day(), 0, 0, 0, 0, nowTime.Location()) | |||
| if endTime.Unix() >= nowZeroTime.Unix() { | |||
| endDate = nowZeroTime.AddDate(0, 0, -1).Format("2006-01-02") | |||
| } | |||
| if isAll { | |||
| filename = sheetName + "_" + ctx.Tr("user.static.all") + ".xlsx" | |||
| } else { | |||
| filename = sheetName + "_" + strings.ReplaceAll(startDate, "-", "") + "_" + strings.ReplaceAll(endDate, "-", "") + ".xlsx" | |||
| } | |||
| if len(userName) > 0 { | |||
| filename = sheetName + "_" + userName + "_" + strings.ReplaceAll(startDate, "-", "") + "_" + strings.ReplaceAll(endDate, "-", "") + ".xlsx" | |||
| } | |||
| filename := sheetName + "_" + ctx.Tr("user.static.all") + ".xlsx" | |||
| ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) | |||
| ctx.Resp.Header().Set("Content-Type", "application/octet-stream") | |||
| @@ -708,14 +708,14 @@ td, th { | |||
| html += "</div>" | |||
| $(`#dir_list${version_name}`).append(html) | |||
| } | |||
| // $(`.log{}`).scroll() | |||
| function logScroll(version_name) { | |||
| let scrollTop = $(`#log${version_name}`)[0].scrollTop; // 滚动距离 | |||
| let scrollHeight = $(`#log${version_name}`)[0].scrollHeight; // 文档高度 | |||
| let divHeight = $(`#log${version_name}`).height(); // 可视区高度 | |||
| // let version_name=$(this).find('input[name=version_name]').val() | |||
| console.log("scrollTo,scrollHeight,divHeight",scrollTop,scrollHeight,divHeight) | |||
| if(parseInt(scrollTop) + divHeight -10 == scrollHeight){ | |||
| let container = document.querySelector(`#log${version_name}`) | |||
| let scrollTop = container.scrollTop | |||
| let scrollHeight = container.scrollHeight | |||
| let clientHeight = container.clientHeight | |||
| if(scrollTop + clientHeight == scrollHeight && scrollHeight>clientHeight){ | |||
| let end_line = $(`#log${version_name} input[name=end_line]`).val() | |||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, (data) => { | |||
| if (data.Lines == 0){ | |||
| @@ -13,7 +13,7 @@ | |||
| <el-tab-pane label="项目分析" name="second" id="second" > | |||
| <ProAnalysis ref='ProAnalysis'id="pro" v-if="isRouterAlive"></ProAnalysis> | |||
| <span slot="label"> | |||
| <el-image style="width: 13px; height: 13px" src="/img/pro.svg"> | |||
| <el-image style="width: 13px; height: 13px" src="/img/pro_new.svg"> | |||
| </el-image> | |||
| 项目分析 | |||
| </span> | |||
| @@ -199,9 +199,9 @@ | |||
| <div class="item_l" id="charts"> | |||
| <div style="font-size:14px;color:#409eff;margin:20px 5px;">OpenI指数:{{tableDataIDTotal.openi | rounding}}</div> | |||
| <div > | |||
| <el-col :span='8' id="radar_openi" :style="{width: '400px', height: '300px'}"></el-col> | |||
| <el-col :span='8' id="radar_openi" :style="{ height: '300px'}"></el-col> | |||
| <el-col :span='16' id="line_openi" :style="{width: '600px', height: '300px',float:'right'}"></el-col> | |||
| <el-col :span='16' id="line_openi" :style="{ height: '300px',float:'right'}"></el-col> | |||
| </div> | |||
| </div> | |||
| </el-col> | |||
| @@ -292,7 +292,7 @@ | |||
| <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="commit"/>commit | |||
| </label> | |||
| </div> | |||
| <div id ="selectData" style="width: 1280px;height: 300px;"> | |||
| <div id ="selectData" style="height: 300px;"> | |||
| </div> | |||
| @@ -712,8 +712,9 @@ | |||
| params:this.paramsID | |||
| }).then((res)=>{ | |||
| if (bool_val){ | |||
| this.tableDataIDOpenI = res.data | |||
| this.tableDataIDOpenI = res.data | |||
| this.drawOpenItrend() | |||
| }else{ | |||
| @@ -925,6 +926,11 @@ | |||
| ] | |||
| }; | |||
| this.echartsOITd.setOption(option) | |||
| // setTimeout(function (){ | |||
| // window.onresize = function () { | |||
| // this.echartsOITd.resize(); | |||
| // } | |||
| // },200) | |||
| }, | |||
| drawSelectData(){ | |||
| @@ -1018,6 +1024,11 @@ | |||
| ] | |||
| }; | |||
| this.echartsSelectData.setOption(this.option) | |||
| // setTimeout(function (){ | |||
| // window.onresize = function () { | |||
| // this.echartsSelectData.resize; | |||
| // } | |||
| // },200) | |||
| // // 使用刚指定的选择项数据显示图表。 | |||
| // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值 | |||
| @@ -1117,14 +1128,13 @@ | |||
| mounted() { | |||
| // document.getElementById("all").style.outline="none" | |||
| // document.getElementById("all").focus() | |||
| this.getAllProList("all",7) | |||
| console.log("id:"+this.pro_id); | |||
| // document.getElementById('radar_openi').style.width = document.getElementById('charts').offsetWidth*0.4+'px' | |||
| // document.getElementById('line_openi').style.width = document.getElementById('charts').offsetWidth*0.6+'px' | |||
| // document.getElementById('selectData').style.width = document.getElementById('linecharts').offsetWidth+'px' | |||
| document.getElementById('radar_openi').style.width = document.getElementById('pro_main').offsetWidth*0.22+'px' | |||
| document.getElementById('line_openi').style.width = document.getElementById('pro_main').offsetWidth*0.33+'px' | |||
| document.getElementById('selectData').style.width = document.getElementById('pro_main').offsetWidth*0.8+'px' | |||
| 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')) | |||
| @@ -1266,4 +1276,4 @@ | |||
| margin-top: 10px; | |||
| font-weight:bold; | |||
| } | |||
| </style> | |||
| </style> | |||