Skip to content

Add login to blueapi - #70

Draft
noemifrisina wants to merge 14 commits into
mainfrom
64-login-dialog
Draft

Add login to blueapi#70
noemifrisina wants to merge 14 commits into
mainfrom
64-login-dialog

Conversation

@noemifrisina

Copy link
Copy Markdown
Collaborator

Closes #64

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.14607% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.36%. Comparing base (ae802f6) to head (382db16).

Files with missing lines Patch % Lines
src/i19serial_ui/gui/widgets/login_dialog.py 80.00% 11 Missing ⚠️
src/i19serial_ui/gui/serial_gui_eh2.py 85.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
- Coverage   94.06%   93.36%   -0.70%     
==========================================
  Files          26       27       +1     
  Lines        1415     1493      +78     
==========================================
+ Hits         1331     1394      +63     
- Misses         84       99      +15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZohebShaikh ZohebShaikh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the late review, I had it on my mind on Friday but couldn't get to it.

The PR looks good

self.setLayout(layout)

def _on_click_trigger_login(self):
self.client.client.login()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a try and except. and the errors should be provided in a dialog box.

Also, could you display the "Please log in" message in the dialog box? Alternatively, you can replace it with this message.

Logging in
Please login from this URL:- http://localhost:8081/realms/master/device?user_code=THHA-EWNF

self.setLayout(layout)

def _on_click_trigger_login(self):
self.client.client.login()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing is when you are logged in. The only feedback you get is Logged In in the console(CLI)

It will be nice if the Please login window is replaced by Logged in as fedid, This can also stay on the top corner all the time in the main window

You can find the fedid of the person logged by

  1. decoding the access token
  2. Then getting fedid from the claims

if self.login_dialog.isVisible():
self.login_dialog.close()
tidy_up_logging([self.gui_logger])
print("PLEASE LOG OUT FROM BLUEAPI")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache is getting stored at ~/.cache/blueapi_cache. It would be nice you could get this stored in memory.
This will be a change in blueapi. You will need to create a new In memory Cache.

Then once the UI process terminates the cached tokens are also gone, because my assumption is that people are logging in as a shared user on some i19 beamline computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a log in dialog

2 participants