Browse Source

Merge remote-tracking branch 'origin/develop' into fix-1960

fix-1960
liuzx 3 years ago
parent
commit
2b65cddca4
9 changed files with 158 additions and 40 deletions
  1. +4
    -1
      models/user_business_analysis.go
  2. +10
    -0
      options/locale/locale_en-US.ini
  3. +12
    -0
      options/locale/locale_zh-CN.ini
  4. +20
    -23
      routers/repo/user_data_analysis.go
  5. +1
    -1
      templates/repo/debugjob/index.tmpl
  6. +97
    -0
      templates/user/dashboard/dashboard.tmpl
  7. +1
    -1
      templates/user/settings/organization.tmpl
  8. +9
    -10
      web_src/js/components/UserAnalysis.vue
  9. +4
    -4
      web_src/less/openi.less

+ 4
- 1
models/user_business_analysis.go View File

@@ -535,13 +535,16 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS
//normalization //normalization
for k, v := range userIndexMap { for k, v := range userIndexMap {
tmpResult := (v - minUserIndex) / (maxUserIndex - minUserIndex) tmpResult := (v - minUserIndex) / (maxUserIndex - minUserIndex)
if tmpResult > 0.99 {
tmpResult = 0.99
}
updateUserIndex(tableName, statictisSess, k, tmpResult) updateUserIndex(tableName, statictisSess, k, tmpResult)
} }
log.Info("refresh data finished.tableName=" + tableName + " total record:" + fmt.Sprint(insertCount)) log.Info("refresh data finished.tableName=" + tableName + " total record:" + fmt.Sprint(insertCount))
} }


func updateUserIndex(tableName string, statictisSess *xorm.Session, userId int64, userIndex float64) { func updateUserIndex(tableName string, statictisSess *xorm.Session, userId int64, userIndex float64) {
updateSql := "UPDATE public." + tableName + " set user_index=" + fmt.Sprint(userIndex) + " where id=" + fmt.Sprint(userId)
updateSql := "UPDATE public." + tableName + " set user_index=" + fmt.Sprint(userIndex*100) + " where id=" + fmt.Sprint(userId)
statictisSess.Exec(updateSql) statictisSess.Exec(updateSql)
} }




+ 10
- 0
options/locale/locale_en-US.ini View File

@@ -266,6 +266,16 @@ search_related=related
search_maybe=maybe search_maybe=maybe
search_ge= search_ge=


wecome_AI_plt = Welcome to OpenI AI Collaboration Platform!
explore_AI = Explore better AI, come here to find more interesting
datasets = Datasets
repositories = Repositories
use_plt__fuction = To use the AI collaboration functions provided by this platform, such as: hosting code, sharing data, debugging algorithms or training models, start with
provide_resoure = Computing resources of CPU/GPU/NPU are provided freely for various types of AI tasks.
activity = Activity
no_events = There are no events related
or_t = or

[explore] [explore]
repos = Repositories repos = Repositories
select_repos = Select the project select_repos = Select the project


+ 12
- 0
options/locale/locale_zh-CN.ini View File

@@ -268,6 +268,18 @@ search_related=相关
search_maybe=约为 search_maybe=约为
search_ge=个 search_ge=个


wecome_AI_plt=欢迎来到启智AI协作平台!
explore_AI = 探索更好的AI,来这里发现更有意思的
datasets = 数据集
repositories = 项目
use_plt__fuction = 使用本平台提供的AI协作功能,如:托管代码、共享数据、调试算法或训练模型,请先
provide_resoure = 平台目前免费提供CPU、GPU、NPU的算力资源,可进行多种类型的AI任务。
create_pro = 创建项目
activity = 活动
no_events = 还没有与您相关的活动
or_t = 或


[explore] [explore]
repos=项目 repos=项目
select_repos=精选项目 select_repos=精选项目


+ 20
- 23
routers/repo/user_data_analysis.go View File

@@ -54,11 +54,11 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac
"N1": ctx.Tr("user.static.encyclopediascount"), "N1": ctx.Tr("user.static.encyclopediascount"),
"O1": ctx.Tr("user.static.createrepocount"), "O1": ctx.Tr("user.static.createrepocount"),
"P1": ctx.Tr("user.static.openiindex"), "P1": ctx.Tr("user.static.openiindex"),
"Q1": ctx.Tr("user.static.registdate"),
"R1": ctx.Tr("user.static.CloudBrainTaskNum"),
"S1": ctx.Tr("user.static.CloudBrainRunTime"),
"T1": ctx.Tr("user.static.CommitDatasetNum"),
"U1": ctx.Tr("user.static.CommitModelCount"),
"Q1": ctx.Tr("user.static.CloudBrainTaskNum"),
"R1": ctx.Tr("user.static.CloudBrainRunTime"),
"S1": ctx.Tr("user.static.CommitDatasetNum"),
"T1": ctx.Tr("user.static.CommitModelCount"),
"U1": ctx.Tr("user.static.registdate"),
"V1": ctx.Tr("user.static.countdate"), "V1": ctx.Tr("user.static.countdate"),
} }
for k, v := range dataHeader { for k, v := range dataHeader {
@@ -91,14 +91,12 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac
xlsx.SetCellValue(sheetName, "N"+rows, userRecord.EncyclopediasCount) xlsx.SetCellValue(sheetName, "N"+rows, userRecord.EncyclopediasCount)
xlsx.SetCellValue(sheetName, "O"+rows, userRecord.CreateRepoCount) xlsx.SetCellValue(sheetName, "O"+rows, userRecord.CreateRepoCount)
xlsx.SetCellValue(sheetName, "P"+rows, fmt.Sprintf("%.2f", userRecord.OpenIIndex)) xlsx.SetCellValue(sheetName, "P"+rows, fmt.Sprintf("%.2f", userRecord.OpenIIndex))

xlsx.SetCellValue(sheetName, "Q"+rows, userRecord.CloudBrainTaskNum)
xlsx.SetCellValue(sheetName, "R"+rows, fmt.Sprintf("%.2f", float64(userRecord.CloudBrainRunTime)/3600))
xlsx.SetCellValue(sheetName, "S"+rows, userRecord.CommitDatasetNum)
xlsx.SetCellValue(sheetName, "T"+rows, userRecord.CommitModelCount)
formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05") formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05")
xlsx.SetCellValue(sheetName, "Q"+rows, formatTime[0:len(formatTime)-3])

xlsx.SetCellValue(sheetName, "R"+rows, userRecord.CloudBrainTaskNum)
xlsx.SetCellValue(sheetName, "S"+rows, fmt.Sprintf("%.2f", float64(userRecord.CloudBrainRunTime)/3600))
xlsx.SetCellValue(sheetName, "T"+rows, userRecord.CommitDatasetNum)
xlsx.SetCellValue(sheetName, "U"+rows, userRecord.CommitModelCount)
xlsx.SetCellValue(sheetName, "U"+rows, formatTime[0:len(formatTime)-3])
formatTime = userRecord.DataDate formatTime = userRecord.DataDate
xlsx.SetCellValue(sheetName, "V"+rows, formatTime) xlsx.SetCellValue(sheetName, "V"+rows, formatTime)
} }
@@ -255,11 +253,11 @@ func QueryUserStaticDataPage(ctx *context.Context) {
"N1": ctx.Tr("user.static.encyclopediascount"), "N1": ctx.Tr("user.static.encyclopediascount"),
"O1": ctx.Tr("user.static.createrepocount"), "O1": ctx.Tr("user.static.createrepocount"),
"P1": ctx.Tr("user.static.openiindex"), "P1": ctx.Tr("user.static.openiindex"),
"Q1": ctx.Tr("user.static.registdate"),
"R1": ctx.Tr("user.static.CloudBrainTaskNum"),
"S1": ctx.Tr("user.static.CloudBrainRunTime"),
"T1": ctx.Tr("user.static.CommitDatasetNum"),
"U1": ctx.Tr("user.static.CommitModelCount"),
"Q1": ctx.Tr("user.static.CloudBrainTaskNum"),
"R1": ctx.Tr("user.static.CloudBrainRunTime"),
"S1": ctx.Tr("user.static.CommitDatasetNum"),
"T1": ctx.Tr("user.static.CommitModelCount"),
"U1": ctx.Tr("user.static.registdate"),
"V1": ctx.Tr("user.static.countdate"), "V1": ctx.Tr("user.static.countdate"),
} }
for k, v := range dataHeader { for k, v := range dataHeader {
@@ -286,13 +284,12 @@ func QueryUserStaticDataPage(ctx *context.Context) {
xlsx.SetCellValue(sheetName, "N"+rows, userRecord.EncyclopediasCount) xlsx.SetCellValue(sheetName, "N"+rows, userRecord.EncyclopediasCount)
xlsx.SetCellValue(sheetName, "O"+rows, userRecord.CreateRepoCount) xlsx.SetCellValue(sheetName, "O"+rows, userRecord.CreateRepoCount)
xlsx.SetCellValue(sheetName, "P"+rows, fmt.Sprintf("%.2f", userRecord.OpenIIndex)) xlsx.SetCellValue(sheetName, "P"+rows, fmt.Sprintf("%.2f", userRecord.OpenIIndex))

xlsx.SetCellValue(sheetName, "Q"+rows, userRecord.CloudBrainTaskNum)
xlsx.SetCellValue(sheetName, "R"+rows, fmt.Sprintf("%.2f", float64(userRecord.CloudBrainRunTime)/3600))
xlsx.SetCellValue(sheetName, "S"+rows, userRecord.CommitDatasetNum)
xlsx.SetCellValue(sheetName, "T"+rows, userRecord.CommitModelCount)
formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05") formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05")
xlsx.SetCellValue(sheetName, "Q"+rows, formatTime[0:len(formatTime)-3])
xlsx.SetCellValue(sheetName, "R"+rows, userRecord.CloudBrainTaskNum)
xlsx.SetCellValue(sheetName, "S"+rows, fmt.Sprintf("%.2f", float64(userRecord.CloudBrainRunTime)/3600))
xlsx.SetCellValue(sheetName, "T"+rows, userRecord.CommitDatasetNum)
xlsx.SetCellValue(sheetName, "U"+rows, userRecord.CommitModelCount)
xlsx.SetCellValue(sheetName, "U"+rows, formatTime[0:len(formatTime)-3])
formatTime = userRecord.DataDate formatTime = userRecord.DataDate
xlsx.SetCellValue(sheetName, "V"+rows, formatTime) xlsx.SetCellValue(sheetName, "V"+rows, formatTime)
} }


