mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 03:35:25 +08:00
Merge pull request #7080 from artoscinote/ma_SCI_10087
Show loader when loading smart annotations [SCI-10087]
This commit is contained in:
commit
bf6e990435
1 changed files with 10 additions and 0 deletions
|
@ -56,11 +56,19 @@ var SmartAnnotation = (function() {
|
|||
at: at,
|
||||
callbacks: {
|
||||
remoteFilter: function(query, callback) {
|
||||
|
||||
// show loader after .25 seconds
|
||||
var loaderTimeout = setTimeout(function() {
|
||||
$('.atwho-scroll-container').css({ height: '100px' });
|
||||
$('.atwho-scroll-container').html('<div class="loading-overlay" style="padding: 20px"></div>');
|
||||
}, 250);
|
||||
|
||||
var $currentAtWho = $(`.atwho-view[data-at-who-id=${$(field).attr('data-smart-annotation')}]`);
|
||||
var filterType;
|
||||
var params = { query: query };
|
||||
filterType = FilterTypeEnum[$currentAtWho.find('.tab-pane.active').data('object-type')];
|
||||
if (!filterType) {
|
||||
clearTimeout(loaderTimeout);
|
||||
callback([{ name: '' }]);
|
||||
return false;
|
||||
}
|
||||
|
@ -73,6 +81,8 @@ var SmartAnnotation = (function() {
|
|||
}
|
||||
}
|
||||
$.getJSON(filterType.dataUrl, params, function(data) {
|
||||
clearTimeout(loaderTimeout);
|
||||
|
||||
localStorage.setItem('smart_annotation_states/teams/' + data.team, JSON.stringify({
|
||||
tag: filterType.tag,
|
||||
repository: data.repository
|
||||
|
|
Loading…
Reference in a new issue