Skip to content

Commit

Permalink
Add status icon to OIDC device flow poll progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Oct 9, 2023
1 parent 23c6678 commit 44c9d7e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion openeo/rest/auth/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,19 @@ def show_progress(self, status: Optional[str] = None):
if status:
self.set_status(status)
progress_bar = self._progress_bar.get(fraction=1.0 - self.elapsed() / self.timeout)
self._progress_display.update({"text/html": f"<code>{progress_bar}</code> {self._status}"}, raw=True)
icon = self._status_icon(self._status)
self._progress_display.update({"text/html": f"<code>{progress_bar}</code> {icon} {self._status}"}, raw=True)

def _status_icon(self, status: str) -> str:
status = status.lower()
if "polling" in status or "pending" in status:
return "\u231B" # Hourglass
elif "success" in status:
return "\u2705" # Green check mark
elif "timed out" in status:
return "\u274C" # Red cross mark
else:
return ""

def close(self):
pass
Expand Down

0 comments on commit 44c9d7e

Please sign in to comment.