+ 1
- 1
templates/repo/debugjob/index.tmpl View File

@@ -380,7 +380,7 @@
<div class="menu" style="right: auto;"> <div class="menu" style="right: auto;">
<div class="item" style="padding: 0 !important;"> <div class="item" style="padding: 0 !important;">
{{if .CanDebug}} {{if .CanDebug}}
<a id="model-image-{{.Cloudbrain.ID}}" class='imageBtn ui basic {{if ne .Status "RUNNING"}} {{else}}blue {{end}}button' href="{{$.RepoLink}}/cloudbrain/{{.Cloudbrain.ID}}/commit_image">{{$.i18n.Tr "repo.submit_image"}}</a>
<a id="model-image-{{.Cloudbrain.ID}}" class='imageBtn ui basic {{if ne .Status "RUNNING"}}disabled {{else}}blue {{end}}button' href="{{$.RepoLink}}/cloudbrain/{{.Cloudbrain.ID}}/commit_image">{{$.i18n.Tr "repo.submit_image"}}</a>
{{else}} {{else}}
<a class="imageBtn ui basic disabled button">{{$.i18n.Tr "repo.submit_image"}}</a> <a class="imageBtn ui basic disabled button">{{$.i18n.Tr "repo.submit_image"}}</a>
{{end}} {{end}}


+ 97
- 0
templates/user/dashboard/dashboard.tmpl View File

@@ -5,13 +5,110 @@
{{template "base/alert" .}} {{template "base/alert" .}}
<div class="ui mobile reversed stackable grid"> <div class="ui mobile reversed stackable grid">
<div class="ui container ten wide column"> <div class="ui container ten wide column">
<div class="default" id = 'default_page' style="display: none;">
<div class="w_title">
{{.i18n.Tr "home.wecome_AI_plt"}}
</div>
<div class="content">
<p >{{.i18n.Tr "home.explore_AI"}} <a href="{{AppSubUrl}}/explore/repos"> {{.i18n.Tr "home.repositories"}}</a> {{.i18n.Tr "home.or_t"}} <a href="{{AppSubUrl}}/explore/datasets">{{.i18n.Tr "home.datasets"}}</a></p>
<p >{{.i18n.Tr "home.use_plt__fuction"}}&nbsp;<a class="mini ui blue button" href="{{AppSubUrl}}/repo/create{{if .ContextUser.IsOrganization}}?org={{.ContextUser.ID}}{{end}}" >{{.i18n.Tr "repo.create_repo"}}</a></p>
<p > {{.i18n.Tr "home.provide_resoure"}}</p>
</div>
<div class="guide ">
<a class="mini ui blue basic button" style="font-weight:700" href="https://git.openi.org.cn/zeizei/OpenI_Learning" target="_blank">{{.i18n.Tr "custom.Platform_Tutorial"}} <i class="ri-arrow-right-line" ></i></a>
</div>
</div>
{{if .EnableHeatmap}} {{if .EnableHeatmap}}
{{template "user/dashboard/heatmap" .}} {{template "user/dashboard/heatmap" .}}
{{end}} {{end}}
{{template "user/dashboard/feeds" .}} {{template "user/dashboard/feeds" .}}
<diV id = "activity_cont" style="display: none;">
<div class="ui placeholder segment bgtask-none padding_none line" >
<div class="act_title" style="padding-left: 0px ;">
{{.i18n.Tr "home.activity"}} :
</div>
<div class="ui icon header bgtask-header-pic"></div>
<p class="p_hint">
{{.i18n.Tr "home.no_events"}}
</p>
</div>
</diV>
</div> </div>
{{template "user/dashboard/repolist" .}} {{template "user/dashboard/repolist" .}}
</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}
<script>

