-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Create MVP UI for imports when background queue processing is taking place #25041
Create MVP UI for imports when background queue processing is taking place #25041
Conversation
(Standard links)
|
eaee6b3
to
f748a01
Compare
var target = '#crm-import-progress'; | ||
var url = CRM.vars.civiimport.url; | ||
// Load the snippet into the container | ||
CRM.loadPage(url, { | ||
target: target, | ||
block: false | ||
}) | ||
window.setInterval(function() { | ||
CRM.$(target).crmSnippet('refresh'); | ||
}, 1000); |
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.
JS code needs to be enclosed otherwise variables are in the global scope.
var target = '#crm-import-progress'; | |
var url = CRM.vars.civiimport.url; | |
// Load the snippet into the container | |
CRM.loadPage(url, { | |
target: target, | |
block: false | |
}) | |
window.setInterval(function() { | |
CRM.$(target).crmSnippet('refresh'); | |
}, 1000); | |
CRM.$(function($) { | |
var target = '#crm-import-progress'; | |
var url = CRM.vars.civiimport.url; | |
// Load the snippet into the container | |
CRM.loadPage(url, { | |
target: target, | |
block: false | |
}); | |
window.setInterval(function() { | |
$(target).crmSnippet('refresh'); | |
}, 1000); | |
}); |
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.
thanks @colemanw - I fixed this & retested it & it worked :-)
f748a01
to
342dde3
Compare
block: false | ||
}) | ||
window.setInterval(function () { | ||
CRM.$(target).crmSnippet('refresh'); |
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 is a lot of hits on the server. Best skip if the user isn't paying attention...
CRM.$(target).crmSnippet('refresh'); | |
if (document.hasFocus()) { | |
CRM.$(target).crmSnippet('refresh'); | |
} |
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.
ohh - good idea
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.
Done
342dde3
to
c4e1f8b
Compare
This gives us a usable monitoring page for imports, without having to plan out a solution that covers all potential use cases. It should be a quick way to get this functionality operational
c4e1f8b
to
ccb52b0
Compare
Overview
Create acceptable UI for imports when background queue processing is taking place
BackGround queue processing requires three things
enable civi-import core extension
the setting to be enabled - eg.
drush @dmaster cvapi Setting.create enableBackgroundQueue=1
a job to run in the background processing the queue. In build-kit environments running
coworker run
from the site directory will generally workThe result of this is that the Import will run in the background and the user does not have to keep the browser tab open
Before
There is a placeholder screen
After
Technical Details
I decided to do an import-specific version of this in the import extension to avoid having to figure out larger issues around this & also to provide a space where the experience could be tailored to imports. This approach made removing this last blocker more manageable.
I think there is a lot of scope to improve wording but I left that out of scope for this commit. The main thing we probably want to communicate is that they can close the browser, bookmark the page & come back
Comments
The csv I used for testing is in this ext - https://github.com/eileenmcnaughton/testdata/tree/master/csvs