mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 06:09:39 +08:00
Automatic merge from release/2.1.0 -> master
* commit 'bee99e79721dd5512560a0ad3f3ecbf224b7cbbc': climc list add joint filter
This commit is contained in:
@@ -2,6 +2,7 @@ package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
)
|
||||
|
||||
@@ -27,6 +28,7 @@ type BaseListOptions struct {
|
||||
Search string `help:"Filter results by a simple keyword search"`
|
||||
Meta bool `help:"Piggyback metadata information"`
|
||||
Filter []string `help:"Filters"`
|
||||
JointFilter []string `help:"Filters with joint table col; joint_tbl(related_key).filter_col.filter_cond(filters)"`
|
||||
FilterAny bool `help:"If true, match if any of the filters matches; otherwise, match if all of the filters match"`
|
||||
Admin bool `help:"Is an admin call?"`
|
||||
Tenant string `help:"Tenant ID or Name"`
|
||||
@@ -62,6 +64,13 @@ func FetchPagingParams(options BaseListOptions) *jsonutils.JSONDict {
|
||||
if options.Meta {
|
||||
params.Add(jsonutils.JSONTrue, "with_meta")
|
||||
}
|
||||
if len(options.JointFilter) > 0 {
|
||||
arr := jsonutils.NewArray()
|
||||
for _, f := range options.JointFilter {
|
||||
arr.Add(jsonutils.NewString(f))
|
||||
}
|
||||
params.Add(arr, "joint_filter")
|
||||
}
|
||||
if len(options.Filter) > 0 {
|
||||
arr := jsonutils.NewArray()
|
||||
for _, f := range options.Filter {
|
||||
|
||||
Reference in New Issue
Block a user