From b14bd3776c4d74060c35b033eeda1ed26b456dc6 Mon Sep 17 00:00:00 2001 From: Voicu Chirtes Date: Mon, 11 Mar 2024 22:22:34 -0700 Subject: [PATCH] update status selections --- cid/common.py | 16 ++++++++++------ cid/helpers/quicksight/__init__.py | 5 ++--- cid/helpers/quicksight/dashboard.py | 4 ---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/cid/common.py b/cid/common.py index 279ab00b..27a33130 100644 --- a/cid/common.py +++ b/cid/common.py @@ -648,16 +648,20 @@ def status(self, dashboard_id, **kwargs): dashboard.display_url(self.qs_url, **self.qs_url_params) with IsolatedParameters(): next_selections = { - 'Refresh all datasets of this dashboard': 'refresh', - 'Update dashboard': 'update', - 'Go back to dashboard selection': 'goback', - 'Exit': 'exit' + '[◀] Back': 'back', + '[↗] Open': 'open', + '[◴] Refresh datasets': 'refresh', + '[↺] Update dashboard': 'update', + '[✕] Exit': 'exit', } next_selection = get_parameter( - param_name='next-selection', + param_name=f'{dashboard.id}', message="Please make a selection", - choices=next_selections, + choices=next_selections ) + if next_selection == 'open': + self.open(dashboard.id, **kwargs) + if next_selection == 'refresh': dashboard.refresh_datasets() diff --git a/cid/helpers/quicksight/__init__.py b/cid/helpers/quicksight/__init__.py index 44e1b77f..fcc82bc6 100644 --- a/cid/helpers/quicksight/__init__.py +++ b/cid/helpers/quicksight/__init__.py @@ -919,7 +919,7 @@ def get_dataset_last_ingestion(self, dataset_id) -> str: except self.client.exceptions.AccessDeniedException: return 'AccessDenied' if not ingestions: - return None #todo fix this using dataset import type. None could be if refresh never ran too, no ? + return None last_ingestion = ingestions[0] # Suppose it is the latest status = last_ingestion.get('IngestionStatus') time_ago = ago(last_ingestion.get('CreatedTime')) @@ -973,10 +973,9 @@ def refresh_dataset(self, dataset_id): AwsAccountId=self.account_id) status = response.get('IngestionStatus') except self.client.exceptions.AccessDeniedException: - logger.info(f'Access denied refreshing dataset: {dataset_id}') + logger.error(f'Access denied refreshing dataset: {dataset_id}') except Exception as exc: logger.debug(exc, exc_info=True) - logger.info(f'Unable to list refresh dataset {dataset_id}: {str(exc)}') raise CidError(f'Unable to list refresh dataset {dataset_id}: {str(exc)}') from exc return mode, status diff --git a/cid/helpers/quicksight/dashboard.py b/cid/helpers/quicksight/dashboard.py index 643de11d..a2c4e270 100644 --- a/cid/helpers/quicksight/dashboard.py +++ b/cid/helpers/quicksight/dashboard.py @@ -150,10 +150,6 @@ def display_status(self) -> None: status = self.qs.get_dataset_last_ingestion(dataset_id) or 'DIRECT' #todo fix this Blue using dataset import type. cid_print(f' {dataset_name: <36} ({dataset_id: <36}) {status}') - """print('\n') - if get_yesno_parameter('display-raw', 'Display dashboard raw data?', default='yes'): - print(json.dumps(self.raw, indent=4, sort_keys=True, default=str))""" - def display_url(self, url_template: str, launch: bool = False, **kwargs) -> None: url = url_template.format(dashboard_id=self.id, **kwargs) print(f"#######\n####### {self.name} is available at: " + url + "\n#######")