Browse Source

Merge branch 'fix-2054' of https://git.openi.org.cn/OpenI/aiforge into fix-2054

tags/v1.22.5.2^2
liuzx 3 years ago
parent
commit
fd40e7be70
19 changed files with 275 additions and 156 deletions
  1. +4
    -2
      models/dataset.go
  2. +5
    -1
      models/org.go
  3. +5
    -17
      models/user_business_analysis.go
  4. +6
    -5
      modules/repofiles/update.go
  5. +5
    -1
      options/locale/locale_en-US.ini
  6. +5
    -1
      options/locale/locale_zh-CN.ini
  7. +19
    -32
      routers/repo/cloudbrain.go
  8. +27
    -3
      routers/repo/dataset.go
  9. +8
    -8
      routers/repo/modelarts.go
  10. +25
    -6
      routers/repo/user_data_analysis.go
  11. +2
    -2
      templates/org/member/members.tmpl
  12. +1
    -1
      templates/org/navber.tmpl
  13. +50
    -51
      templates/repo/attachment/upload.tmpl
  14. +22
    -4
      templates/repo/datasets/index.tmpl
  15. +8
    -1
      templates/user/dashboard/repolist.tmpl
  16. +13
    -1
      web_src/js/components/UserAnalysis.vue
  17. +8
    -3
      web_src/js/components/UserTrend.vue
  18. +21
    -14
      web_src/js/index.js
  19. +41
    -3
      web_src/less/openi.less

+ 4
- 2
models/dataset.go View File

@@ -1,10 +1,12 @@
package models package models


import ( import (
"code.gitea.io/gitea/modules/log"
"errors" "errors"
"fmt" "fmt"
"sort" "sort"
"strings"

"code.gitea.io/gitea/modules/log"


"code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/timeutil"
"xorm.io/builder" "xorm.io/builder"
@@ -179,7 +181,7 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond {


func generateFilterCond(opts *SearchDatasetOptions, cond builder.Cond) builder.Cond { func generateFilterCond(opts *SearchDatasetOptions, cond builder.Cond) builder.Cond {
if len(opts.Keyword) > 0 { if len(opts.Keyword) > 0 {
cond = cond.And(builder.Or(builder.Like{"dataset.title", opts.Keyword}, builder.Like{"dataset.description", opts.Keyword}))
cond = cond.And(builder.Or(builder.Like{"LOWER(dataset.title)", strings.ToLower(opts.Keyword)}, builder.Like{"LOWER(dataset.description)", strings.ToLower(opts.Keyword)}))
} }


if len(opts.Category) > 0 { if len(opts.Category) > 0 {


+ 5
- 1
models/org.go View File

@@ -160,7 +160,11 @@ func UpdateOrgStatistics() {
has, _ := x.Get(orgStat) has, _ := x.Get(orgStat)


orgStat.NumScore = numScore orgStat.NumScore = numScore
if has {

count, err := GetPublicRepositoryCount(&org)
if err != nil || count == 0 {
x.ID(orgStat.ID).Delete(new(OrgStatistic))
} else if has {
x.ID(orgStat.ID).Cols("num_score").Update(&orgStat) x.ID(orgStat.ID).Cols("num_score").Update(&orgStat)
} else { } else {
x.Insert(orgStat) x.Insert(orgStat)


+ 5
- 17
models/user_business_analysis.go View File

@@ -477,6 +477,7 @@ func QueryUserStaticDataForUserDefine(opts *UserBusinessAnalysisQueryOptions, wi
dateRecord.Email = userRecord.Email dateRecord.Email = userRecord.Email
dateRecord.RegistDate = userRecord.CreatedUnix dateRecord.RegistDate = userRecord.CreatedUnix
dateRecord.Name = userRecord.Name dateRecord.Name = userRecord.Name
dateRecord.UserLocation = userRecord.Location
dateRecord.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime()) dateRecord.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime())


dateRecord.CodeMergeCount = getMapValue(dateRecord.ID, CodeMergeCountMap) dateRecord.CodeMergeCount = getMapValue(dateRecord.ID, CodeMergeCountMap)
@@ -534,7 +535,7 @@ func QueryUserStaticDataForUserDefine(opts *UserBusinessAnalysisQueryOptions, wi
break break
} }
} }
log.Info("query user define,count=" + fmt.Sprint((ResultList)))
log.Info("query user define,count=" + fmt.Sprint(len(ResultList)))
return ResultList, int64(len(ResultList)) return ResultList, int64(len(ResultList))
} }


@@ -973,7 +974,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time,
dateRecord.Name = userRecord.Name dateRecord.Name = userRecord.Name
dateRecord.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime()) dateRecord.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime())
dateRecord.DataDate = DataDate dateRecord.DataDate = DataDate
dateRecord.UserLocation = userRecord.Location
dateRecord.CodeMergeCount = getMapValue(dateRecord.ID, CodeMergeCountMap) dateRecord.CodeMergeCount = getMapValue(dateRecord.ID, CodeMergeCountMap)
dateRecord.CommitCount = getMapValue(dateRecord.ID, CommitCountMap) dateRecord.CommitCount = getMapValue(dateRecord.ID, CommitCountMap)
dateRecord.IssueCount = getMapValue(dateRecord.ID, IssueCountMap) dateRecord.IssueCount = getMapValue(dateRecord.ID, IssueCountMap)
@@ -1026,20 +1027,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time,
log.Info("has activity." + userRecord.Name) log.Info("has activity." + userRecord.Name)
addUserToMap(userNewAddActivity, userRecord.CreatedUnix, dateRecord.ID) addUserToMap(userNewAddActivity, userRecord.CreatedUnix, dateRecord.ID)
} }
if !userRecord.IsActive {
continue
}


var deleteDateRecord UserBusinessAnalysis
deleteDateRecord.ID = userRecord.ID
deleteDateRecord.CountDate = CountDate.Unix()
statictisSess.Delete(&deleteDateRecord)

_, err = statictisSess.Insert(&dateRecord)
if err != nil {
log.Info("insert daterecord failed." + err.Error())
return err
}
} }


