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