Skip to content

Commit

Permalink
add category
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 1, 2023
1 parent 49ba72e commit da56d7a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
6 changes: 6 additions & 0 deletions cid/builtin/core/data/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# QuickSight Dashboards definitions
dashboards:
CUDOS:
category: 'Foundational'
name: CUDOS Dashboard
templateId: cudos_dashboard_v3
dashboardId: cudos
Expand All @@ -18,6 +19,7 @@ dashboards:
minTemplateDescription: "v4.75.0"

CID:
category: 'Foundational'
name: Cost Intelligence Dashboard
templateId: Cost_Intelligence_Dashboard
dashboardId: cost_intelligence_dashboard
Expand All @@ -32,6 +34,7 @@ dashboards:
minTemplateDescription: "v3.1.0"

KPI:
category: 'Foundational'
name: KPI Dashboard
templateId: kpi_dashboard
dashboardId: kpi_dashboard
Expand All @@ -48,6 +51,7 @@ dashboards:
minTemplateDescription: "v1.2.1"

TAO:
category: 'Advanced'
name: Trusted Advisor Organizational View
templateId: ta-organizational-view
dashboardId: ta-organizational-view
Expand All @@ -59,6 +63,7 @@ dashboards:
minTemplateDescription: "v1.4.0"

Trends:
category: 'Additional'
name: Trends Dashboard
templateId: cudos-trends-dashboard-template
dashboardId: trends-dashboard
Expand All @@ -72,6 +77,7 @@ dashboards:
minTemplateDescription: "v5.0.0"

Compute Optimizer:
category: 'Advanced'
name: Compute Optimizer Dashboard
templateId: compute_optimizer
dashboardId: compute-optimizer-dashboard
Expand Down
37 changes: 29 additions & 8 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,35 @@ def _deploy(self, dashboard_id: str=None, recursive=True, update=False, **kwargs


if dashboard_id is None:
dashboard_id = get_parameter(
param_name='dashboard-id',
message="Please select dashboard to install",
choices={
f"[{dashboard.get('dashboardId')}] {dashboard.get('name')}" : dashboard.get('dashboardId')
for k, dashboard in self.resources.get('dashboards').items()
},
)
while True:
category_options = ['Foundational', 'Advanced', 'Additional'] + \
sorted(list(set([
f"{dashboard.get('category', 'Custom')}"
for k, dashboard in self.resources.get('dashboards').items()
if f"{dashboard.get('category', 'Custom')}" not in ('Foundational', 'Advanced', 'Additional')
])))
category = get_parameter(
param_name='category',
message="Please select a category of dashboard to install",
choices=category_options,
)
print(category)
dashboard_options = {
f"[{dashboard.get('dashboardId')}] {dashboard.get('name')}" : dashboard.get('dashboardId')
for k, dashboard in self.resources.get('dashboards').items()
if dashboard.get('category', 'Custom') == category
}
dashboard_options['<<< back'] = '<<< back'
dashboard_id = get_parameter(
param_name='dashboard-id',
message="Please select dashboard to install",
choices=dashboard_options,
)
if dashboard_id != '<<< back':
break
unset_parameter('category')
unset_parameter('dashboard-id')

if not dashboard_id:
print('No dashboard selected')
return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dashboards:
SUS-DASH:
category: 'Additional'
dependsOn:
datasets:
- aws_regions
Expand Down

0 comments on commit da56d7a

Please sign in to comment.