indexTotal += PAGE_SIZE indexTotal += PAGE_SIZE
@@ -1166,7 +1154,7 @@ func getUserIndexFromAnalysisAll(dateRecord UserBusinessAnalysisAll, ParaWeight
// 登录次数 0.10 // 登录次数 0.10
result = float64(dateRecord.CodeMergeCount) * getParaWeightValue("CodeMergeCount", ParaWeight, 0.2) result = float64(dateRecord.CodeMergeCount) * getParaWeightValue("CodeMergeCount", ParaWeight, 0.2)
result += float64(dateRecord.CommitCount) * getParaWeightValue("CommitCount", ParaWeight, 0.2) result += float64(dateRecord.CommitCount) * getParaWeightValue("CommitCount", ParaWeight, 0.2)
log.Info("1 result=" + fmt.Sprint(result))
//log.Info("1 result=" + fmt.Sprint(result))
result += float64(dateRecord.IssueCount) * getParaWeightValue("IssueCount", ParaWeight, 0.2) result += float64(dateRecord.IssueCount) * getParaWeightValue("IssueCount", ParaWeight, 0.2)
result += float64(dateRecord.CommentCount) * getParaWeightValue("CommentCount", ParaWeight, 0.2) result += float64(dateRecord.CommentCount) * getParaWeightValue("CommentCount", ParaWeight, 0.2)
result += float64(dateRecord.FocusRepoCount) * getParaWeightValue("FocusRepoCount", ParaWeight, 0.1) result += float64(dateRecord.FocusRepoCount) * getParaWeightValue("FocusRepoCount", ParaWeight, 0.1)
@@ -1249,7 +1237,7 @@ func getUserIndex(dateRecord UserBusinessAnalysis, ParaWeight map[string]float64
// 登录次数 0.10 // 登录次数 0.10
result = float64(dateRecord.CodeMergeCount) * getParaWeightValue("CodeMergeCount", ParaWeight, 0.2) result = float64(dateRecord.CodeMergeCount) * getParaWeightValue("CodeMergeCount", ParaWeight, 0.2)
result += float64(dateRecord.CommitCount) * getParaWeightValue("CommitCount", ParaWeight, 0.2) result += float64(dateRecord.CommitCount) * getParaWeightValue("CommitCount", ParaWeight, 0.2)
log.Info("2 result=" + fmt.Sprint(result))
//log.Info("2 result=" + fmt.Sprint(result))
result += float64(dateRecord.IssueCount) * getParaWeightValue("IssueCount", ParaWeight, 0.2) result += float64(dateRecord.IssueCount) * getParaWeightValue("IssueCount", ParaWeight, 0.2)
result += float64(dateRecord.CommentCount) * getParaWeightValue("CommentCount", ParaWeight, 0.2) result += float64(dateRecord.CommentCount) * getParaWeightValue("CommentCount", ParaWeight, 0.2)
result += float64(dateRecord.FocusRepoCount) * getParaWeightValue("FocusRepoCount", ParaWeight, 0.1) result += float64(dateRecord.FocusRepoCount) * getParaWeightValue("FocusRepoCount", ParaWeight, 0.1)


+ 6
- 5
modules/repofiles/update.go View File

@@ -783,6 +783,7 @@ func RenameRepoFile(repo *models.Repository, doer *models.User, opts *RenameRepo


// Check that the path given in opts.treePath is valid (not a git path) // Check that the path given in opts.treePath is valid (not a git path)
treePath := CleanUploadFileName(opts.TreePath) treePath := CleanUploadFileName(opts.TreePath)
treePath = strings.ReplaceAll(treePath, " ", "")
if treePath == "" { if treePath == "" {
return models.ErrFilenameInvalid{ return models.ErrFilenameInvalid{
Path: opts.TreePath, Path: opts.TreePath,
@@ -942,16 +943,16 @@ func moveAndAddFiles(oldTreePath, newTreePath string, t *TemporaryUploadReposito
} }
//example for v(mode SHA-1 stage file) //example for v(mode SHA-1 stage file)
//100755 d294c88235ac05d3dece028d8a65590f28ec46ac 0 custom/conf/app.ini //100755 d294c88235ac05d3dece028d8a65590f28ec46ac 0 custom/conf/app.ini
v = strings.ReplaceAll(v, "0\t", "")
tmpArray := strings.Split(v, " ")
oldPath := tmpArray[2]
tempArray := strings.Split(v, "0\t")
leftArray := strings.Split(tempArray[0], " ")
oldPath := tempArray[1]
newPath := newTreePath + strings.TrimPrefix(oldPath, oldTreePath) newPath := newTreePath + strings.TrimPrefix(oldPath, oldTreePath)
// mode 0 means remove file // mode 0 means remove file
stdIn.WriteString("0 0000000000000000000000000000000000000000\t") stdIn.WriteString("0 0000000000000000000000000000000000000000\t")
stdIn.WriteString(oldPath) stdIn.WriteString(oldPath)
stdIn.WriteByte('\000') stdIn.WriteByte('\000')
stdIn.WriteString(tmpArray[0] + " ")
stdIn.WriteString(tmpArray[1] + "\t")
stdIn.WriteString(leftArray[0] + " ")
stdIn.WriteString(leftArray[1] + "\t")
stdIn.WriteString(newPath) stdIn.WriteString(newPath)
stdIn.WriteByte('\000') stdIn.WriteByte('\000')
} }


+ 5
- 1
options/locale/locale_en-US.ini View File

@@ -519,6 +519,8 @@ static.RecommendDataset=Recommended Dataset Count
static.CollectImage=Collect Image Count static.CollectImage=Collect Image Count
static.CollectedImage=Collected Image Count static.CollectedImage=Collected Image Count
static.RecommendImage=Recommended Image Count static.RecommendImage=Recommended Image Count
static.email=Email
static.location=Location
static.all=All static.all=All
static.public.user_business_analysis_current_month=Current_Month static.public.user_business_analysis_current_month=Current_Month
static.public.user_business_analysis_current_week=Current_Week static.public.user_business_analysis_current_week=Current_Week
@@ -528,7 +530,7 @@ static.public.user_business_analysis_last30_day=Last_30_day
static.public.user_business_analysis_last_month=Last_Month static.public.user_business_analysis_last_month=Last_Month
static.public.user_business_analysis_yesterday=Yesterday static.public.user_business_analysis_yesterday=Yesterday
static.public.user_business_analysis_all=All static.public.user_business_analysis_all=All
static.downloadinfo=Due to the large amount of data generated in the customized time period and long calculation time, please download and export the data from the following address and export the data download address:
metrics.sheetname=User Trend Analysis metrics.sheetname=User Trend Analysis
metrics.date=Count Date metrics.date=Count Date
metrics.newregistuser=New registered user metrics.newregistuser=New registered user
@@ -537,6 +539,7 @@ metrics.hasactivateuser=New contributing activities
metrics.newregistnotactiveuser=New inactive metrics.newregistnotactiveuser=New inactive
metrics.averageuser=Average new users metrics.averageuser=Average new users
metrics.newuseractiveindex=Activation rate of new users metrics.newuseractiveindex=Activation rate of new users
metrics.currentdayactivity=Current day contributing activities
metrics.totalregistuser=Cumulative registered users metrics.totalregistuser=Cumulative registered users
metrics.totalactiveduser=Cumulative activated users metrics.totalactiveduser=Cumulative activated users
metrics.totalhasactivityuser=Cumulative active users metrics.totalhasactivityuser=Cumulative active users
@@ -2946,6 +2949,7 @@ raw_minutes = minutes


[dropzone] [dropzone]
default_message = Drop files or click here to upload. default_message = Drop files or click here to upload.
default_dataset_message = Click to add files or directly drag and drop files here
invalid_input_type = You can not upload files of this type. invalid_input_type = You can not upload files of this type.
file_too_big = File size ({{filesize}} MB) exceeds the maximum size of ({{maxFilesize}} MB). file_too_big = File size ({{filesize}} MB) exceeds the maximum size of ({{maxFilesize}} MB).
remove_file = Remove file remove_file = Remove file


+ 5
- 1
options/locale/locale_zh-CN.ini View File

@@ -524,6 +524,8 @@ static.RecommendDataset=被推荐数据集数
static.CollectImage=收藏镜像数 static.CollectImage=收藏镜像数
static.CollectedImage=被收藏镜像数 static.CollectedImage=被收藏镜像数
static.RecommendImage=被推荐镜像数 static.RecommendImage=被推荐镜像数
static.email=Email
static.location=所在地区
static.all=所有 static.all=所有
static.public.user_business_analysis_current_month=本月 static.public.user_business_analysis_current_month=本月
static.public.user_business_analysis_current_week=本周 static.public.user_business_analysis_current_week=本周
@@ -533,7 +535,7 @@ static.public.user_business_analysis_last30_day=近30天
static.public.user_business_analysis_last_month=上月 static.public.user_business_analysis_last_month=上月
static.public.user_business_analysis_yesterday=昨天 static.public.user_business_analysis_yesterday=昨天
static.public.user_business_analysis_all=所有 static.public.user_business_analysis_all=所有
static.downloadinfo=因自定义时间段产生的数据量比较大,计算时间比较长,请您从如下地址下载导出数据,导出数据下载地址:
metrics.sheetname=用户趋势分析 metrics.sheetname=用户趋势分析
metrics.date=日期 metrics.date=日期
metrics.newregistuser=新增注册用户 metrics.newregistuser=新增注册用户
@@ -542,6 +544,7 @@ metrics.hasactivateuser=新增有贡献活动
metrics.newregistnotactiveuser=新增未激活 metrics.newregistnotactiveuser=新增未激活
metrics.averageuser=平均新增用户 metrics.averageuser=平均新增用户
metrics.newuseractiveindex=新增用户激活率 metrics.newuseractiveindex=新增用户激活率
metrics.currentdayactivity=当日有贡献活动
metrics.totalregistuser=累计注册用户 metrics.totalregistuser=累计注册用户
metrics.totalactiveduser=累计已激活 metrics.totalactiveduser=累计已激活
metrics.totalhasactivityuser=累计有贡献活动 metrics.totalhasactivityuser=累计有贡献活动
@@ -2956,6 +2959,7 @@ raw_minutes=分钟


[dropzone] [dropzone]
default_message=拖动文件或者点击此处上传。 default_message=拖动文件或者点击此处上传。
default_dataset_message=点击添加文件或直接拖拽文件到此处。
invalid_input_type=您不能上传该类型的文件 invalid_input_type=您不能上传该类型的文件
file_too_big=文件体积({{filesize}} MB)超过了最大允许体积({{maxFilesize}} MB) file_too_big=文件体积({{filesize}} MB)超过了最大允许体积({{maxFilesize}} MB)
remove_file=移除文件 remove_file=移除文件


+ 19
- 32
routers/repo/cloudbrain.go View File

@@ -206,7 +206,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
ctx.Data["PageIsCloudBrain"] = true ctx.Data["PageIsCloudBrain"] = true
displayJobName := form.DisplayJobName displayJobName := form.DisplayJobName
jobName := util.ConvertDisplayJobNameToJobName(displayJobName) jobName := util.ConvertDisplayJobNameToJobName(displayJobName)
image := form.Image
image := strings.TrimSpace(form.Image)
uuid := form.Attachment uuid := form.Attachment
jobType := form.JobType jobType := form.JobType
gpuQueue := form.GpuType gpuQueue := form.GpuType
@@ -283,30 +283,6 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
mkModelPath(modelPath) mkModelPath(modelPath)
uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/") uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/")


benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
if setting.IsBenchmarkEnabled && jobType == string(models.JobTypeBenchmark) {
var gpuType string
for _, gpuInfo := range gpuInfos.GpuInfo {
if gpuInfo.Queue == gpuQueue {
gpuType = gpuInfo.Value
}
}
downloadRateCode(repo, jobName, setting.BenchmarkOwner, setting.BenchmarkName, benchmarkPath, form.BenchmarkCategory, gpuType)
uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/")
}

snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) {
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "")
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/")
}

brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath
if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) {
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "")
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/")
}

