mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-04 23:48:42 +01:00
Error displayed when json request fails
This commit is contained in:
parent
46a74d2297
commit
b3bca52d48
@ -36,15 +36,18 @@ function smallTrend(trend) {
|
||||
}
|
||||
}
|
||||
|
||||
function displayError(element, error) {
|
||||
element.find('.d-sm-flex').after('<div class="alert alert-danger" role="alert">Failed to load values: ' + error + '</div>')
|
||||
}
|
||||
|
||||
/* This function loads Network Overview tab */
|
||||
function loadNetworkOverviewValues(json, error) {
|
||||
tab = $('#network-overview');
|
||||
if (error) {
|
||||
$('#network-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#network-overview');
|
||||
|
||||
// Last 7 days
|
||||
data = json.players;
|
||||
element = $(tab).find('#data_players');
|
||||
@ -107,13 +110,12 @@ function loadNetworkOverviewValues(json, error) {
|
||||
|
||||
/* This function loads Online Activity Overview tab */
|
||||
function loadOnlineActivityOverviewValues(json, error) {
|
||||
tab = $('#online-activity-overview');
|
||||
if (error) {
|
||||
$('#online-activity-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#online-activity-overview');
|
||||
|
||||
// Online Activity as Numbers
|
||||
data = json.numbers;
|
||||
element = $(tab).find('#data_numbers');
|
||||
@ -166,13 +168,12 @@ function loadOnlineActivityOverviewValues(json, error) {
|
||||
|
||||
/* This function loads Sessions tab */
|
||||
function loadSessionValues(json, error) {
|
||||
tab = $('#sessions-overview');
|
||||
if (error) {
|
||||
$('#sessions-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#sessions-overview');
|
||||
|
||||
// Insights
|
||||
data = json.insights;
|
||||
element = $(tab).find('#data_insights');
|
||||
@ -188,13 +189,12 @@ function loadSessionValues(json, error) {
|
||||
|
||||
/* This function loads Playerbase Overview tab */
|
||||
function loadPlayerbaseOverviewValues(json, error) {
|
||||
tab = $('#playerbase-overview');
|
||||
if (error) {
|
||||
$('#playerbase-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#playerbase-overview');
|
||||
|
||||
// Trends
|
||||
data = json.trends;
|
||||
element = $(tab).find('#data_trends');
|
||||
@ -231,7 +231,7 @@ function loadPlayerbaseOverviewValues(json, error) {
|
||||
|
||||
function loadServerBoxes(servers, error) {
|
||||
if (error) {
|
||||
$('#data_servers').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError($('#servers-tab'), error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
function loadPlayerOverviewValues(json, error) {
|
||||
tab = $("#player-overview");
|
||||
if (error) {
|
||||
$("#player-overview").addClass("forbidden"); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $("#player-overview");
|
||||
|
||||
// Player information card
|
||||
data = json.info;
|
||||
element = $(tab).find("#data_player_info");
|
||||
@ -62,13 +61,12 @@ function loadPlayerOverviewValues(json, error) {
|
||||
|
||||
/* This function loads PvP & PvE tab */
|
||||
function loadPvPPvEValues(json, error) {
|
||||
tab = $('#pvp-pve');
|
||||
if (error) {
|
||||
$('#pvp-pve').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#pvp-pve');
|
||||
|
||||
// as Numbers
|
||||
data = json.kill_data;
|
||||
element = $(tab).find('#data_numbers');
|
||||
@ -145,12 +143,13 @@ function createConnectionsTableBody(connections) {
|
||||
}
|
||||
|
||||
function loadServerAccordion(json, error) {
|
||||
tab = $("#server-overview");
|
||||
if (error) {
|
||||
$('#server-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
serverTable = $("#server-overview").find("#tableSAccordion").find("tbody");
|
||||
serverTable = tab.find("#tableSAccordion").find("tbody");
|
||||
|
||||
var servers = json.servers;
|
||||
|
||||
|
@ -36,15 +36,19 @@ function smallTrend(trend) {
|
||||
}
|
||||
}
|
||||
|
||||
function displayError(element, error) {
|
||||
element.find('.d-sm-flex').after('<div class="alert alert-danger" role="alert">Failed to load values: ' + error + '</div>')
|
||||
}
|
||||
|
||||
/* This function loads Server Overview tab */
|
||||
function loadServerOverviewValues(json, error) {
|
||||
tab = $('#server-overview');
|
||||
|
||||
if (error) {
|
||||
$('#server-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#server-overview');
|
||||
|
||||
// Last 7 days
|
||||
data = json.last_7_days;
|
||||
element = $(tab).find('#data_7_days');
|
||||
@ -119,13 +123,13 @@ function loadServerOverviewValues(json, error) {
|
||||
|
||||
/* This function loads Online Activity Overview tab */
|
||||
function loadOnlineActivityOverviewValues(json, error) {
|
||||
tab = $('#online-activity-overview');
|
||||
|
||||
if (error) {
|
||||
$('#online-activity-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#online-activity-overview');
|
||||
|
||||
// Online Activity as Numbers
|
||||
data = json.numbers;
|
||||
element = $(tab).find('#data_numbers');
|
||||
@ -178,13 +182,13 @@ function loadOnlineActivityOverviewValues(json, error) {
|
||||
|
||||
/* This function loads Sessions tab */
|
||||
function loadSessionValues(json, error) {
|
||||
tab = $('#sessions-overview');
|
||||
|
||||
if (error) {
|
||||
$('#sessions-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#sessions-overview');
|
||||
|
||||
// Insights
|
||||
data = json.insights;
|
||||
element = $(tab).find('#data_insights');
|
||||
@ -200,13 +204,12 @@ function loadSessionValues(json, error) {
|
||||
|
||||
/* This function loads PvP & PvE tab */
|
||||
function loadPvPPvEValues(json, error) {
|
||||
tab = $('#pvp-pve');
|
||||
if (error) {
|
||||
$('#pvp-pve').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#pvp-pve');
|
||||
|
||||
// as Numbers
|
||||
data = json.numbers;
|
||||
element = $(tab).find('#data_numbers');
|
||||
@ -246,13 +249,12 @@ function loadPvPPvEValues(json, error) {
|
||||
|
||||
/* This function loads Playerbase Overview tab */
|
||||
function loadPlayerbaseOverviewValues(json, error) {
|
||||
tab = $('#playerbase-overview');
|
||||
if (error) {
|
||||
$('#playerbase-overview').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#playerbase-overview');
|
||||
|
||||
// Trends
|
||||
data = json.trends;
|
||||
element = $(tab).find('#data_trends');
|
||||
@ -289,13 +291,12 @@ function loadPlayerbaseOverviewValues(json, error) {
|
||||
|
||||
/* This function loads Performance tab */
|
||||
function loadPerformanceValues(json, error) {
|
||||
tab = $('#performance');
|
||||
if (error) {
|
||||
$('#performance').addClass('forbidden'); // TODO Figure out 403
|
||||
displayError(tab, error);
|
||||
return;
|
||||
}
|
||||
|
||||
tab = $('#performance');
|
||||
|
||||
// as Numbers
|
||||
data = json.numbers;
|
||||
element = $(tab).find('#data_numbers');
|
||||
|
@ -307,7 +307,7 @@
|
||||
</div> <!-- /.container-fluid -->
|
||||
</div> <!-- End of Network Overview tab -->
|
||||
<!-- Begin Servers Overview Tab -->
|
||||
<div class="tab">
|
||||
<div class="tab" id="servers-tab">
|
||||
<div class="container-fluid mt-4">
|
||||
<!-- Page Heading -->
|
||||
<div class="d-sm-flex align-items-center justify-content-between mb-4">
|
||||
|
Loading…
Reference in New Issue
Block a user