Skip to content

Commit

Permalink
allow choice of category (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws authored Dec 21, 2023
1 parent b134d0b commit 738fa82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cid/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def deploy(ctx, **kwargs):
--on-drift (show|override) Action if a drift of view and dataset is discovered. 'override' = override drift(will destroy customization) or 'show' (default) = show a diff. In Unattended mode (without terminal on-drift will have allways override behaviour)
--update (yes|no) Update if some elements are already installed. Default = 'no'
--resources TEXT CID resources yaml file or url
--category TEXT Comma separated list of categories of dashboards (ex: foundational,advanced )
--catalog TEXT Comma separated list of catalog files or urls (ex: foundational,advanced )
"""
ctx.obj.deploy(**kwargs)

Expand Down
3 changes: 3 additions & 0 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,16 @@ def _deploy(self, dashboard_id: str=None, recursive=True, update=False, **kwargs
self.qs.discover_dashboards()

dashboard_id = dashboard_id or get_parameters().get('dashboard-id')
category_filter = [cat for cat in get_parameters().get('category', '').upper().split(',') if cat]
if not dashboard_id:
standard_categories = ['Foundational', 'Advanced', 'Additional'] # Show these categories first
all_categories = set([f"{dashboard.get('category', 'Other')}" for dashboard in self.resources.get('dashboards').values()])
non_standard_categories = [cat for cat in all_categories if cat not in standard_categories]
categories = standard_categories + sorted(non_standard_categories)
dashboard_options = {}
for category in categories:
if category_filter and category.upper() not in category_filter:
continue
dashboard_options[f'{category.upper()}'] = '[category]'
counter = 0
for dashboard in self.resources.get('dashboards').values():
Expand Down

0 comments on commit 738fa82

Please sign in to comment.