err = cloudbrain.GenerateTask(ctx, displayJobName, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), err = cloudbrain.GenerateTask(ctx, displayJobName, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"),
storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"),
storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"),
@@ -482,6 +458,17 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo
ctx.Data["resource_type"] = resourceType.Value ctx.Data["resource_type"] = resourceType.Value
} }
} }
} else if cloudbrain.IsBenchmarkJob(task.JobType) {
if benchmarkGpuInfos == nil {
json.Unmarshal([]byte(setting.BenchmarkGpuTypes), &benchmarkGpuInfos)
}

for _, resourceType := range benchmarkGpuInfos.GpuInfo {
if resourceType.Queue == jobRes.Config.GpuType {
ctx.Data["resource_type"] = resourceType.Value
}
}

} else { } else {
if gpuInfos == nil { if gpuInfos == nil {
json.Unmarshal([]byte(setting.GpuTypes), &gpuInfos) json.Unmarshal([]byte(setting.GpuTypes), &gpuInfos)
@@ -1241,7 +1228,7 @@ func downloadCode(repo *models.Repository, codePath, branchName string) error {
return nil return nil
} }


func downloadRateCode(repo *models.Repository, taskName, rateOwnerName, rateRepoName, codePath, benchmarkCategory, gpuType string) error {
func downloadRateCode(repo *models.Repository, taskName, rateOwnerName, rateRepoName, codePath, benchmarkCategory, gpuType, userName string) error {
err := os.MkdirAll(codePath, os.ModePerm) err := os.MkdirAll(codePath, os.ModePerm)
if err != nil { if err != nil {
log.Error("mkdir codePath failed", err.Error()) log.Error("mkdir codePath failed", err.Error())
@@ -1269,7 +1256,7 @@ func downloadRateCode(repo *models.Repository, taskName, rateOwnerName, rateRepo
defer f.Close() defer f.Close()


data, err := json.Marshal(models.TaskInfo{ data, err := json.Marshal(models.TaskInfo{
Username: repo.Owner.Name,
Username: userName,
TaskName: taskName, TaskName: taskName,
CodeName: repo.Name, CodeName: repo.Name,
BenchmarkCategory: strings.Split(benchmarkCategory, ","), BenchmarkCategory: strings.Split(benchmarkCategory, ","),
@@ -1845,7 +1832,7 @@ func BenchMarkAlgorithmCreate(ctx *context.Context, form auth.CreateCloudBrainFo
ctx.Data["PageIsCloudBrain"] = true ctx.Data["PageIsCloudBrain"] = true
displayJobName := form.DisplayJobName displayJobName := form.DisplayJobName
jobName := util.ConvertDisplayJobNameToJobName(displayJobName) jobName := util.ConvertDisplayJobNameToJobName(displayJobName)
image := form.Image
image := strings.TrimSpace(form.Image)
gpuQueue := form.GpuType gpuQueue := form.GpuType
command := cloudbrain.CommandBenchmark command := cloudbrain.CommandBenchmark
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath
@@ -1970,7 +1957,7 @@ func BenchMarkAlgorithmCreate(ctx *context.Context, form auth.CreateCloudBrainFo
} }
} }


if err := downloadRateCode(repo, jobName, childInfo.Owner, childInfo.RepoName, benchmarkPath, form.BenchmarkCategory, gpuType); err != nil {
if err := downloadRateCode(repo, jobName, childInfo.Owner, childInfo.RepoName, benchmarkPath, form.BenchmarkCategory, gpuType, ctx.User.Name); err != nil {
log.Error("downloadRateCode failed, %v", err, ctx.Data["MsgID"]) log.Error("downloadRateCode failed, %v", err, ctx.Data["MsgID"])
//cloudBrainNewDataPrepare(ctx) //cloudBrainNewDataPrepare(ctx)
//ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) //ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form)
@@ -2068,7 +2055,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)


snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) {
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "")
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "", ctx.User.Name)
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/") uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description)) command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description))


@@ -2076,7 +2063,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
benchmarkChildTypeID := 0 benchmarkChildTypeID := 0
brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath
if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) {
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "")
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "", ctx.User.Name)
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/") uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/")
benchmarkChildTypeID = form.BenchmarkChildTypeID benchmarkChildTypeID = form.BenchmarkChildTypeID
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description)) command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description))
@@ -2136,7 +2123,7 @@ func CloudBrainTrainJobNew(ctx *context.Context) {


func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) { func getTrainJobCommand(form auth.CreateCloudBrainForm) (string, error) {
var command string var command string
bootFile := form.BootFile
bootFile := strings.TrimSpace(form.BootFile)
params := form.Params params := form.Params


if !strings.HasSuffix(bootFile, ".py") { if !strings.HasSuffix(bootFile, ".py") {


+ 27
- 3
routers/repo/dataset.go View File

@@ -106,6 +106,8 @@ func DatasetIndex(ctx *context.Context) {
MustEnableDataset(ctx) MustEnableDataset(ctx)
ctx.Data["PageIsDataset"] = true ctx.Data["PageIsDataset"] = true


ctx.Data["SortType"] = ctx.Query("sort")

repo := ctx.Repo.Repository repo := ctx.Repo.Repository


dataset, err := models.GetDatasetByRepo(repo) dataset, err := models.GetDatasetByRepo(repo)
@@ -128,9 +130,31 @@ func DatasetIndex(ctx *context.Context) {


attachments := newFilterPrivateAttachments(ctx, dataset.Attachments, repo) attachments := newFilterPrivateAttachments(ctx, dataset.Attachments, repo)


sort.Slice(attachments, func(i, j int) bool {
return attachments[i].CreatedUnix > attachments[j].CreatedUnix
})
if ctx.Data["SortType"] == "nameAsc" {
sort.Slice(attachments, func(i, j int) bool {
return strings.ToLower(attachments[i].Name) < strings.ToLower(attachments[j].Name)
})
} else if ctx.Data["SortType"] == "nameDesc" {
sort.Slice(attachments, func(i, j int) bool {
return strings.ToLower(attachments[i].Name) > strings.ToLower(attachments[j].Name)
})
} else if ctx.Data["SortType"] == "sizeAsc" {
sort.Slice(attachments, func(i, j int) bool {
return attachments[i].Size < attachments[j].Size
})
} else if ctx.Data["SortType"] == "sizeDesc" {
sort.Slice(attachments, func(i, j int) bool {
return attachments[i].Size > attachments[j].Size
})
} else if ctx.Data["SortType"] == "timeAsc" {
sort.Slice(attachments, func(i, j int) bool {
return attachments[i].CreatedUnix < attachments[j].CreatedUnix
})
} else {
sort.Slice(attachments, func(i, j int) bool {
return attachments[i].CreatedUnix > attachments[j].CreatedUnix
})
}


page := ctx.QueryInt("page") page := ctx.QueryInt("page")
if page <= 0 { if page <= 0 {


+ 8
- 8
routers/repo/modelarts.go View File

@@ -967,7 +967,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm)
description := form.Description description := form.Description
workServerNumber := form.WorkServerNumber workServerNumber := form.WorkServerNumber
engineID := form.EngineID engineID := form.EngineID
bootFile := form.BootFile
bootFile := strings.TrimSpace(form.BootFile)
flavorCode := form.Flavor flavorCode := form.Flavor
params := form.Params params := form.Params
poolID := form.PoolID poolID := form.PoolID
@@ -1210,7 +1210,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ
description := form.Description description := form.Description
workServerNumber := form.WorkServerNumber workServerNumber := form.WorkServerNumber
engineID := form.EngineID engineID := form.EngineID
bootFile := form.BootFile
bootFile := strings.TrimSpace(form.BootFile)
flavorCode := form.Flavor flavorCode := form.Flavor
params := form.Params params := form.Params
poolID := form.PoolID poolID := form.PoolID
@@ -1284,7 +1284,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ


var parameters models.Parameters var parameters models.Parameters
param := make([]models.Parameter, 0) param := make([]models.Parameter, 0)
existDeviceTarget := true
existDeviceTarget := false
if len(params) != 0 { if len(params) != 0 {
err := json.Unmarshal([]byte(params), &parameters) err := json.Unmarshal([]byte(params), &parameters)
if err != nil { if err != nil {
@@ -1471,8 +1471,8 @@ func obsMkdir(dir string) error {
} }


func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error { func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error {
if !strings.HasSuffix(form.BootFile, ".py") {
log.Error("the boot file(%s) must be a python file", form.BootFile)
if !strings.HasSuffix(strings.TrimSpace(form.BootFile), ".py") {
log.Error("the boot file(%s) must be a python file", strings.TrimSpace(form.BootFile))
return errors.New("启动文件必须是python文件") return errors.New("启动文件必须是python文件")
} }


@@ -1489,8 +1489,8 @@ func paramCheckCreateTrainJob(form auth.CreateModelArtsTrainJobForm) error {
} }


func paramCheckCreateInferenceJob(form auth.CreateModelArtsInferenceJobForm) error { func paramCheckCreateInferenceJob(form auth.CreateModelArtsInferenceJobForm) error {
if !strings.HasSuffix(form.BootFile, ".py") {
log.Error("the boot file(%s) must be a python file", form.BootFile)
if !strings.HasSuffix(strings.TrimSpace(form.BootFile), ".py") {
log.Error("the boot file(%s) must be a python file", strings.TrimSpace(form.BootFile))
return errors.New("启动文件必须是python文件") return errors.New("启动文件必须是python文件")
} }


@@ -1803,7 +1803,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference
description := form.Description description := form.Description
workServerNumber := form.WorkServerNumber workServerNumber := form.WorkServerNumber
engineID := form.EngineID engineID := form.EngineID
bootFile := form.BootFile
bootFile := strings.TrimSpace(form.BootFile)
flavorCode := form.Flavor flavorCode := form.Flavor
params := form.Params params := form.Params
poolID := form.PoolID poolID := form.PoolID


+ 25
- 6
routers/repo/user_data_analysis.go View File

@@ -29,6 +29,7 @@ func getUserMetricsExcelHeader(ctx *context.Context) map[string]string {
excelHeader = append(excelHeader, ctx.Tr("user.metrics.hasactivateuser")) excelHeader = append(excelHeader, ctx.Tr("user.metrics.hasactivateuser"))
excelHeader = append(excelHeader, ctx.Tr("user.metrics.newregistnotactiveuser")) excelHeader = append(excelHeader, ctx.Tr("user.metrics.newregistnotactiveuser"))
excelHeader = append(excelHeader, ctx.Tr("user.metrics.newuseractiveindex")) excelHeader = append(excelHeader, ctx.Tr("user.metrics.newuseractiveindex"))
excelHeader = append(excelHeader, ctx.Tr("user.metrics.currentdayactivity"))
excelHeader = append(excelHeader, ctx.Tr("user.metrics.totalregistuser")) excelHeader = append(excelHeader, ctx.Tr("user.metrics.totalregistuser"))
excelHeader = append(excelHeader, ctx.Tr("user.metrics.totalactiveduser")) excelHeader = append(excelHeader, ctx.Tr("user.metrics.totalactiveduser"))
excelHeader = append(excelHeader, ctx.Tr("user.metrics.totalhasactivityuser")) excelHeader = append(excelHeader, ctx.Tr("user.metrics.totalhasactivityuser"))
@@ -67,6 +68,10 @@ func writeUserMetricsExcel(row int, xlsx *excelize.File, sheetName string, userM
} }
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, value) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, value)
tmp = tmp + 1 tmp = tmp + 1

xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userMetrics.HasActivityUser)
tmp = tmp + 1

xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userMetrics.TotalUser) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userMetrics.TotalUser)
tmp = tmp + 1 tmp = tmp + 1
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userMetrics.TotalActivateRegistUser) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userMetrics.TotalActivateRegistUser)
@@ -106,6 +111,9 @@ func getExcelHeader(ctx *context.Context) map[string]string {
excelHeader = append(excelHeader, ctx.Tr("user.static.CollectedImage")) excelHeader = append(excelHeader, ctx.Tr("user.static.CollectedImage"))
excelHeader = append(excelHeader, ctx.Tr("user.static.RecommendImage")) excelHeader = append(excelHeader, ctx.Tr("user.static.RecommendImage"))


excelHeader = append(excelHeader, ctx.Tr("user.static.email"))
excelHeader = append(excelHeader, ctx.Tr("user.static.location"))

excelHeader = append(excelHeader, ctx.Tr("user.static.registdate")) excelHeader = append(excelHeader, ctx.Tr("user.static.registdate"))
excelHeader = append(excelHeader, ctx.Tr("user.static.countdate")) excelHeader = append(excelHeader, ctx.Tr("user.static.countdate"))


@@ -181,6 +189,13 @@ func writeExcel(row int, xlsx *excelize.File, sheetName string, userRecord *mode
tmp = tmp + 1 tmp = tmp + 1
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.RecommendImage) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.RecommendImage)
tmp = tmp + 1 tmp = tmp + 1

xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Email)
tmp = tmp + 1

xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.UserLocation)
tmp = tmp + 1

formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05") formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05")
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, formatTime[0:len(formatTime)-3]) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, formatTime[0:len(formatTime)-3])
tmp = tmp + 1 tmp = tmp + 1
@@ -249,6 +264,13 @@ func writeExcelPage(row int, xlsx *excelize.File, sheetName string, userRecord *
tmp = tmp + 1 tmp = tmp + 1
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.RecommendImage) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.RecommendImage)
tmp = tmp + 1 tmp = tmp + 1

xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Email)
tmp = tmp + 1

xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.UserLocation)
tmp = tmp + 1

formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05") formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05")
xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, formatTime[0:len(formatTime)-3]) xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, formatTime[0:len(formatTime)-3])
tmp = tmp + 1 tmp = tmp + 1
@@ -414,9 +436,7 @@ func DownloadUserDefineFile(ctx *context.Context) {
log.Info("file not exist.") log.Info("file not exist.")
ctx.JSON(http.StatusOK, "File Not Exist.") ctx.JSON(http.StatusOK, "File Not Exist.")
} else { } else {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+filename)
ctx.Resp.Header().Set("Content-Type", "application/octet-stream")
ctx.ServeFile(allFilename, filename)
ctx.ServeFile(allFilename, url.QueryEscape(filename))
} }
} }


@@ -544,14 +564,13 @@ func QueryUserStaticDataPage(ctx *context.Context) {
endTime = time.Now() endTime = time.Now()
} else { } else {
startTime, _ = time.ParseInLocation("2006-01-02", startDate, time.Local) startTime, _ = time.ParseInLocation("2006-01-02", startDate, time.Local)
startTime = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 12, 0, 0, 0, startTime.Location())
startTime = time.Date(startTime.Year(), startTime.Month(), startTime.Day(), 0, 0, 0, 0, startTime.Location())
settingStartTime, _ := time.Parse("2006-01-02", setting.RadarMap.RecordBeginTime) settingStartTime, _ := time.Parse("2006-01-02", setting.RadarMap.RecordBeginTime)
if startTime.Unix() < settingStartTime.Unix() { if startTime.Unix() < settingStartTime.Unix() {
startTime = settingStartTime startTime = settingStartTime
startDate = settingStartTime.Format("2006-01-02") startDate = settingStartTime.Format("2006-01-02")
} }
endTime, _ = time.ParseInLocation("2006-01-02", endDate, time.Local) 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()) endTime = time.Date(endTime.Year(), endTime.Month(), endTime.Day(), 23, 59, 59, 0, startTime.Location())