const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
uid_ = Number((document.querySelector('meta[name=_context_uid]') || {}).content)
// console.log("uid:",uid_)
let URL = AppSubUrl + '/api/v1/repos/search?sort=updated&order=desc&uid='+uid_ +'&q=&page=1&limit=10&mode= ';
$.getJSON(URL, (result, _textStatus, request) => {
const counts_pro = request.getResponseHeader('X-Total-Count');
console.log("count:",counts_pro)
if (counts_pro == 0){
document.getElementById("default_page").style.display = "block";
document.getElementById("activity_cont").style.display = "block"
}
})
</script>

<style>
.default{
background-color: rgba(24, 144, 255, 0.1);
margin-bottom: 20px;
border-radius: 15px;
line-height: 20px;
padding:0px 25px;
}
.w_title{
padding-top: 25px;
color: rgba(16, 16, 16, 100);
font-size: 20px;
text-align: left;
font-weight: 700;
}
.content{
color: rgba(80, 85, 89, 100);
font-size: 14px;
text-align: left;
font-family: SourceHanSansSC-regular;
margin-top: 20px;
}

.guide{
margin-top:30px;
padding-bottom: 30px;
}

.activity{
margin-top: 20px;
}
.act_title{
color: rgba(16, 16, 16, 100) !important;
font-size: 20px;
text-align: left;
background-color: #fff !important;
font-weight: 700;
}
.p_hint{
color: rgba(136, 136, 136, 100);
font-size: 14px;
text-align: center;
font-family: SourceHanSansSC-regular;
}
.padding_none{
padding: 0px !important;
}

.ui.placeholder.segment {
min-height: 15rem !important;
}
.line{
border-top: 1px solid rgba(187, 187, 187, 0.5) !important;
margin-top: 20px !important;
}
</style>

+ 1
- 1
templates/user/settings/organization.tmpl View File

@@ -23,7 +23,7 @@
</form> </form>
</div> </div>
<img class="ui mini image" src="{{.RelAvatarLink}}"> <img class="ui mini image" src="{{.RelAvatarLink}}">
<div class="content">
<div class="content-org" style="display: inline-block;width: auto;padding: 0 0 0 0.5em;">
<a href="{{.HomeLink}}">{{.Name}}</a> <a href="{{.HomeLink}}">{{.Name}}</a>
</div> </div>
</div> </div>


+ 9
- 10
web_src/js/components/UserAnalysis.vue View File

@@ -135,15 +135,6 @@
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="RegistDate"
label="用户注册时间"
width="120px"
align="center">
<template slot-scope="scope">
{{scope.row.RegistDate | transformTimestamp}}
</template>
</el-table-column>
<el-table-column
prop="CloudBrainTaskNum" prop="CloudBrainTaskNum"
label="云脑任务数" label="云脑任务数"
width="120px" width="120px"
@@ -170,7 +161,15 @@
width="120px" width="120px"
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column
prop="RegistDate"
label="用户注册时间"
width="120px"
align="center">
<template slot-scope="scope">
{{scope.row.RegistDate | transformTimestamp}}
</template>
</el-table-column>
<el-table-column <el-table-column
prop="DataDate" prop="DataDate"
label="系统统计时间" label="系统统计时间"


+ 4
- 4
web_src/less/openi.less View File

@@ -969,10 +969,10 @@ display: block;
color: red; color: red;
} }


// .ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content {
// width: calc(100% - 4.0em);
// margin-left: 0;
// }
.ui.list .list>.item>img.image+.content, .ui.list>.item>img.image+.content {
width: calc(100% - 4.0em);
margin-left: 0;
}
.seach .ui.list .list>.item .header, .seach .ui.list>.item .header{ .seach .ui.list .list>.item .header, .seach .ui.list>.item .header{
margin-bottom: 0.5em; margin-bottom: 0.5em;


Loading…
Cancel
Save