Skip to content

Commit

Permalink
add a checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 5, 2023
1 parent a830b45 commit 9d7f431
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def glue(self) -> Glue:
'glue': Glue(self.base.session)
})
return self._clients.get('glue')

@property
def organizations(self) -> Organizations:
if not self._clients.get('organizations'):
Expand Down Expand Up @@ -399,7 +399,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:
dashboard_options[f" [{dashboard.get('dashboardId')}] {dashboard.get('name')}"] = dashboard.get('dashboardId')
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:
dashboard_id = get_parameter(
param_name='dashboard-id',
Expand Down Expand Up @@ -476,13 +477,13 @@ def _deploy(self, dashboard_id: str=None, recursive=True, update=False, **kwargs
choices=['yes', 'no'],
default='yes') != 'yes':
return
logger.info("Swich to recursive mode")
logger.info("Switch to recursive mode")
recursive = True

if recursive:
self.create_datasets(required_datasets_names, dashboard_datasets, recursive=recursive, update=update)

# Find datasets for template or defintion
# Find datasets for template or definition
if not dashboard_definition.get('datasets'):
dashboard_definition['datasets'] = {}

Expand All @@ -507,12 +508,12 @@ def _deploy(self, dashboard_id: str=None, recursive=True, update=False, **kwargs
if not isinstance(ds, Dataset) or ds.name != dataset_name:
continue
if dashboard_definition.get('templateId'):
# For templates we can additionaly verify dataset fields
# For templates we can additionally verify dataset fields
dataset_fields = {col.get('Name'): col.get('Type') for col in ds.columns}
src_fields = source_template.datasets.get(ds_map.get(dataset_name, dataset_name) )
required_fileds = {col.get('Name'): col.get('DataType') for col in src_fields}
required_fields = {col.get('Name'): col.get('DataType') for col in src_fields}
unmatched = {}
for k, v in required_fileds.items():
for k, v in required_fields.items():
if k not in dataset_fields or dataset_fields[k] != v:
unmatched.update({k: {'expected': v, 'found': dataset_fields.get(k)}})
logger.debug(f'unmatched_fields={unmatched}')
Expand Down Expand Up @@ -1056,7 +1057,7 @@ def update_dashboard(self, dashboard_id, dashboard_definition):
# Update dashboard
print(f'\nUpdating {dashboard_id}')
logger.debug(f"Updating {dashboard_id}")

try:
self.qs.update_dashboard(dashboard, dashboard_definition)
print('Update completed\n')
Expand Down

0 comments on commit 9d7f431

Please sign in to comment.