isAll = false isAll = false
@@ -582,7 +601,7 @@ func QueryUserStaticDataPage(ctx *context.Context) {
filename := sheetName + "_" + startDate + "_" + endDate + ".xlsx" filename := sheetName + "_" + startDate + "_" + endDate + ".xlsx"
os.Remove(setting.AppDataPath + Excel_File_Path + filename) os.Remove(setting.AppDataPath + Excel_File_Path + filename)
go writeFileToDisk(ctx, count, re, filename) go writeFileToDisk(ctx, count, re, filename)
ctx.JSON(http.StatusOK, setting.AppURL+"api/v1/download_user_define_file?filename="+filename)
ctx.JSON(http.StatusOK, ctx.Tr("user.static.downloadinfo")+setting.AppURL+"api/v1/download_user_define_file?filename="+filename)
} else { } else {
mapInterface := make(map[string]interface{}) mapInterface := make(map[string]interface{})
re, count := models.QueryUserStaticDataPage(pageOpts) re, count := models.QueryUserStaticDataPage(pageOpts)


+ 2
- 2
templates/org/member/members.tmpl View File

@@ -9,14 +9,14 @@
<div class="ui sixteen wide computer column list"> <div class="ui sixteen wide computer column list">
{{ range .Members}} {{ range .Members}}
<div class="item ui grid"> <div class="item ui grid">
<div class="three wide mobile two wide tablet two wide computer column">
<div class="three wide mobile two wide tablet one wide computer column">
<img class="ui avatar" src="{{.SizedRelAvatarLink 48}}"> <img class="ui avatar" src="{{.SizedRelAvatarLink 48}}">
</div> </div>
<div class="seven wide mobile three wide tablet three wide computer column"> <div class="seven wide mobile three wide tablet three wide computer column">
<div class="meta"><a href="{{.HomeLink}}">{{.Name}}</a></div> <div class="meta"><a href="{{.HomeLink}}">{{.Name}}</a></div>
<div class="meta">{{.FullName}}</div> <div class="meta">{{.FullName}}</div>
</div> </div>
<div class="ui four wide column center tablet only computer only">
<div class="ui three wide tablet four wide computer column center tablet only computer only">
<div class="meta"> <div class="meta">
{{$.i18n.Tr "org.members.membership_visibility"}} {{$.i18n.Tr "org.members.membership_visibility"}}
</div> </div>


+ 1
- 1
templates/org/navber.tmpl View File

@@ -48,7 +48,7 @@
</style> </style>


<div class="row"> <div class="row">
<div class="ui secondary tiny pointing borderless menu center aligned grid mbom">
<div class="ui secondary pointing borderless menu center aligned grid mbom">
{{with .Org}} {{with .Org}}
<a class="{{if $.PageIsOrgHome}}active{{end}} item" href="{{.HomeLink}}"> <a class="{{if $.PageIsOrgHome}}active{{end}} item" href="{{.HomeLink}}">
{{svg "octicon-home" 16}}&nbsp;{{$.i18n.Tr "org.home"}} {{svg "octicon-home" 16}}&nbsp;{{$.i18n.Tr "org.home"}}


+ 50
- 51
templates/repo/attachment/upload.tmpl View File

@@ -1,60 +1,58 @@

{{template "base/head" .}} {{template "base/head" .}}
<div class="repository"> <div class="repository">
{{template "repo/header" .}}
{{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<input type="hidden" id="postPath" value="{{.Link}}"> <input type="hidden" id="postPath" value="{{.Link}}">
<div style="width: 80%;margin: auto;"> <div style="width: 80%;margin: auto;">
<h4 class="ui top attached header">
{{$.i18n.Tr "dataset.upload_dataset_file"}}
</h4>
<div class="ui attached segment" style="padding: 2em 3em;">
<div class="ui form" id="dataset-base">
<el-form label-width="140px">
{{.CsrfTokenHtml}}
<el-form-item label='{{$.i18n.Tr "dataset.dataset_available_clusters"}}:' prop="title">
<el-button :class="{active:type==0}" :disabled="clusterFlag" size="small" style="margin: 0;border-radius: 0.28571429rem 0 0 0.28571429rem;" @click="uploadGpu">CPU/GPU</el-button>
<el-button :class="{active:type==1}" :disabled="clusterFlag" size="small" style="margin: 0 0 0 -4px;border-radius: 0 0.28571429rem 0.28571429rem 0;" @click="uploadNpu">NPU</el-button>
</el-form-item>
<el-form-item label='{{$.i18n.Tr "dataset.file_description"}}:' prop="description">
<el-input type="textarea" :rows="3" maxlength="255" placeholder="{{$.i18n.Tr "repo.modelarts.train_job.new_place"}}" v-model="desc"></el-input>
</el-form-item>
<el-form-item label='{{$.i18n.Tr "dataset.data_upload"}}:' prop="category">
<h4 class="ui top attached header">
{{$.i18n.Tr "dataset.upload_dataset_file"}}
</h4>
<div class="ui attached segment" style="padding: 2em 3em;">
<div class="ui form" id="dataset-base">
<el-form label-width="140px">
{{.CsrfTokenHtml}}
<el-form-item label='{{$.i18n.Tr "dataset.dataset_available_clusters"}}:' prop="title">
<el-button :class="{active:type==0}" :disabled="clusterFlag" size="small"
style="margin: 0;border-radius: 0.28571429rem 0 0 0.28571429rem;" @click="uploadGpu">
CPU/GPU</el-button>
<el-button :class="{active:type==1}" :disabled="clusterFlag" size="small"
style="margin: 0 0 0 -4px;border-radius: 0 0.28571429rem 0.28571429rem 0;"
@click="uploadNpu">NPU</el-button>
</el-form-item>
<el-form-item label='{{$.i18n.Tr "dataset.file_description"}}:' prop="description">
<el-input type="textarea" :rows="3" maxlength="255"
placeholder="{{$.i18n.Tr "repo.modelarts.train_job.new_place"}}" v-model="desc">
</el-input>
</el-form-item>
<el-form-item label='{{$.i18n.Tr "dataset.data_upload"}}:' prop="category">
<minio-uploader :uploadtype="type" :desc="desc" @setcluster="setcluster"></minio-uploader> <minio-uploader :uploadtype="type" :desc="desc" @setcluster="setcluster"></minio-uploader>
</el-form-item>
<div style='display:none;'
id="minioUploader-params"
data-uuid="{{.uuid}}"
data-add-url="{{.Repository.OwnerName}}/attachments/add"
data-accepts="{{.AttachmentAllowedTypes}}"
data-remove-url="{{AppSubUrl}}/attachments/delete"
data-csrf="{{.CsrfToken}}"
dataset-id={{.dataset.ID}}
data-max-file="100"
data-dataset-id="{{.dataset.ID}}"
data-max-size="{{.AttachmentMaxSize}}"
data-default-message="{{.i18n.Tr "dropzone.default_message"}}"
data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}"
data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}"
data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"
data-file-status='{{.i18n.Tr "dropzone.file_status"}}'
data-file-init-status='{{.i18n.Tr "dropzone.file_init_status"}}'
data-waitting-uploading='{{.i18n.Tr "dropzone.waitting_uploading"}}'
data-md5-computing='{{.i18n.Tr "dropzone.md5_computing"}}'
data-obs-connecting='{{.i18n.Tr "dropzone.obs-connecting"}}'
data-loading-file='{{.i18n.Tr "dropzone.loading_file"}}'
data-upload-complete='{{.i18n.Tr "dropzone.upload_complete"}}'
data-uploading='{{.i18n.Tr "dropzone.uploading"}}'
data-failed='{{.i18n.Tr "dropzone.failed"}}'
data-repopath='{{AppSubUrl}}{{$.RepoLink}}/datasets'
data-cancel='{{.i18n.Tr "cancel"}}'
data-upload='{{.i18n.Tr "dataset.dataset_upload"}}'
>
</el-form-item>
<div style='display:none;' id="minioUploader-params" data-uuid="{{.uuid}}"
data-add-url="{{.Repository.OwnerName}}/attachments/add"
data-accepts="{{.AttachmentAllowedTypes}}"
data-remove-url="{{AppSubUrl}}/attachments/delete" data-csrf="{{.CsrfToken}}"
dataset-id={{.dataset.ID}} data-max-file="100" data-dataset-id="{{.dataset.ID}}"
data-max-size="{{.AttachmentMaxSize}}"
data-default-message="{{.i18n.Tr "dropzone.default_dataset_message"}}"
data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}"
data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}"
data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"
data-file-status='{{.i18n.Tr "dropzone.file_status"}}'
data-file-init-status='{{.i18n.Tr "dropzone.file_init_status"}}'
data-waitting-uploading='{{.i18n.Tr "dropzone.waitting_uploading"}}'
data-md5-computing='{{.i18n.Tr "dropzone.md5_computing"}}'
data-obs-connecting='{{.i18n.Tr "dropzone.obs-connecting"}}'
data-loading-file='{{.i18n.Tr "dropzone.loading_file"}}'
data-upload-complete='{{.i18n.Tr "dropzone.upload_complete"}}'
data-uploading='{{.i18n.Tr "dropzone.uploading"}}'
data-failed='{{.i18n.Tr "dropzone.failed"}}'
data-repopath='{{AppSubUrl}}{{$.RepoLink}}/datasets' data-cancel='{{.i18n.Tr "cancel"}}'
data-upload='{{.i18n.Tr "dataset.dataset_upload"}}'>
</div> </div>
<div id="datasetId" datasetId="{{.datasetId}}"></div> <div id="datasetId" datasetId="{{.datasetId}}"></div>
</el-form>
</div>
</div>
</el-form>
</div>
</div>
</div> </div>
<div style="width: 80%;margin: auto;padding-top: 2em;"> <div style="width: 80%;margin: auto;padding-top: 2em;">
<!-- <p>说明:<br> <!-- <p>说明:<br>
@@ -62,10 +60,11 @@
- 云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。 - 云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。
</p> --> </p> -->
<p style="color: 505559;">{{$.i18n.Tr "dataset.illustrate"}}:</p> <p style="color: 505559;">{{$.i18n.Tr "dataset.illustrate"}}:</p>
<p style="line-height: 1.5;color: #101010;">{{$.i18n.Tr "dataset.illustrate.only"}}<span class="text red">&nbsp;{{$.i18n.Tr "dataset.illustrate.zip"}}&nbsp;</span>{{$.i18n.Tr "dataset.illustrate.fisrt_end"}};</br>
<p style="line-height: 1.5;color: #101010;">{{$.i18n.Tr "dataset.illustrate.only"}}<span
class="text red">&nbsp;{{$.i18n.Tr "dataset.illustrate.zip"}}&nbsp;</span>{{$.i18n.Tr "dataset.illustrate.fisrt_end"}};</br>
{{$.i18n.Tr "dataset.dataset_explain"}}</p> {{$.i18n.Tr "dataset.dataset_explain"}}</p>


</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}}
{{template "base/footer" .}}

+ 22
- 4
templates/repo/datasets/index.tmpl View File

@@ -7,6 +7,8 @@
background: #FFF !important; background: #FFF !important;
} }




.dataset_title { .dataset_title {
font-size: 14px; font-size: 14px;
max-width: 80%; max-width: 80%;
@@ -211,11 +213,22 @@
<div class="ui grid stackable" style="background: #f0f0f0;;"> <div class="ui grid stackable" style="background: #f0f0f0;;">
<div class="row"> <div class="row">
<!-- 数据集名称 --> <!-- 数据集名称 -->
<div class="four wide column" style="width: 24% !important;">
<span style="margin:0 6px">{{$.i18n.Tr "dataset.dataset_file_name"}}</span>
<div class="four wide column name_sort" @click="sortAble('name')" style="width: 24% !important;">
{{$.i18n.Tr "dataset.dataset_file_name"}}
<span class="caret-wrapper">
<i class='ri-arrow-up-s-fill sort-caret-up {{if eq .SortType "nameAsc"}} active-sort {{end}}'></i>
<i
class='ri-arrow-down-s-fill sort-caret-down {{if eq .SortType "nameDesc"}} active-sort {{end}}'></i>
</span>
</div> </div>
<div class="one wide column text center" style="width: 7.25% !important;">
<div class="one wide column text center size_sort" @click="sortAble('size')"
style="width: 7.25% !important;">
{{$.i18n.Tr "repo.model.manage.size"}} {{$.i18n.Tr "repo.model.manage.size"}}
<span class="caret-wrapper">
<i class='ri-arrow-up-s-fill sort-caret-up {{if eq .SortType "sizeAsc"}} active-sort {{end}}'></i>
<i
class='ri-arrow-down-s-fill sort-caret-down {{if eq .SortType "sizeDesc"}} active-sort {{end}}'></i>
</span>
</div> </div>
<div class="two wide column text center"> <div class="two wide column text center">
{{$.i18n.Tr "dataset.dataset_available_clusters"}} {{$.i18n.Tr "dataset.dataset_available_clusters"}}
@@ -226,8 +239,13 @@
<div class="one wide column text center"> <div class="one wide column text center">
{{$.i18n.Tr "repo.cloudbrain_creator"}} {{$.i18n.Tr "repo.cloudbrain_creator"}}
</div> </div>
<div class="three wide column text center">
<div class="three wide column text center" @click="sortAble('time')">
{{$.i18n.Tr "dataset.dataset_upload_time"}} {{$.i18n.Tr "dataset.dataset_upload_time"}}
<span class="caret-wrapper">
<i class='ri-arrow-up-s-fill sort-caret-up {{if eq .SortType "timeAsc"}} active-sort {{end}}'></i>
<i
class='ri-arrow-down-s-fill sort-caret-down {{if eq .SortType "timeDesc"}} active-sort {{end}}'></i>
</span>
</div> </div>
<div class="four wide column text center"> <div class="four wide column text center">
{{$.i18n.Tr "repo.cloudbrain_operate"}} {{$.i18n.Tr "repo.cloudbrain_operate"}}


+ 8
- 1
templates/user/dashboard/repolist.tmpl View File

@@ -162,5 +162,12 @@
</div> </div>
</div> </div>
</div> </div>
</repo-search>
</repo-search>

<div class="ui hidden divider"></div>
<div>
<a href="https://openi.org.cn/index.php?m=content&amp;c=index&amp;a=show&amp;catid=202&amp;id=221" target="_blank">
<img src="https://openi.org.cn/uploadfile/2022/0427/c45291e24e30f54.jpg" class="ui fluid image" alt="">
</a>
</div>
</div> </div>

+ 13
- 1
web_src/js/components/UserAnalysis.vue View File

@@ -213,6 +213,18 @@
label="被推荐镜像数" label="被推荐镜像数"
width="120px" width="120px"
align="center"> align="center">
</el-table-column>
<el-table-column
prop="Email"
label="Email"
width="120px"
align="center">
</el-table-column>
<el-table-column
prop="UserLocation"
label="用户所在地址"
width="120px"
align="center">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="RegistDate" prop="RegistDate"
@@ -267,7 +279,7 @@
value_time: '', value_time: '',
search:'', search:'',
data:'', data:'',
columns: [{title: 'ID',key: 'ID'},{title: '用户名',key: 'Name'},{title: 'PR数',key: 'CodeMergeCount'},{title: 'commit数',key:'CommitCount'},{title: '提出任务数',key: 'IssueCount'},{title: '评论数',key: 'CommentCount'},{title: '关注项目数',key: 'FocusRepoCount'},{title: '点赞项目数',key: 'StarRepoCount'},{title: '登录次数',key: 'LoginCount'},{title:'关注者数',key:'WatchedCount'},{title:'commit代码行数',key:'CommitCodeSize'},{title:'已解决任务数',key:'SolveIssueCount'},{title:'百科页面贡献次数',key:'EncyclopediasCount'},{title:'创建项目',key:'CreateRepoCount'},{title:'用户注册时间',key:'RegistDate'},{title:'云脑任务数',key:'CloudBrainTaskNum'},{title:'云脑运行时间(小时)',key:'CloudBrainRunTime'},{title:'上传(提交)数据集文件数',key:'CommitDatasetNum'},{title:'提交模型数',key:'CommitModelCount'},{title:'归一化用户指数',key:'UserIndex'},{title:'用户指数',key:'UserIndexPrimitive'},{title:'关注他人数',key:'FocusOtherUser'},{title:'收藏数据集',key:'CollectDataset'},{title:'被收藏数据集',key:'CollectedDataset'},{title:'被推荐数据集数',key:'RecommendDataset'},{title:'收藏镜像数',key:'CollectImage'},{title:'被收藏镜像数',key:'CollectedImage'},{title:'被推荐镜像数',key:'RecommendImage'},{title:'系统统计时间',key:'CountDate'}],
columns: [{title: 'ID',key: 'ID'},{title: '用户名',key: 'Name'},{title: 'PR数',key: 'CodeMergeCount'},{title: 'commit数',key:'CommitCount'},{title: '提出任务数',key: 'IssueCount'},{title: '评论数',key: 'CommentCount'},{title: '关注项目数',key: 'FocusRepoCount'},{title: '点赞项目数',key: 'StarRepoCount'},{title: '登录次数',key: 'LoginCount'},{title:'关注者数',key:'WatchedCount'},{title:'commit代码行数',key:'CommitCodeSize'},{title:'已解决任务数',key:'SolveIssueCount'},{title:'百科页面贡献次数',key:'EncyclopediasCount'},{title:'创建项目',key:'CreateRepoCount'},{title:'用户注册时间',key:'RegistDate'},{title:'云脑任务数',key:'CloudBrainTaskNum'},{title:'云脑运行时间(小时)',key:'CloudBrainRunTime'},{title:'上传(提交)数据集文件数',key:'CommitDatasetNum'},{title:'提交模型数',key:'CommitModelCount'},{title:'归一化用户指数',key:'UserIndex'},{title:'用户指数',key:'UserIndexPrimitive'},{title:'关注他人数',key:'FocusOtherUser'},{title:'收藏数据集',key:'CollectDataset'},{title:'被收藏数据集',key:'CollectedDataset'},{title:'被推荐数据集数',key:'RecommendDataset'},{title:'收藏镜像数',key:'CollectImage'},{title:'被收藏镜像数',key:'CollectedImage'},{title:'被推荐镜像数',key:'RecommendImage'},{title:'Email',key:'Email'},{title:'用户所在地址',key:'UserLocation'},{title:'系统统计时间',key:'CountDate'}],
blob:'', blob:'',
fileName:'', fileName:'',
dynamic:7, dynamic:7,


+ 8
- 3
web_src/js/components/UserTrend.vue View File

@@ -13,7 +13,7 @@
<span class="yesterday_blk yesterday_title" >昨日新增注册用户数 </span> <span class="yesterday_blk yesterday_title" >昨日新增注册用户数 </span>
<span class="yesterday_blk yesterday_color1 yesterday_pdrt yesterday_text">未激活:<span class="bold_num">{{ tableDataYesterday.NotActivateRegistUser }}</span> 人 </span> <span class="yesterday_blk yesterday_color1 yesterday_pdrt yesterday_text">未激活:<span class="bold_num">{{ tableDataYesterday.NotActivateRegistUser }}</span> 人 </span>
<span class="yesterday_blk yesterday_color2 yesterday_pdrt yesterday_text">已激活: <span class="bold_num">{{ tableDataYesterday.ActivateRegistUser }} </span>人</span> <span class="yesterday_blk yesterday_color2 yesterday_pdrt yesterday_text">已激活: <span class="bold_num">{{ tableDataYesterday.ActivateRegistUser }} </span>人</span>
<span class="yesterday_blk yesterday_pdrt yesterday_text">有贡献活动: <span class="bold_num">{{ tableDataYesterday.HasActivityUser }} </span>人</span>
<span class="yesterday_blk yesterday_pdrt yesterday_text">有贡献活动: <span class="bold_num">{{ tableDataYesterday.RegistActivityUser }} </span>人</span>
</el-col> </el-col>
@@ -114,7 +114,7 @@
align="center"> align="center">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="HasActivityUser"
prop="RegistActivityUser"
label="新增有贡献活动" label="新增有贡献活动"
align="center"> align="center">
</el-table-column> </el-table-column>
@@ -131,6 +131,11 @@
{{scope.row.ActivateIndex | rounding}} {{scope.row.ActivateIndex | rounding}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
prop="HasActivityUser"
label="当日有贡献活动"
align="center">
</el-table-column>
<el-table-column <el-table-column
prop="TotalUser" prop="TotalUser"
label="累计注册用户" label="累计注册用户"
@@ -517,7 +522,7 @@
xdata.push(this.tableData[this.tableData.length-1-i].DisplayDate); xdata.push(this.tableData[this.tableData.length-1-i].DisplayDate);
ydata_TotalRegistUser.push(this.tableData[this.tableData.length-1-i].TotalRegistUser) ydata_TotalRegistUser.push(this.tableData[this.tableData.length-1-i].TotalRegistUser)
ydata_ActivateRegistUser.push(this.tableData[this.tableData.length-1-i].ActivateRegistUser) ydata_ActivateRegistUser.push(this.tableData[this.tableData.length-1-i].ActivateRegistUser)
ydata_RegistActivityUser.push(this.tableData[this.tableData.length-1-i].HasActivityUser)
ydata_RegistActivityUser.push(this.tableData[this.tableData.length-1-i].RegistActivityUser)
ydata_NotActivateRegistUser.push(this.tableData[this.tableData.length-1-i].NotActivateRegistUser) ydata_NotActivateRegistUser.push(this.tableData[this.tableData.length-1-i].NotActivateRegistUser)
ydata_TotalUser.push(this.tableData[this.tableData.length-1-i].TotalUser) ydata_TotalUser.push(this.tableData[this.tableData.length-1-i].TotalUser)
ydata_TotalActivateRegistUser.push(this.tableData[this.tableData.length-1-i].TotalActivateRegistUser) ydata_TotalActivateRegistUser.push(this.tableData[this.tableData.length-1-i].TotalActivateRegistUser)


+ 21
- 14
web_src/js/index.js View File

@@ -1225,10 +1225,7 @@ async function initRepository() {
const $content = $segment.parent(); const $content = $segment.parent();
if (!$content.find('.ui.small.images').length) { if (!$content.find('.ui.small.images').length) {
if (data.attachments !== '') { if (data.attachments !== '') {
$content.append(
'<div class="ui bottom attached segment"><div class="ui small images"></div></div>'
);
$content.find('.ui.small.images').html(data.attachments);

} }
} else if (data.attachments === '') { } else if (data.attachments === '') {
$content $content
@@ -3923,19 +3920,10 @@ function initVueDataset() {
MinioUploader MinioUploader
}, },
mounted() { mounted() {
// if(document.getElementById('postPath')){
// this.url = document.getElementById('postPath').value
// }
// this.privates = items
// this.num_stars = num_stars
// this.star_active = star_active
// this.ruleForm1 = ruleForm

// // this.getEditInit()
// this.getTypeList()
this.getTypeList() this.getTypeList()


if (!!document.getElementById('dataset-repolink-init')) { if (!!document.getElementById('dataset-repolink-init')) {
this.cloudbrainType = location.href.indexOf('cloudbrain') !== -1 ? 0 : 1
this.getCurrentRepoDataset(this.repolink, this.cloudbrainType) this.getCurrentRepoDataset(this.repolink, this.cloudbrainType)
} }


@@ -4083,6 +4071,25 @@ function initVueDataset() {
uploadNpu() { uploadNpu() {
this.type = 1 this.type = 1
}, },
sortAble(dom) {
const params = new URLSearchParams(location.search)
if (params.toString() === '') {
location.href = `${location.href}?sort=${dom}Asc`
}
else if (!params.get('sort')) {
location.href = `${location.href}&sort=${dom}Asc`
}
else if (params.get('sort') === `${dom}Desc` || params.get('sort').indexOf(`${dom}`) === -1) {
params.delete('sort')
let asc = params.toString() + `&sort=${dom}Asc`
location.search = asc
}
else {
params.delete('sort')
let desc = params.toString() + `&sort=${dom}Desc`
location.search = desc
}
},
setPrivate(uuid, privateFlag, index) { setPrivate(uuid, privateFlag, index) {
const params = { _csrf: csrf, file: uuid, is_private: privateFlag } const params = { _csrf: csrf, file: uuid, is_private: privateFlag }
this.$axios.post('/attachments/private', this.qs.stringify(params)).then((res) => { this.$axios.post('/attachments/private', this.qs.stringify(params)).then((res) => {


+ 41
- 3
web_src/less/openi.less View File

@@ -82,9 +82,14 @@ footer {
} }
/*PC*/ /*PC*/
@media only screen and (min-width: 1200px){ @media only screen and (min-width: 1200px){
.following.bar #navbar, footer .container {
padding: 0;
.following.bar #navbar, footer .container {
padding: 0;
}
} }
@media only screen and (min-width: 1600px){
.ui.ui.ui.container:not(.fluid) {
width: 1200px;
}
} }


/*start page*/ /*start page*/
@@ -655,7 +660,10 @@ display: block;
} }


/*pages*/ /*pages*/
.ui.borderless.pagination {border:none}
.ui.borderless.pagination {
border:none;
margin-top: .5rem;
}
.ui.pagination.menu .item { .ui.pagination.menu .item {
min-width: 32px; min-width: 32px;
text-align: center; text-align: center;
@@ -1055,3 +1063,33 @@ display: block;
float: left !important; float: left !important;
margin: 0px 5px 0px 0px !important; margin: 0px 5px 0px 0px !important;
} }


.row .caret-wrapper {
display: inline-flex;
flex-direction: column;
align-items: center;
height: 34px;
width: 24px;
vertical-align: middle;
cursor: pointer;
position: relative;
}

.row .sort-caret-up {
position: absolute;
top: 5px;
color: #c0c4cc;
font-size: 18px;
}

.row .sort-caret-down {
position: absolute;
bottom: 3px;
color: #c0c4cc;
font-size: 18px;
}

.row .active-sort {
color: #409eff !important;
}

Loading…
Cancel
Save