diff --git a/usr/lib/python3.8/vmmgr/wsgiapp.py b/usr/lib/python3.8/vmmgr/wsgiapp.py index eea0fdf..434ef03 100644 --- a/usr/lib/python3.8/vmmgr/wsgiapp.py +++ b/usr/lib/python3.8/vmmgr/wsgiapp.py @@ -199,46 +199,45 @@ class WSGIApp: if app in pending_actions: # Display queued or currently processed actions app_queue = pending_actions[app] - if app_queue.index: - if app_queue.exception: - # Display failed task - if isinstance(app_queue.exception, InvalidSignature): - status = lang.repo_package_invalid_signature() - elif isinstance(app_queue.exception, NotFound): - status = lang.repo_package_missing() - elif isinstance(app_queue.exception, BaseException): - if app_queue.action in (vmmgr.start_app, vmmgr.stop_app): - status = lang.stop_start_error() - else: - status = lang.package_manager_error() - status = f'{status} OK' - actions = None - else: - # Display task/subtask progress - action_item = app_queue.queue[app_queue.index-1] - if action_item.type in (ActionItemType.IMAGE_DOWNLOAD, ActionItemType.APP_DOWNLOAD): - status = lang.status_downloading(action_item.key) - elif action_item.type in (ActionItemType.IMAGE_UNPACK, ActionItemType.APP_UNPACK): - status = lang.status_unpacking(action_item.key) - elif action_item.type == ActionItemType.IMAGE_DELETE: - status = lang.status_deleting(action_item.key) - elif action_item.type == ActionItemType.APP_START: - status = lang.status_starting() - elif action_item.type == ActionItemType.APP_STOP: - status = lang.status_stopping() - elif action_item.type == ActionItemType.APP_INSTALL: - status = lang.status_installing() - elif action_item.type == ActionItemType.APP_UPDATE: - status = lang.status_updating() - elif action_item.type == ActionItemType.APP_UNINSTALL: - status = lang.status_uninstalling() - if app_queue.action not in (vmmgr.start_app, vmmgr.stop_app): - # For tasks other than start/stop which have only a single subtask, display also index of the subtask in queue - status = f'[{app_queue.index}/{len(app_queue.queue)}] {status}' - if action_item.units_total: - # Show progress for tasks which have measurable progress - status = f'{status} ({floor(action_item.units_done/action_item.units_total*100)} %)' - actions = '
' + if app_queue.exception: + # Display failed task + if isinstance(app_queue.exception, InvalidSignature): + status = lang.repo_package_invalid_signature() + elif isinstance(app_queue.exception, NotFound): + status = lang.repo_package_missing() + elif isinstance(app_queue.exception, BaseException): + if app_queue.action in (vmmgr.start_app, vmmgr.stop_app): + status = lang.stop_start_error() + else: + status = lang.package_manager_error() + status = f'{status} OK' + actions = None + elif app_queue.index: + # Display task/subtask progress + action_item = app_queue.queue[app_queue.index-1] + if action_item.type in (ActionItemType.IMAGE_DOWNLOAD, ActionItemType.APP_DOWNLOAD): + status = lang.status_downloading(action_item.key) + elif action_item.type in (ActionItemType.IMAGE_UNPACK, ActionItemType.APP_UNPACK): + status = lang.status_unpacking(action_item.key) + elif action_item.type == ActionItemType.IMAGE_DELETE: + status = lang.status_deleting(action_item.key) + elif action_item.type == ActionItemType.APP_START: + status = lang.status_starting() + elif action_item.type == ActionItemType.APP_STOP: + status = lang.status_stopping() + elif action_item.type == ActionItemType.APP_INSTALL: + status = lang.status_installing() + elif action_item.type == ActionItemType.APP_UPDATE: + status = lang.status_updating() + elif action_item.type == ActionItemType.APP_UNINSTALL: + status = lang.status_uninstalling() + if app_queue.action not in (vmmgr.start_app, vmmgr.stop_app): + # For tasks other than start/stop which have only a single subtask, display also index of the subtask in queue + status = f'[{app_queue.index}/{len(app_queue.queue)}] {status}' + if action_item.units_total: + # Show progress for tasks which have measurable progress + status = f'{status} ({floor(action_item.units_done/action_item.units_total*100)} %)' + actions = '
' else: # Display queued (pending, not started) task if app_queue.action == vmmgr.start_app: