Added a few data warnings

- Warning for No game servers
- Warning for disabled geolocations
- Warning for sponge chunks

Affects issues:
- Close #1730
This commit is contained in:
Risto Lahtela 2021-02-12 13:33:16 +02:00
parent 15cbbd86a1
commit da3b71f8b9
6 changed files with 34 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import com.djrapitops.plan.gathering.domain.Ping;
import com.djrapitops.plan.gathering.domain.Session;
import com.djrapitops.plan.gathering.domain.WorldTimes;
import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.DataGatheringSettings;
import com.djrapitops.plan.settings.config.paths.DisplaySettings;
import com.djrapitops.plan.settings.config.paths.TimeSettings;
import com.djrapitops.plan.settings.theme.Theme;
@ -346,6 +347,7 @@ public class GraphJSONCreator {
WorldMap worldMap = graphs.special().worldMap(geolocationCounts);
return Maps.builder(String.class, Object.class)
.put("geolocations_enabled", config.get(DataGatheringSettings.GEOLOCATIONS) && config.get(DataGatheringSettings.ACCEPT_GEOLITE2_EULA))
.put("geolocation_series", worldMap.getEntries())
.put("geolocation_bar_series", geolocationBarGraph.getBars())
.put("colors", Maps.builder(String.class, String.class)

View File

@ -259,6 +259,10 @@ public enum HtmlLang implements Lang {
QUERY("Query<"),
QUERY_MAKE_ANOTHER("Make another query"),
QUERY_MAKE("Make a query"),
WARNING_NO_GAME_SERVERS("Some data requires Plan to be installed on game servers."),
WARNING_NO_GEOLOCATIONS("Geolocation gathering needs to be enabled in the config (Accept GeoLite2 EULA)."),
WARNING_NO_SPONGE_CHUNKS("Chunks unavailable on Sponge"),
;
private final String defaultValue;

View File

@ -238,6 +238,7 @@ function loadservers(servers, error) {
}
if (!servers || !servers.length) {
document.getElementById('game-server-warning').classList.remove('hidden');
document.getElementById('data_server_list').innerHTML =
`<div class="card shadow mb-4"><div class="card-body"><p>No servers found in the database.</p><p>It appears that Plan is not installed on any game servers or not connected to the same database. See <a href="https://github.com/plan-player-analytics/Plan/wiki">wiki</a> for Network tutorial.</p></div></div>`
document.getElementById('quick_view_players_online').innerText = `No server to display online activity for.`;
@ -404,6 +405,9 @@ function loadGeolocationGraph(json, error) {
});
worldMap('worldMap', json.colors.low, json.colors.high, geolocationSeries);
horizontalBarChart('countryBarChart', geolocationBarCategories, [geolocationBarSeries], s.name.unit_players);
if (!json.geolocations_enabled) {
document.getElementById('geolocation-warning').classList.remove('hidden');
}
} else if (error) {
const errorMessage = `Failed to load graph data: ${error}`;
document.getElementById('worldMap').innerText = errorMessage;

View File

@ -327,6 +327,9 @@ function loadPerformanceValues(json, error) {
element.querySelector('#data_entities_30d').innerText = data.entities_30d;
element.querySelector('#data_entities_7d').innerText = data.entities_7d;
element.querySelector('#data_entities_24h').innerText = data.entities_24h;
if ("Unavailable" === data.chunks_30d) {
document.getElementById('sponge-chunk-warning').classList.remove('hidden');
}
element.querySelector('#data_chunks_30d').innerText = data.chunks_30d;
element.querySelector('#data_chunks_7d').innerText = data.chunks_7d;
element.querySelector('#data_chunks_24h').innerText = data.chunks_24h;
@ -511,6 +514,9 @@ function loadGeolocationGraph(json, error) {
});
worldMap('worldMap', json.colors.low, json.colors.high, geolocationSeries);
horizontalBarChart('countryBarChart', geolocationBarCategories, [geolocationBarSeries], s.name.unit_players);
if (!json.geolocations_enabled) {
document.getElementById('geolocation-warning').classList.remove('hidden');
}
} else if (error) {
const errorMessage = `Failed to load graph data: ${error}`;
document.getElementById('worldMap').innerText = errorMessage;

View File

@ -236,6 +236,10 @@
<h6 class="m-0 font-weight-bold col-black"><i class="fa fa-fw fa-book-open"></i>
Network as Numbers</h6>
</div>
<div class="alert alert-warning mb-0 hidden" id="game-server-warning">
<i class="fa fa-fw fa-exclamation-triangle"></i>
Some data requires Plan to be installed on game servers.
</div>
<div class="card-body" id="data_numbers">
<p><i class="col-black fa fa-fw fa-users"></i> Total Players<span
class="float-right"><b id="data_total"></b></span></p>
@ -630,6 +634,10 @@
class="fas fa-fw fa-globe col-green"></i>
Geolocations</h6>
</div>
<div class="alert alert-warning mb-0 hidden" id="geolocation-warning">
<i class="fa fa-fw fa-exclamation-triangle"></i>
Geolocation gathering needs to be enabled in the config (Accept GeoLite2 EULA).
</div>
<div class="chart-area row" style="height: 100%;">
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<div id="countryBarChart"><span class="loader"></span></div>
@ -887,7 +895,7 @@
time: {timezoneOffset: v.values.timezoneOffset * 60}
});
refreshingJsonRequest("./v1/graph?type=playersOnline&server=${serverUUID}", loadPlayersOnlineGraph, 'network-overview');
refreshingJsonRequest("./v1/graph?type=playersOnline&server=${serverUUID}", loadPlayersOnlineGraph, 'network-overview', true);
refreshingJsonRequest("./v1/graph?type=uniqueAndNew", loadUniqueAndNewGraph, 'network-overview');
refreshingJsonRequest("./v1/graph?type=hourlyUniqueAndNew", loadHourlyUniqueAndNewGraph, 'network-overview');
refreshingJsonRequest("./v1/graph?type=serverPie", loadServerPie, 'sessions-overview');

View File

@ -929,6 +929,10 @@
class="fas fa-fw fa-globe col-green"></i>
Geolocations</h6>
</div>
<div class="alert alert-warning mb-0 hidden" id="geolocation-warning">
<i class="fa fa-fw fa-exclamation-triangle"></i>
Geolocation gathering needs to be enabled in the config (Accept GeoLite2 EULA).
</div>
<div class="chart-area row" style="height: 100%;">
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<div id="countryBarChart"><span class="loader"></span></div>
@ -1112,7 +1116,11 @@
<td id="data_entities_24h"></td>
</tr>
<tr>
<td><i class="fa fa-fw fa-map col-blue-grey"></i> Average Chunks</td>
<td>
<i class="fa fa-fw fa-map col-blue-grey"></i> Average Chunks
<i class="far fa-fw fa-eye hidden" id="sponge-chunk-warning"
title="Chunks unavailable on Sponge"></i>
</td>
<td id="data_chunks_30d"></td>
<td id="data_chunks_7d"></td>
<td id="data_chunks_24h"></td>