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
Bug 1862934: Trigger the inactivity logout method when Masthead component is mounted #6189
Conversation
@jhadvig: This pull request references Bugzilla bug 1862934, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@@ -93,6 +93,7 @@ class MastheadToolbarContents_ extends React.Component { | |||
if (window.SERVER_FLAGS.inactivityTimeout >= 300) { | |||
window.addEventListener('click', _.throttle(this._onInactivityTimeout, 500)); | |||
window.addEventListener('keydown', _.throttle(this._onInactivityTimeout, 500)); | |||
this._onInactivityTimeout(); |
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.
Do you know if the OPENSHIFT
flag and user
prop is resolved as this point? We could be racing.
Not new, but this method would be better called _resetInactivityTimeout
. _onInactivityTimeout
sounds like you were inactive for too long.
@spadgett dont think thats the issue here. It's more likely due to a fact that we are event needs to be triggered. ATM we are only adding a listener. If the user just logs in and wont do any interaction (wont trigger the event) the countdown wont start. |
Right, I understand. But I think we're still racing since |
In other words, I'm not sure the fix will always work. |
@spadgett yes, the race was also part of the issue. Updated the PR so only if all conditions are met the timeout is being set. |
) { | ||
this._updateUser(); | ||
} | ||
// Start the inactivity countdown when the flag and user are loaded and the timeout is not set | ||
if ( | ||
window.SERVER_FLAGS.inactivityTimeout >= 300 && |
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.
Let's pull this out into a separate var to avoid repeating the logic here and line 93.
const inactivityTimeoutEnabled = window.SERVER_FLAGS.inactivityTimeout >= 300;
window.SERVER_FLAGS.inactivityTimeout >= 300 && | ||
!this.userInactivityTimeout && | ||
flags[FLAGS.OPENSHIFT] && | ||
!_.isEmpty(user) |
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 not sure this check is still necessary since we check auth mode on startup.
if ( | ||
window.SERVER_FLAGS.inactivityTimeout >= 300 && | ||
!this.userInactivityTimeout && | ||
flags[FLAGS.OPENSHIFT] && |
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.
Are we meaning to disable this when not OpenShift or are we simply checking if the flag is set? If the latter, you should use flagPending
. Otherwise, we should move the OpenShift-specific logic below for logout. I don't think we need to restrict this to OpenShift, though.
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 not sure we would need to block on the flag either. Presumably the flag will resolve well before the inactivity timeout kicks in.
@spadgett I've put the initial |
/test e2e-gcp-console |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@jhadvig: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@jhadvig: All pull requests linked via external trackers have merged: openshift/console#6189. Bugzilla bug 1862934 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
We need to trigger the
_inactivityTimeout()
whenMasthead
component is mounted to start the countdown to cover cases when user will just login and wont do any activity./assign @spadgett