mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +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,
|
at: at,
|
||||||
callbacks: {
|
callbacks: {
|
||||||
remoteFilter: function(query, callback) {
|
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 $currentAtWho = $(`.atwho-view[data-at-who-id=${$(field).attr('data-smart-annotation')}]`);
|
||||||
var filterType;
|
var filterType;
|
||||||
var params = { query: query };
|
var params = { query: query };
|
||||||
filterType = FilterTypeEnum[$currentAtWho.find('.tab-pane.active').data('object-type')];
|
filterType = FilterTypeEnum[$currentAtWho.find('.tab-pane.active').data('object-type')];
|
||||||
if (!filterType) {
|
if (!filterType) {
|
||||||
|
clearTimeout(loaderTimeout);
|
||||||
callback([{ name: '' }]);
|
callback([{ name: '' }]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +81,8 @@ var SmartAnnotation = (function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.getJSON(filterType.dataUrl, params, function(data) {
|
$.getJSON(filterType.dataUrl, params, function(data) {
|
||||||
|
clearTimeout(loaderTimeout);
|
||||||
|
|
||||||
localStorage.setItem('smart_annotation_states/teams/' + data.team, JSON.stringify({
|
localStorage.setItem('smart_annotation_states/teams/' + data.team, JSON.stringify({
|
||||||
tag: filterType.tag,
|
tag: filterType.tag,
|
||||||
repository: data.repository
|
repository: data.repository
|
||||||
|
|
Loading…
Reference in a new issue