Skip to content

Unify login methods and add register - #498

Open
cjmyers wants to merge 1 commit into
masterfrom
unifyLogin
Open

cjmyers wants to merge 1 commit into
masterfrom
unifyLogin

Conversation

@cjmyers

@cjmyers cjmyers commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

This PR unifies the code for selecting SynBioHub and Flapjack instances. It also provides a means to register as a user on SynBioHub and Flapjack.

Closes #488
Closes #446

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://witty-hill-08172a210-498.centralus.5.azurestaticapps.net

@Gonza10V

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T18:01:39.833711Z 80e44ec Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80e44ec5cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

};

const SBHInstanceLogin = ({ goBack, setRepoSelection }) => {
const SBHInstanceLogin = ({ opened = true, onClose, goBack, setRepoSelection }) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Complete successful SynBioHub logins through the caller

The newly accepted onClose callback is never invoked after a successful login; handleSubmit still unconditionally calls goBack(false). In importToStudy, where SBH_LOGIN is the initial modal, this closes the modal through an empty history without calling completeWorkflow, so callers such as ImportFile and DownloadMetadata wait forever on their Promise. In the standalone Cloud/Local modal, no goBack prop is supplied at all, so the call throws and the successful login is reported as a failure.

Useful? React with 👍 / 👎.

Comment on lines 24 to +29
const [nullSelected, setNullSelected] = useState(false);
const dispatch = useDispatch();
const selected = useSelector(state => state.primaryRepository.sbhPrimary);
const setSelected = (value) => dispatch(setSBHPrimary(typeof value === 'function' ? value(selected) : value));

const findInstance = (uri) => {
return instanceData.find((element) => element.registryURL === uri);
}
const selectedRepo = modalData.selectedRepo || selected;
const setSelected = (value) => {
const nextValue = typeof value === 'function' ? value(selected) : value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Let selector updates override the initial repository

When the unified create-study flow starts with an existing modalData.selectedRepo, this expression permanently prefers that initial value over the Redux selection. setSelected writes the new value at the outer modal-data level, while this component receives only modalData[currentModal], so changing or removing the repository leaves selectedRepo pointing at the original instance and the workflow verifies and creates against the wrong repository.

Useful? React with 👍 / 👎.

<Button mr="md" onClick={() => { logout(selectedRepo, findInstance(selectedRepo)?.authtoken); }}>
Log Out
</Button>
<Button ml="auto" onClick={isUnifiedFlow ? handleUnifiedSelection : () => onClose?.()}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate credentials in the legacy selector path

For the non-unified SBHModal and LoginModal paths, selecting an instance with any stored token now immediately closes the modal. Previously this action called login, checked /profile, and cleared invalid credentials on failure; therefore expired or revoked tokens are now accepted and retained as a logged-in selection, causing later repository operations to fail without prompting the user to reauthenticate.

Useful? React with 👍 / 👎.

@Gonza10V Gonza10V left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The overall code looks good and my local deployment works as expected. There are some minor points raised by AI, please check them to see if they are pertinent.

@Gonza10V

Copy link
Copy Markdown
Contributor

Would be good to have maybe the username of email of the account connected to SBH when selecting instance.

@Kerem-G Kerem-G left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm going to make the code changes I was planning on making in this branch in a separate pull request just focused on cleaning up the codebase. The code looked good for merge to me.

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.

Catching Flapjack Login Failure Need means to register for SynBioHub and Flapjack accounts on SynBioSuite logins

3 participants