-
Notifications
You must be signed in to change notification settings - Fork 41
Convert SelectProposal
to function component and other fixes
#1496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
export function selectProposalAction(prop) { | ||
return { | ||
type: 'SELECT_PROPOSAL', | ||
proposal: prop, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer used
return async (dispatch) => { | ||
try { | ||
await sendSelectProposal(number); | ||
navigate('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to navigate after selecting a proposal. The redirect to /login
actually had no effect since the user was redirected right away to /datacollection
.
return ( | ||
<Modal | ||
show={show} | ||
backdrop={showProposalsForm || 'static'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dialog doesn't have to be a modal when re-opened manually (i.e. when a proposal is already selected). This line allows the dialog to be dismissed by clicking on the backdrop in this situation.
if (showProposalsForm) { | ||
handleHide(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition does the opposite: it makes the dialog truly modal when shown because no proposal is selected. It does so by preventing the dialog from being dismissed with Escape
in this situation.
data-default-styles | ||
onClick={() => handleHide()} | ||
> | ||
{showProposalsForm ? 'Cancel' : 'Sign out'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being more explicit about what canceling does when the dialog is shown because no proposal is selected.
}} | ||
> | ||
<Modal.Header closeButton> | ||
<Modal.Title>Select a session</Modal.Title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a bit of confusion in the UI with the terms "proposal" and "session". Are those the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:), almost but not really. When using proposal to login they are considered the same but when using user based login they are not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that it is confusing, the form should really be called SelectSession
or similar. This can be changed in a future PR.
<th>Portal</th> | ||
<th>User</th> | ||
<th>Logbook</th> | ||
<th scope="col">ID</th> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This heading cell was missing.
</del> | ||
); | ||
if (sessions.length === 0) { | ||
return <span className={styles.fallback}>No sessions</span>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Showing a fallback instead of an empty table.
onKeyDown={(evt) => { | ||
// For keyboard accessibility; ideally add "Select" button to each row instead of making rows clickable | ||
if (evt.key === 'Enter' || evt.key === ' ') { | ||
onSessionSelected(session); | ||
} | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm including a bunch of accessibility fixes like this one and various aria-label
attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice !
@@ -105,7 +107,7 @@ class ServerIO { | |||
this.hwrSocket.on('disconnect', (reason) => { | |||
console.log('hwrSocket disconnected!'); // eslint-disable-line no-console | |||
|
|||
setTimeout(() => { | |||
this.connectionLostTimeout = setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timeout was triggered sometimes when logging out and back in quickly, which made the connection-lost dialog flash on the screen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted, nice fix !
Thanks, 👍 |
getLoginInfo(), | ||
), | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, ok :)
This is based on
mo-lims
and meant to be merged into it.