| @@ -336,6 +336,11 @@ func CloudBrainRestart(ctx *context.Context) { | |||||
| } | } | ||||
| func CloudBrainBenchMarkShow(ctx *context.Context) { | func CloudBrainBenchMarkShow(ctx *context.Context) { | ||||
| if benchmarkTypes == nil { | |||||
| if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { | |||||
| log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"]) | |||||
| } | |||||
| } | |||||
| cloudBrainShow(ctx, tplCloudBrainBenchmarkShow) | cloudBrainShow(ctx, tplCloudBrainBenchmarkShow) | ||||
| } | } | ||||
| @@ -400,7 +405,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { | |||||
| } else { | } else { | ||||
| duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) | duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) | ||||
| } | } | ||||
| if benchmarkTypes.BenchmarkType != nil { | |||||
| if benchmarkTypes != nil { | |||||
| for _, benchmarkType := range benchmarkTypes.BenchmarkType { | for _, benchmarkType := range benchmarkTypes.BenchmarkType { | ||||
| if task.BenchmarkTypeID == benchmarkType.Id { | if task.BenchmarkTypeID == benchmarkType.Id { | ||||
| ctx.Data["BenchmarkTypeName"] = benchmarkType.First | ctx.Data["BenchmarkTypeName"] = benchmarkType.First | ||||