Stops dashboard refreshes stacking and causing
issues with browsers
This commit is contained in:
parent
e757679e66
commit
7f095511d6
|
@ -28,10 +28,17 @@
|
||||||
var errCountIndex = [];
|
var errCountIndex = [];
|
||||||
var intervalDashboardTop;
|
var intervalDashboardTop;
|
||||||
var intervalDashboardBottom;
|
var intervalDashboardBottom;
|
||||||
|
|
||||||
var loadDashboardTop = function () {
|
var loadDashboardTop = function () {
|
||||||
$("#baglist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
$("#baglist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
||||||
$("#buylist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
$("#buylist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
||||||
|
|
||||||
|
// Clear exisitng interval to stop multiple attempts to load at the same time.
|
||||||
|
if (intervalDashboardTop != null)
|
||||||
|
{
|
||||||
|
clearInterval(intervalDashboardTop);
|
||||||
|
}
|
||||||
|
|
||||||
$("#dashboardTop").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardTop', '', function (responseText, textStatus, XMLHttpRequest) {
|
$("#dashboardTop").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardTop', '', function (responseText, textStatus, XMLHttpRequest) {
|
||||||
$("#baglist-refresh-icon").html('');
|
$("#baglist-refresh-icon").html('');
|
||||||
$("#buylist-refresh-icon").html('');
|
$("#buylist-refresh-icon").html('');
|
||||||
|
@ -49,6 +56,9 @@
|
||||||
} else {
|
} else {
|
||||||
errCountIndex["DashboardTop"] = 0;
|
errCountIndex["DashboardTop"] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reinstate interval
|
||||||
|
intervalDashboardTop = setInterval(function () { loadDashboardTop(); }, 5 * 1000);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,6 +72,13 @@
|
||||||
nv.logs = {};
|
nv.logs = {};
|
||||||
nv.tooltip = {};
|
nv.tooltip = {};
|
||||||
|
|
||||||
|
// Clear exisitng interval to stop multiple attempts to load at the same time.
|
||||||
|
if (intervalDashboardBottom != null)
|
||||||
|
{
|
||||||
|
clearInterval(intervalDashboardBottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load dashboard
|
||||||
$("#dashboardBottom").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardBottom', '', function (responseText, textStatus, XMLHttpRequest) {
|
$("#dashboardBottom").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardBottom', '', function (responseText, textStatus, XMLHttpRequest) {
|
||||||
if (textStatus == 'error') {
|
if (textStatus == 'error') {
|
||||||
errCountIndex["DashboardBottom"]++;
|
errCountIndex["DashboardBottom"]++;
|
||||||
|
@ -73,17 +90,18 @@
|
||||||
} else {
|
} else {
|
||||||
errCountIndex["DashboardBottom"] = 0;
|
errCountIndex["DashboardBottom"] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reinstate the interval.
|
||||||
|
intervalDashboardBottom = setInterval(function () { loadDashboardBottom(); }, @Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
errCountIndex["DashboardTop"] = 0;
|
errCountIndex["DashboardTop"] = 0;
|
||||||
loadDashboardTop();
|
loadDashboardTop();
|
||||||
intervalDashboardTop = setInterval(function () { loadDashboardTop(); }, 5 * 1000);
|
|
||||||
|
|
||||||
errCountIndex["DashboardBottom"] = 0;
|
errCountIndex["DashboardBottom"] = 0;
|
||||||
loadDashboardBottom();
|
loadDashboardBottom();
|
||||||
intervalDashboardBottom = setInterval(function () { loadDashboardBottom(); }, @Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
Loading…
Reference in New Issue