Skip to content

Commit

Permalink
add deprecation feature
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 7, 2023
1 parent 76d52ad commit b3d093f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions cid/builtin/core/data/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dashboards:
CUDOS:
category: 'Foundational'
name: CUDOS Dashboard
deprecationNotice: ' DEPRECATED. Replaced with CUDOS Dashboard v5.'
templateId: cudos_dashboard_v3
dashboardId: cudos
localConfigs: ["update-dashboard.json"]
Expand Down
2 changes: 2 additions & 0 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ def _deploy(self, dashboard_id: str=None, recursive=True, update=False, **kwargs
dashboard_options[f'{category.upper()}'] = '[category]'
for dashboard in self.resources.get('dashboards').values():
if dashboard.get('category', 'Custom') == category:
if dashboard.get('deprecationNotice'):
continue
check = '✓' if dashboard.get('dashboardId') in self.qs.dashboards else ' '
dashboard_options[f" {check}[{dashboard.get('dashboardId')}] {dashboard.get('name')}"] = dashboard.get('dashboardId')
while True:
Expand Down
10 changes: 6 additions & 4 deletions cid/helpers/quicksight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,6 @@ def list_data_sources(self) -> list:

def select_dashboard(self, force=False) -> str:
""" Select from a list of discovered dashboards """
selection = list()

dashboard_id = get_parameters().get('dashboard-id')
if dashboard_id:
return dashboard_id
Expand All @@ -627,14 +625,18 @@ def select_dashboard(self, force=False) -> str:
for dashboard in self.dashboards.values():
health = 'healthy' if dashboard.health else 'unhealthy'
key = f'{dashboard.name} ({dashboard.arn}, {health}, {dashboard.status})'
if ((dashboard.latest or not dashboard.health) and not force):
notice = dashboard.definition.get('deprecationNotice', '')
if notice:
key = f'{key} {notice}'
if ((dashboard.latest or not dashboard.health or notice) and not force):
choices[key] = None
else:
choices[key] = dashboard.id

try:
dashboard_id = get_parameter(
param_name='dashboard-id',
message="Please select installation(s) from the list",
message="Please select dashboard from the list",
choices=choices,
none_as_disabled=True,
)
Expand Down

0 comments on commit b3d093f

Please sign in to comment.