mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #5387 from swordqiu/hotfix/qj-service-filter-by-type
fix: add keystone service type filter
This commit is contained in:
@@ -43,10 +43,10 @@ func init() {
|
||||
query.Add(jsonutils.NewInt(args.Offset), "offset")
|
||||
}
|
||||
if len(args.Name) > 0 {
|
||||
query.Add(jsonutils.NewString(args.Name), "name__icontains")
|
||||
query.Add(jsonutils.NewString(args.Name), "name")
|
||||
}
|
||||
if len(args.Type) > 0 {
|
||||
query.Add(jsonutils.NewString(args.Type), "type__icontains")
|
||||
query.Add(jsonutils.NewString(args.Type), "type")
|
||||
}
|
||||
if len(args.Search) > 0 {
|
||||
query.Add(jsonutils.NewString(args.Search), "search")
|
||||
|
||||
@@ -249,4 +249,7 @@ type RegionListInput struct {
|
||||
|
||||
type ServiceListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
// 以Service Type过滤
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
@@ -226,12 +226,15 @@ func (manager *SServiceManager) ListItemFilter(
|
||||
ctx context.Context,
|
||||
q *sqlchemy.SQuery,
|
||||
userCred mcclient.TokenCredential,
|
||||
query api.RegionListInput,
|
||||
query api.ServiceListInput,
|
||||
) (*sqlchemy.SQuery, error) {
|
||||
q, err := manager.SStandaloneResourceBaseManager.ListItemFilter(ctx, q, userCred, query.StandaloneResourceListInput)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "SStandaloneResourceBaseManager.ListItemFilter")
|
||||
}
|
||||
if len(query.Type) > 0 {
|
||||
q = q.Equals("type", query.Type)
|
||||
}
|
||||
return q, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user