|
|
@@ -472,16 +472,28 @@ func ModifyModel(id string, description string) error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func ModifyModelInfo(ctx *context.Context) { |
|
|
func ModifyModelInfo(ctx *context.Context) { |
|
|
log.Info("delete model start.") |
|
|
|
|
|
|
|
|
log.Info("modify model start.") |
|
|
id := ctx.Query("ID") |
|
|
id := ctx.Query("ID") |
|
|
description := ctx.Query("Description") |
|
|
description := ctx.Query("Description") |
|
|
|
|
|
|
|
|
err := ModifyModel(id, description) |
|
|
|
|
|
|
|
|
task, err := models.QueryModelById(id) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Error("no such model!", err.Error()) |
|
|
|
|
|
ctx.ServerError("no such model:", err) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if !isCanDeleteOrDownload(ctx, task) { |
|
|
|
|
|
ctx.ServerError("no right.", errors.New(ctx.Tr("repo.model_noright"))) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err = ModifyModel(id, description) |
|
|
|
|
|
|
|
|
if err == nil { |
|
|
|
|
|
ctx.HTML(200, "success") |
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
log.Info("modify error," + err.Error()) |
|
|
|
|
|
ctx.ServerError("error.", err) |
|
|
} else { |
|
|
} else { |
|
|
ctx.HTML(500, "Failed.") |
|
|
|
|
|
|
|
|
ctx.JSON(200, "success") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |