Fix the filter description for resource list

The filter keys should be consistent with API implementation.

Story: #2005836
Task: #33599

Change-Id: Ibefaffe6e44be9de7d8338e11e4bc05facf4b6ed
This commit is contained in:
Lingxian Kong 2019-06-07 23:32:53 +12:00
parent 0d219b1b1f
commit 36d3987a77
6 changed files with 31 additions and 2 deletions

View File

@ -53,6 +53,10 @@ FUNCTION_COLUMNS = (
'memory_size',
'timeout'
)
FILTERED_FUNCTION_COLUMNS = (
"all_projects",
"project_id"
)
EXECUTION_COLUMNS = (
'id',
'function_id',
@ -66,6 +70,13 @@ EXECUTION_COLUMNS = (
'created_at',
'updated_at'
)
FILTERED_EXECUTION_COLUMNS = (
'function_id',
'project_id',
'all_projects',
'status',
'description',
)
JOB_COLUMNS = (
'id',
'name',
@ -81,6 +92,10 @@ JOB_COLUMNS = (
'created_at',
'updated_at'
)
FILTERED_JOB_COLUMNS = (
"all_projects",
"project_id"
)
WORKER_COLUMNS = (
'function_id',
'worker_name'
@ -95,6 +110,10 @@ WEBHOOK_COLUMNS = (
'updated_at',
'webhook_url'
)
FILTERED_WEBHOOK_COLUMNS = (
"all_projects",
"project_id"
)
FUNCTION_VERSION_COLUMNS = (
'id',
'function_id',
@ -114,11 +133,16 @@ FUNCTION_ALIAS_COLUMNS = (
'created_at',
'updated_at'
)
FILTERED_FUNCTION_ALIAS_COLUMNS = (
"all_projects",
"project_id"
)
@six.add_metaclass(abc.ABCMeta)
class QinlingLister(command.Lister):
columns = ()
filtered_columns = ()
def get_parser(self, prog_name):
parser = super(QinlingLister, self).get_parser(prog_name)
@ -129,8 +153,8 @@ class QinlingLister(command.Lister):
help=_(
'Filters for resource query that can be repeated. Supported '
'operands: eq, neq, in, nin, gt, gte, lt, lte, has. '
'E.g. --filter key="neq:123". The available keys are {0}'
).format(self.columns)
'E.g. --filter key="neq:123". The available keys: {0}'
).format(self.filtered_columns)
)
return parser

View File

@ -89,6 +89,7 @@ def worker_count(value):
class List(base.QinlingLister):
columns = base.FUNCTION_COLUMNS
filtered_columns = base.FILTERED_FUNCTION_COLUMNS
def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine

View File

@ -22,6 +22,7 @@ from qinlingclient import utils as q_utils
class List(base.QinlingLister):
columns = base.FUNCTION_ALIAS_COLUMNS
filtered_columns = base.FILTERED_FUNCTION_ALIAS_COLUMNS
def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine

View File

@ -22,6 +22,7 @@ from qinlingclient import utils as q_utils
class List(base.QinlingLister):
columns = base.EXECUTION_COLUMNS
filtered_columns = base.FILTERED_EXECUTION_COLUMNS
def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine

View File

@ -22,6 +22,7 @@ from qinlingclient import utils as q_utils
class List(base.QinlingLister):
columns = base.JOB_COLUMNS
filtered_columns = base.FILTERED_JOB_COLUMNS
def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine

View File

@ -22,6 +22,7 @@ from qinlingclient import utils as q_utils
class List(base.QinlingLister):
columns = base.WEBHOOK_COLUMNS
filtered_columns = base.FILTERED_WEBHOOK_COLUMNS
def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine