|
|
|
@@ -1030,8 +1030,35 @@ func CloudBrainBenchmarkNew(ctx *context.Context) { |
|
|
|
ctx.HTML(200, tplCloudBrainBenchmarkNew) |
|
|
|
} |
|
|
|
|
|
|
|
func getBenchmarkAttachment() error { |
|
|
|
return nil |
|
|
|
func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int) (string, error) { |
|
|
|
uuid := "" |
|
|
|
if benchmarkTypes == nil { |
|
|
|
if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { |
|
|
|
log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err) |
|
|
|
return uuid, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var isExist bool |
|
|
|
for id, benchmarkType := range benchmarkTypes.BenchmarkType { |
|
|
|
if id == benchmarkTypeID { |
|
|
|
for childID, childType := range benchmarkType.Second { |
|
|
|
if childID == benchmarkChildTypeID { |
|
|
|
uuid = childType.Attachment |
|
|
|
isExist = true |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if !isExist { |
|
|
|
log.Error("no such benchmark_type_id&benchmark_child_type_id") |
|
|
|
return uuid, errors.New("no such benchmark_type_id&benchmark_child_type_id") |
|
|
|
} |
|
|
|
|
|
|
|
return uuid, nil |
|
|
|
} |
|
|
|
|
|
|
|
func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { |
|
|
|
|