diff --git a/cid/builtin/core/data/resources.yaml b/cid/builtin/core/data/resources.yaml index 1d2ce325..0684b725 100644 --- a/cid/builtin/core/data/resources.yaml +++ b/cid/builtin/core/data/resources.yaml @@ -2,6 +2,7 @@ # QuickSight Dashboards definitions dashboards: CUDOS: + category: 'Foundational' name: CUDOS Dashboard templateId: cudos_dashboard_v3 dashboardId: cudos @@ -18,6 +19,7 @@ dashboards: minTemplateDescription: "v4.75.0" CID: + category: 'Foundational' name: Cost Intelligence Dashboard templateId: Cost_Intelligence_Dashboard dashboardId: cost_intelligence_dashboard @@ -32,6 +34,7 @@ dashboards: minTemplateDescription: "v3.1.0" KPI: + category: 'Foundational' name: KPI Dashboard templateId: kpi_dashboard dashboardId: kpi_dashboard @@ -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 @@ -59,6 +63,7 @@ dashboards: minTemplateDescription: "v1.4.0" Trends: + category: 'Additional' name: Trends Dashboard templateId: cudos-trends-dashboard-template dashboardId: trends-dashboard @@ -72,6 +77,7 @@ dashboards: minTemplateDescription: "v5.0.0" Compute Optimizer: + category: 'Advanced' name: Compute Optimizer Dashboard templateId: compute_optimizer dashboardId: compute-optimizer-dashboard diff --git a/cid/common.py b/cid/common.py index 634f6daf..375461c2 100644 --- a/cid/common.py +++ b/cid/common.py @@ -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 diff --git a/dashboards/sustainability-proxy-metrics/sustainability-proxy-metrics.yaml b/dashboards/sustainability-proxy-metrics/sustainability-proxy-metrics.yaml index 691ec04b..9aa0f0d3 100644 --- a/dashboards/sustainability-proxy-metrics/sustainability-proxy-metrics.yaml +++ b/dashboards/sustainability-proxy-metrics/sustainability-proxy-metrics.yaml @@ -1,5 +1,6 @@ dashboards: SUS-DASH: + category: 'Additional' dependsOn: datasets: - aws_regions