Skip to content

Commit

Permalink
Adding Tag decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Dec 4, 2023
1 parent 83ec1cf commit 964c61f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions brewtils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def command(
icon_name=None, # type: Optional[str]
hidden=False, # type: Optional[bool]
metadata=None, # type: Optional[Dict]
tags=None, # type: Optional[List[str]]
allow_any_kwargs=None, # type: Optional[bool]
):
"""Decorator for specifying Command details
Expand Down Expand Up @@ -119,6 +120,7 @@ def echo_json(self, message):
icon_name: The icon name. Should be either a FontAwesome or a Glyphicon name.
hidden: Flag controlling whether the command is visible on the user interface.
metadata: Free-form dictionary
tags: A list of tags that can be used to filter commands
allow_any_kwargs: Flag controlling whether passed kwargs will be restricted to
the Command parameters defined.
Expand Down Expand Up @@ -156,6 +158,7 @@ def echo_json(self, message):
icon_name=icon_name,
hidden=hidden,
metadata=metadata,
tags=tags,
allow_any_kwargs=allow_any_kwargs,
)

Expand All @@ -178,6 +181,7 @@ def echo_json(self, message):
icon_name=icon_name,
hidden=hidden,
metadata=metadata,
tags=tags,
allow_any_kwargs=allow_any_kwargs,
)

Expand Down
2 changes: 2 additions & 0 deletions brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def __init__(
icon_name=None,
hidden=False,
metadata=None,
tags=None,
topics=None,
allow_any_kwargs=None,
):
Expand All @@ -133,6 +134,7 @@ def __init__(
self.icon_name = icon_name
self.hidden = hidden
self.metadata = metadata or {}
self.tags = tags or []
self.topics = topics or []
self.allow_any_kwargs = allow_any_kwargs

Expand Down
1 change: 1 addition & 0 deletions brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class CommandSchema(BaseSchema):
icon_name = fields.Str(allow_none=True)
hidden = fields.Boolean(allow_none=True)
metadata = fields.Dict(allow_none=True)
tags = fields.List(fields.Str(), allow_none=True)
topics = fields.List(fields.Str(), allow_none=True)
allow_any_kwargs = fields.Boolean(allow_none=True)

Expand Down
1 change: 1 addition & 0 deletions brewtils/test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def command_dict(parameter_dict, system_id):
"template": "<html></html>",
"icon_name": "icon!",
"metadata": {"meta": "data"},
"tags": [],
"topics": [],
"allow_any_kwargs": False,
}
Expand Down

0 comments on commit 964c61f

Please sign in to comment.