Skip to content

Commit

Permalink
update status selections
Browse files Browse the repository at this point in the history
  • Loading branch information
VoicuAWS committed Mar 12, 2024
1 parent 3a8a7a0 commit b14bd37
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
16 changes: 10 additions & 6 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
5 changes: 2 additions & 3 deletions cid/helpers/quicksight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ def get_dataset_last_ingestion(self, dataset_id) -> str:
except self.client.exceptions.AccessDeniedException:
return '<YELLOW>AccessDenied<END>'
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'))
Expand Down Expand Up @@ -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

Expand Down
4 changes: 0 additions & 4 deletions cid/helpers/quicksight/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ def display_status(self) -> None:
status = self.qs.get_dataset_last_ingestion(dataset_id) or '<BLUE>DIRECT<END>' #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#######")
Expand Down

0 comments on commit b14bd37

Please sign in to comment.