-
Notifications
You must be signed in to change notification settings - Fork 139
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
Fix notifications popup issues #980
Conversation
…tifications_popup_fixing
|
3 jobListing is the model for the notifications table, and where are subscribers to jobListing updates |
@vantonov1 , if back-end is the single source of truth - why do have lines like
|
Not exactly. Backend is polled, it happens not often, so first notification (with PENDING state usually) is added on UI, and then updated from backend 4 Yes, it have to be removed |
js/components/negative-controls.js
Outdated
job.name = info.data.jobParameters.jobName; | ||
job.executionId = info.data.executionId; | ||
job.status(info.data.status); | ||
sharedState.jobListing.queue(job); |
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 4 lines of code above look exactly the same way as they do in
negative-controls.js
. Why not to move it to util method? - Why
queue
here is called outside of timeout function (which seems to be the proper way), while above - inside the timeout?
@@ -85,7 +85,7 @@ define([ | |||
this.selectedAnalysisId.subscribe((id) => { | |||
authAPI.loadUserInfo(); | |||
}); | |||
|
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.
Dummy diff
jobDetails.name = info.data.jobParameters.jobName; | ||
jobDetails.executionId = info.data.executionId; | ||
jobDetails.status(info.data.status); | ||
sharedState.jobListing.queue(jobDetails); |
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.
Get a look at the comment above regarding shared util method
jobDetails.executionId = info.data.executionId; | ||
jobDetails.status(info.data.status); | ||
sharedState.jobListing.queue(jobDetails); | ||
this.pollForInfo(); |
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 same as above
@vantonov1 , wouldn't it be better just throw event / call a method to pull the list of notifications when required but not to maintain two lists (versions) of the notifications? |
it costs additional server call. After success call to start a job, server returns just enough info to update notifications list - we just add new job to the list, there is no 2 versions. I dont think it is worth to ignore returned info, and ask again |
I'm in agreement with @vantonov1 : this is how it works (or used to work? Haven't checked if refactor changed this behavior) in cohort definition generation. The reason: if we rely on the polling to update the status of the generation, and the polling is at 10s intervals, if you post the generate request at second 1 of 10, you have to wait 9 whole seconds to see the UI respond to your generation request. What do users do when they don't see an immediate result of their button click? they click it again. How many clicks can you fit in 9 seconds? A lot (you should see me play starcraft). So, instead, the approach is to get the button click, disable the button, do the async post, get the response, read the status of the job or just populate the job list with a fake (but have the jobID from the initial POST to get the identifier of the job) and then subsequent polls will deliver the up-to-date state. |
@chrisknoll , if you read my previous message, you'd see that you will NOT
because I suggested
But, I am OK with this:
|
Apologies, @pavgra , I did not recognize that consideration. However, I will say that I've seen tricky issues with if you have a poll on a setInterval, and then due to a user action you do a invoke-and-wait call to the same action that the setInterval does, you sometimes get this out of order refresh where the setInterval comes back with some slightly different data than your user-initiated call returns and it gets all flaky. So, my underlying concern was just have a single source of refresh (the polling) while being able to update the UI with some state that confirms to they user that we got the request and are working on it. Certainly doing @vantonov1 approach means there is no network latency involved.
Does that mean you are OK to approve the PR or did you want me to pull and review? |
js/components/user-bar.js
Outdated
name: n.jobParameters.jobName, | ||
status: ko.observable(n.status), | ||
executionId: n.executionId, | ||
viewed: ko.observable(false), |
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 causes notification icons to be highlighted on each page load
…tifications_popup_fixing
…ing' into ATLP-535/Notifications_popup_fixing # Conflicts: # js/components/user-bar.js
Fixed styling for new job lines
|
…ing' into ATLP-535/Notifications_popup_fixing
Fix for viewed flag
@vantonov1 , there is following block of code in
As soon as we kick off 10 jobs after Cohort reporting (Heracles) it will stop working properly (the required job won't be in the shared state anymore -> need to query for the job status explicitly) |
…tifications_popup_fixing
…tifications_popup_fixing # Conflicts: # js/components/cohortdefinitionviewer/main.js # js/components/negative-controls.js # js/components/user-bar.js # js/pages/cohort-definitions/cohort-definition-manager.js # js/pages/incidence-rates/ir-manager.js # js/services/JobDetailsService.js
…tifications_popup_fixing
No description provided.