Skip to content

Commit

Permalink
better choice
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 3, 2023
1 parent 12584c8 commit 4cdc9c1
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,25 +389,20 @@ def _deploy(self, dashboard_id: str=None, recursive=True, update=False, **kwargs
standard_categories = ['Foundational', 'Advanced', 'Additional']
all_categories = set([f"{dashboard.get('category', 'Custom')}" for dashboard in self.resources.get('dashboards').values()])
non_standard_categories = [cat for cat in all_categories if cat not in standard_categories]
while True:
category_options = standard_categories + sorted(non_standard_categories)
category = get_parameter(
param_name='category',
message="Please select a category of dashboard to deploy",
choices=category_options,
)
dashboard_options = {}
categories = standard_categories + sorted(non_standard_categories)
dashboard_options = {}
for category in categories:
dashboard_options[f'{category.upper()}'] = '[category]'
for dashboard in self.resources.get('dashboards').values():
if dashboard.get('category', 'Custom') == category:
dashboard_options[f"[{dashboard.get('dashboardId')}] {dashboard.get('name')}"] = dashboard.get('dashboardId')
dashboard_options['<<< back'] = '<<< back'
dashboard_options[f" [{dashboard.get('dashboardId')}] {dashboard.get('name')}"] = dashboard.get('dashboardId')
while True:
dashboard_id = get_parameter(
param_name='dashboard-id',
message="Please select a dashboard to deploy",
choices=dashboard_options,
)
if dashboard_id == '<<< back':
unset_parameter('category')
if dashboard_id == '[category]':
unset_parameter('dashboard-id')
continue
break
Expand Down

0 comments on commit 4cdc9c1

Please sign in to comment.