diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index 6d722f98..aa8e3a41 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -235,7 +235,12 @@ } }; + var create_instances = []; + var activity_ready = true; + function getCurrentActivity() { + activity_ready = false; + $.ajax({ url: 'get_activity', type: 'GET', @@ -298,6 +303,7 @@ // Create a new instance if it doesn't exist if (!(instance.length)) { + create_instances.push(key); getActivityInstance(key); return; } @@ -501,6 +507,8 @@ $('#currentActivityHeader').text(''); $('#currentActivity').html('
Nothing is currently being played.
'); } + + activity_ready = true; } }); } @@ -520,13 +528,20 @@ $('#activity-instance-' + session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 }); $('#terminate-button-' + session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 }); lockScroll('#activity-instance-' + session_key + ' .dashboard-activity-info-scroller'); + + var index = create_instances.indexOf(session_key); + if (index > -1) { + create_instances.splice(index, 1); + } } }); } getCurrentActivity(); setInterval(function () { - getCurrentActivity(); + if (!(create_instances.length) && activity_ready) { + getCurrentActivity(); + } }, 2000); setInterval(function(){