code refactor
This commit is contained in:
parent
f3962266b4
commit
7f4dd8859e
|
@ -245,14 +245,20 @@ func resourceBindNode(c *gin.Context) {
|
||||||
var err error
|
var err error
|
||||||
if f.Field == "uuid" {
|
if f.Field == "uuid" {
|
||||||
ids, err = models.ResourceIdsByUUIDs(f.Items)
|
ids, err = models.ResourceIdsByUUIDs(f.Items)
|
||||||
|
dangerous(err)
|
||||||
|
if len(ids) == 0 {
|
||||||
|
bomb("resources not found by uuid")
|
||||||
|
}
|
||||||
} else if f.Field == "ident" {
|
} else if f.Field == "ident" {
|
||||||
ids, err = models.ResourceIdsByIdents(f.Items)
|
ids, err = models.ResourceIdsByIdents(f.Items)
|
||||||
|
dangerous(err)
|
||||||
|
if len(ids) == 0 {
|
||||||
|
bomb("resources not found by ident")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bomb("field[%s] not supported", f.Field)
|
bomb("field[%s] not supported", f.Field)
|
||||||
}
|
}
|
||||||
|
|
||||||
dangerous(err)
|
|
||||||
|
|
||||||
loginUser(c).CheckPermByNode(node, "rdb_resource_bind")
|
loginUser(c).CheckPermByNode(node, "rdb_resource_bind")
|
||||||
|
|
||||||
renderMessage(c, node.Bind(ids))
|
renderMessage(c, node.Bind(ids))
|
||||||
|
|
Loading…
Reference in New Issue