mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
treewide: make explicit calls to JSONDict.Remove() and JSONDict.RemoveIgnoreCase
This commit is contained in:
@@ -665,7 +665,7 @@ func doCreateItem(manager IModelManager, ctx context.Context, userCred mcclient.
|
||||
|
||||
generateName, _ := dataDict.GetString("generate_name")
|
||||
if len(generateName) > 0 {
|
||||
dataDict.Remove("generate_name", true)
|
||||
dataDict.Remove("generate_name")
|
||||
dataDict.Add(jsonutils.NewString(GenerateName(manager, ownerProjId, generateName)), "name")
|
||||
} else {
|
||||
name, _ := data.GetString("name")
|
||||
@@ -756,7 +756,7 @@ func expandMultiCreateParams(data jsonutils.JSONObject, count int) ([]jsonutils.
|
||||
return nil, httperrors.NewInputParameterError("Missing name or generate_name")
|
||||
}
|
||||
jsonDict.Add(jsonutils.NewString(name), "generate_name")
|
||||
jsonDict.Remove("name", false)
|
||||
jsonDict.RemoveIgnoreCase("name")
|
||||
}
|
||||
ret := make([]jsonutils.JSONObject, count)
|
||||
for i := 0; i < count; i += 1 {
|
||||
|
||||
@@ -270,17 +270,17 @@ func (manager *SOpsLogManager) ListItemFilter(ctx context.Context, q *sqlchemy.S
|
||||
}
|
||||
objTypes := jsonutils.GetQueryStringArray(queryDict, "obj_type")
|
||||
if objTypes != nil && len(objTypes) > 0 {
|
||||
queryDict.Remove("obj_type", false)
|
||||
queryDict.RemoveIgnoreCase("obj_type")
|
||||
q = q.Filter(sqlchemy.In(q.Field("obj_type"), objTypes))
|
||||
}
|
||||
objIds := jsonutils.GetQueryStringArray(queryDict, "obj_id")
|
||||
if objIds != nil && len(objIds) > 0 {
|
||||
queryDict.Remove("obj_id", false)
|
||||
queryDict.RemoveIgnoreCase("obj_id")
|
||||
q = q.Filter(sqlchemy.OR(sqlchemy.In(q.Field("obj_id"), objIds), sqlchemy.In(q.Field("obj_name"), objIds)))
|
||||
}
|
||||
action := jsonutils.GetQueryStringArray(queryDict, "action")
|
||||
if action != nil && len(action) > 0 {
|
||||
queryDict.Remove("action", false)
|
||||
queryDict.RemoveIgnoreCase("action")
|
||||
q = q.Filter(sqlchemy.In(q.Field("action"), action))
|
||||
}
|
||||
if !userCred.IsSystemAdmin() {
|
||||
|
||||
@@ -196,7 +196,7 @@ func (manager *SGuestManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQ
|
||||
isBMstr, _ := queryDict.GetString("baremetal")
|
||||
if len(isBMstr) > 0 && utils.ToBool(isBMstr) {
|
||||
queryDict.Add(jsonutils.NewString(HYPERVISOR_BAREMETAL), "hypervisor")
|
||||
queryDict.Remove("baremetal", true)
|
||||
queryDict.Remove("baremetal")
|
||||
}
|
||||
hypervisor, _ := queryDict.GetString("hypervisor")
|
||||
if len(hypervisor) > 0 {
|
||||
|
||||
@@ -119,7 +119,7 @@ func (this *ImageManager) List(session *mcclient.ClientSession, params jsonutils
|
||||
path = fmt.Sprintf("%s/detail", path)
|
||||
}
|
||||
dictparams, _ := params.(*jsonutils.JSONDict)
|
||||
dictparams.Remove("details", false)
|
||||
dictparams.RemoveIgnoreCase("details")
|
||||
qs := params.QueryString()
|
||||
if len(qs) > 0 {
|
||||
path = fmt.Sprintf("%s?%s", path, qs)
|
||||
|
||||
@@ -20,8 +20,8 @@ func (this *UsageManager) GetGeneralUsage(session *mcclient.ClientSession, param
|
||||
url = fmt.Sprintf("%s/%s/%s", url, range_type, range_id)
|
||||
}
|
||||
dict := params.(*jsonutils.JSONDict)
|
||||
dict.Remove("range_type", true)
|
||||
dict.Remove("range_id", true)
|
||||
dict.Remove("range_type")
|
||||
dict.Remove("range_id")
|
||||
qs := dict.QueryString()
|
||||
if len(qs) > 0 {
|
||||
url = fmt.Sprintf("%s?%s", url, qs)
|
||||
|
||||
Reference in New Issue
Block a user