Make sure current activity is loaded before refreshing
This commit is contained in:
@@ -235,7 +235,12 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var create_instances = [];
|
||||||
|
var activity_ready = true;
|
||||||
|
|
||||||
function getCurrentActivity() {
|
function getCurrentActivity() {
|
||||||
|
activity_ready = false;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'get_activity',
|
url: 'get_activity',
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@@ -298,6 +303,7 @@
|
|||||||
|
|
||||||
// Create a new instance if it doesn't exist
|
// Create a new instance if it doesn't exist
|
||||||
if (!(instance.length)) {
|
if (!(instance.length)) {
|
||||||
|
create_instances.push(key);
|
||||||
getActivityInstance(key);
|
getActivityInstance(key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -501,6 +507,8 @@
|
|||||||
$('#currentActivityHeader').text('');
|
$('#currentActivityHeader').text('');
|
||||||
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">Nothing is currently being played.</div>');
|
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">Nothing is currently being played.</div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activity_ready = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -520,13 +528,20 @@
|
|||||||
$('#activity-instance-' + session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 });
|
$('#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 });
|
$('#terminate-button-' + session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 });
|
||||||
lockScroll('#activity-instance-' + session_key + ' .dashboard-activity-info-scroller');
|
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();
|
getCurrentActivity();
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
getCurrentActivity();
|
if (!(create_instances.length) && activity_ready) {
|
||||||
|
getCurrentActivity();
|
||||||
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
|
Reference in New Issue
Block a user