From 44c9d7e939dd52b0938afd0ba281ce027e23151e Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Mon, 9 Oct 2023 16:43:29 +0200 Subject: [PATCH] Add status icon to OIDC device flow poll progress bar --- openeo/rest/auth/oidc.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/openeo/rest/auth/oidc.py b/openeo/rest/auth/oidc.py index a1ed2bf3f..e51aa7b05 100644 --- a/openeo/rest/auth/oidc.py +++ b/openeo/rest/auth/oidc.py @@ -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"{progress_bar} {self._status}"}, raw=True) + icon = self._status_icon(self._status) + self._progress_display.update({"text/html": f"{progress_bar} {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