|
|
@@ -280,21 +280,12 @@ func GetAllCloudbrainsTrend(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
func GetAllCloudbrainsTrendDetail(ctx *context.Context) { |
|
|
|
// brainRecordBeginTime, err := getBrainRecordBeginTime() |
|
|
|
// if err != nil { |
|
|
|
// log.Error("Can not get brain record begin time", err) |
|
|
|
// ctx.Error(http.StatusBadRequest, ctx.Tr("repo.brain_record_begintime_get_err")) |
|
|
|
// return |
|
|
|
// } |
|
|
|
// queryType := ctx.QueryTrim("type") |
|
|
|
now := time.Now() |
|
|
|
var beginTime time.Time |
|
|
|
var endTime time.Time |
|
|
|
var endTimeTemp time.Time |
|
|
|
// dateCloudbrainNum := make([]DateCloudbrainNum, 0) |
|
|
|
|
|
|
|
beginTime = now.AddDate(0, 0, -30) // |
|
|
|
// beginTime = brainRecordBeginTime |
|
|
|
beginTime = now.AddDate(0, 0, -30) |
|
|
|
beginTime = time.Date(beginTime.Year(), beginTime.Month(), beginTime.Day(), 0, 0, 0, 0, now.Location()) |
|
|
|
endTime = now |
|
|
|
endTimeTemp = endTime.AddDate(0, 0, -1) |
|
|
@@ -313,16 +304,9 @@ func GetAllCloudbrainsTrendDetail(ctx *context.Context) { |
|
|
|
if pagesize <= 0 { |
|
|
|
pagesize = 5 |
|
|
|
} |
|
|
|
// pager := context.NewPagination(len(dateCloudbrainNum), pagesize, page, 5) |
|
|
|
|
|
|
|
pageDateCloudbrainNum := getPageDateCloudbrainNum(dayCloudbrainInfo, page, pagesize) |
|
|
|
|
|
|
|
//load attachment creator |
|
|
|
// for _, attachment := range pageAttachments { |
|
|
|
// uploader, _ := models.GetUserByID(attachment.UploaderID) |
|
|
|
// attachment.Uploader = uploader |
|
|
|
// } |
|
|
|
|
|
|
|
cloudbrainsPeriodData := TimeCloudbrainsNum{ |
|
|
|
TotalCount: 30, |
|
|
|
TimeCloudbrainNum: pageDateCloudbrainNum, |
|
|
@@ -465,16 +449,15 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
listType := ctx.Query("listType") |
|
|
|
jobType := ctx.Query("jobType") |
|
|
|
jobStatus := ctx.Query("jobStatus") |
|
|
|
cloudBrainType := ctx.QueryInt("Type") |
|
|
|
|
|
|
|
page := ctx.QueryInt("page") |
|
|
|
pageSize := ctx.QueryInt("pageSize") |
|
|
|
if page <= 0 { |
|
|
|
page = 1 |
|
|
|
} |
|
|
|
debugType := models.TypeCloudBrainAll |
|
|
|
if listType == models.GPUResource { |
|
|
|
debugType = models.TypeCloudBrainOne |
|
|
|
} else if listType == models.NPUResource { |
|
|
|
debugType = models.TypeCloudBrainTwo |
|
|
|
if pageSize <= 0 { |
|
|
|
pageSize = 10 |
|
|
|
} |
|
|
|
|
|
|
|
var jobTypes []string |
|
|
@@ -501,10 +484,11 @@ func GetCloudbrainsDetailData(ctx *context.Context) { |
|
|
|
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ |
|
|
|
ListOptions: models.ListOptions{ |
|
|
|
Page: page, |
|
|
|
PageSize: setting.UI.IssuePagingNum, |
|
|
|
PageSize: pageSize, |
|
|
|
}, |
|
|
|
Keyword: keyword, |
|
|
|
Type: debugType, |
|
|
|
Type: cloudBrainType, |
|
|
|
ComputeResource: listType, |
|
|
|
JobTypeNot: jobTypeNot, |
|
|
|
JobStatusNot: jobStatusNot, |
|
|
|
JobStatus: jobStatuses, |
|
|
|