Merge pull request #7080 from artoscinote/ma_SCI_10087

Show loader when loading smart annotations [SCI-10087]
This commit is contained in:
Martin Artnik 2024-02-12 15:54:35 +01:00 committed by GitHub
commit bf6e990435
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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