Fixes to page style & function

- Fixed ping graph request getting blocked by adblocker
- Fixed bottom margin at the end of cards with p tags
- Fixed bottom margin at the end of tables
- Fixed night mode navigation drawer border, tab link border
- Fixed incorrect icons in performance insights
- Colored performance tab icons
This commit is contained in:
Rsl1122 2019-08-15 12:22:14 +03:00
parent 43a43db645
commit 95f27a0a99
10 changed files with 50 additions and 35 deletions

View File

@ -16,6 +16,7 @@
*/
package com.djrapitops.plan.system.webserver;
import com.djrapitops.plan.system.DebugChannels;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.locale.Locale;
import com.djrapitops.plan.system.settings.config.PlanConfig;
@ -100,6 +101,7 @@ public class RequestHandler implements HttpHandler {
// Increase attempt count and block if too high
Optional<Response> forbid = handlePasswordBruteForceAttempts(request, response);
if (forbid.isPresent()) {
logger.getDebugLogger().logOn(DebugChannels.WEB_REQUESTS, "Blocked: " + request.getTargetString() + " -> " + request.getRemoteAddress());
response = forbid.get();
}
@ -108,6 +110,7 @@ public class RequestHandler implements HttpHandler {
responseHeaders.set("WWW-Authenticate", response.getHeader("WWW-Authenticate").orElse("Basic realm=\"Plan WebUser (/plan register)\""));
}
logger.getDebugLogger().logOn(DebugChannels.WEB_REQUESTS, "Sending: " + request.getTargetString() + " -> " + request.getRemoteAddress());
response.setResponseHeaders(responseHeaders);
response.send(exchange, locale, theme);
} catch (Exception e) {

View File

@ -74,7 +74,7 @@ public class GraphsJSONHandler implements PageHandler {
return new JSONResponse(graphJSON.activityGraphsJSONAsMap(serverUUID));
case "geolocation":
return new JSONResponse(graphJSON.geolocationGraphsJSONAsMap(serverUUID));
case "ping":
case "aggregatedPing":
return new JSONResponse(graphJSON.pingGraphsJSON(serverUUID));
case "punchCard":
return new JSONResponse(graphJSON.punchCardJSONAsMap(serverUUID));

View File

@ -1826,7 +1826,6 @@ pre code {
.table {
width: 100%;
margin-bottom: 1rem;
background-color: transparent;
}
@ -5120,6 +5119,14 @@ p.collapsing {
padding: 1.25rem;
}
.card-body p + p {
margin-top: 1rem;
}
.card-body p {
margin: 0;
}
.card-title {
margin-bottom: 0.75rem;
}

View File

@ -76,11 +76,12 @@
// Background colors from dracula theme
$('head').append('<style id="nightmode">' +
'#content {background-color:#282a36;}' +
'.card,.bg-white,.modal-content,.page-loader,hr {background-color:#44475a;border-color:#6272a4;}' +
'.bg-white.collapse-inner {border 1px solid;}' +
'.card,.bg-white,.modal-content,.page-loader,.nav-tabs .nav-link:hover,.nav-tabs,hr {background-color:#44475a;border-color:#6272a4!important;}' +
'.bg-white.collapse-inner {border:1px solid;}' +
'.card-header {background-color:#44475a;border-color:#6272a4;}' +
'#content,.col-black,.text-gray-800,.collapse-item,.modal-title,.modal-body,.page-loader,.close,.fc-title,.fc-time {color:#eee8d5 !important;}' +
'.collapse-item:hover,.nav-link.active {background-color: #606270 !important;}' +
'.nav-tabs .nav-link.active {background-color: #44475a !important;border-color:#6272a4 #6272a4 #44475a !important;}' +
'.fc-today {background:#646e8c !important}' +
'</style>');
// Turn bright tables to dark

View File

@ -93,7 +93,7 @@ function createAccordionBody(i, session) {
}
function createKillsTable(player_kills) {
var table = '<table class="table scrollbar"><tbody>';
var table = '<table class="table mb-0"><tbody>';
if (player_kills.length === 0) {
table += '<tr><td>No Kills</td><td>-</td><td>-</td></tr>'

View File

@ -9,7 +9,7 @@ function jsonRequest(address, callback) {
xhttp.onreadystatechange = function () {
if (this.readyState === 4) {
try {
if (this.status === 200) {
if (this.status === 200 || (this.status === 0 && this.responseText)) {
var json = JSON.parse(this.responseText);
setTimeout(function () {
callback(json, null)
@ -18,12 +18,18 @@ function jsonRequest(address, callback) {
callback(null, this.status)
} else if (this.status === 400) {
callback(null, this.responseText)
} else if (this.status === 0) {
callback(null, "Request was blocked. (Adblocker maybe?)")
}
} catch (e) {
callback(null, e.message)
}
}
};
xhttp.timeout = 20000;
xhttp.ontimeout = function () {
callback(null, "Timed out after 20 seconds.")
};
xhttp.open("GET", address, true);
xhttp.send();
}, 0);

View File

@ -15,7 +15,7 @@
<!-- Custom fonts for this template-->
<link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,800,900"
<link href="https://fonts.googleapis.com/css?family=Nunito:400,700,800,900&display=swap&subset=latin-ext"
rel="stylesheet">
<!-- Custom styles for this template-->

View File

@ -15,7 +15,7 @@
<!-- Custom fonts for this template-->
<link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,800,900"
<link href="https://fonts.googleapis.com/css?family=Nunito:400,700,800,900&display=swap&subset=latin-ext"
rel="stylesheet">
<!-- Custom styles for this template-->
@ -263,7 +263,7 @@
class="fa fa-fw col-blue fa-book-open"></i>
Online Activity</h6>
</div>
<table class="table mb-0" id="data_online_activity">
<table class="table" id="data_online_activity">
<thead>
<th></th>
<th>Last 30 Days</th>
@ -357,7 +357,7 @@
<small>Click to expand</small></span></h6>
</div>
<div class="scrollbar">
<table class="table mb-0" id="tableAccordion">
<table class="table" id="tableAccordion">
<thead>
<tr>
<th><i class="fa fa-fw fa-server"></i> Server</th>
@ -410,7 +410,7 @@
class="fa fa-fw fa-campground col-red"></i>
PvP & PvE as Numbers</h6>
</div>
<table class="table mb-0" id="data_numbers">
<table class="table" id="data_numbers">
<thead>
<tr>
<th></th>
@ -545,7 +545,7 @@
<small>Click to expand</small></span></h6>
</div>
<div class="scrollbar">
<table class="table mb-0" id="tableServerAccordion">
<table class="table" id="tableServerAccordion">
<thead>
<tr>
<th><i class="fa fa-fw fa-server"></i> Server</th>

View File

@ -14,7 +14,7 @@
<!-- Custom fonts for this template-->
<link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"
integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,800,900"
<link href="https://fonts.googleapis.com/css?family=Nunito:400,700,800,900&display=swap&subset=latin-ext"
rel="stylesheet">
<!-- Custom styles for this template-->
@ -189,11 +189,11 @@
<span class="float-right"><span id="data_retention"></span>&nbsp<b
id="data_retention_perc"></b></span></p>
<hr>
<p><i class="col-orange fa fa-fw fa-tachometer-alt"></i> Average TPS <span
<p><i class="col-orange fa fa-fw fa-tachometer-alt"></i> Average TPS<span
class="float-right"><b id="data_avg_tps"></b></span></p>
<p><i class="col-red fa fa-fw fa-exclamation-circle"></i> Low TPS Spikes <span
<p><i class="col-red fa fa-fw fa-exclamation-circle"></i> Low TPS Spikes<span
class="float-right"><b id="data_low_tps_spikes"></b></span></p>
<p><i class="col-red fa fa-fw fa-power-off"></i> Server downtime <span
<p><i class="col-red fa fa-fw fa-power-off"></i> Downtime<span
class="float-right" id="data_downtime"></span></p>
</div>
</div>
@ -250,18 +250,15 @@
class="fa fa-fw fa-exchange-alt"></i>
Week Comparison</h6>
</div>
<table class="table mb-0" id="data_weeks">
<table class="table" id="data_weeks">
<thead>
<tr>
<th><i class="text-success fa fa-caret-up"></i><i
class="text-danger fa fa-caret-down"></i>
<small>Comparing 7 days</small>
</th>
<th>7 days before (<span id="data_start"></span> - <span
id="data_midpoint"></span>)
</th>
<th>Last 7 days (<span id="data_midpoint2"></span> - <span id="data_end"></span>)
</th>
<th><span id="data_start"></span> - <span id="data_midpoint"></span></th>
<th><span id="data_midpoint2"></span> - <span id="data_end"></span></th>
<th>Trend</th>
</tr>
</thead>
@ -358,7 +355,7 @@
<a aria-controls="contact" aria-selected="false" class="nav-link col-black"
data-toggle="tab" href="#punchcard-tab" id="online-punchcard-tab"
role="tab"><i class="fa fa-fw fa-braille col-black"></i> Punchcard
30d</a>
for 30 Days</a>
</li>
</ul>
<div class="tab-content" id="onlineActivityTabContent">
@ -535,8 +532,8 @@
class="far fa-fw fa-hand-pointer"></i>
<small>Click to expand</small></span></h6>
</div>
<div class="scrollbar" style="height: 80vh">
<table class="table mb-0" id="tableAccordion">
<div class="scrollbar" style="max-height: 80vh">
<table class="table" id="tableAccordion">
<thead>
<tr>
<th><i class="fa fa-fw fa-user"></i> Player</th>
@ -945,7 +942,7 @@
Connection Information</h6>
</div>
<div class="scrollbar">
<table class="table mb-0">
<table class="table">
<thead class="bg-amber">
<tr>
<th><i class=" fa fa-fw fa-globe"></i> Country</th>
@ -998,31 +995,31 @@
<a aria-controls="profile" aria-selected="false" class="nav-link col-black"
data-toggle="tab"
href="#tps" id="performance-tps-tab" role="tab"><i
class="fa fa-fw fa-tachometer-alt col-blue-grey"></i> TPS</a>
class="fa fa-fw fa-tachometer-alt col-deep-orange"></i> TPS</a>
</li>
<li class="nav-item">
<a aria-controls="contact" aria-selected="false" class="nav-link col-black"
data-toggle="tab" href="#cpuram" id="performance-hardware-tab"
role="tab"><i
class="fa fa-fw fa-microchip col-blue-grey"></i> CPU
class="fa fa-fw fa-microchip col-light-green"></i> CPU
& RAM</a>
</li>
<li class="nav-item">
<a aria-controls="contact" aria-selected="false" class="nav-link col-black"
data-toggle="tab" href="#worldload" id="performance-minecraft-tab"
role="tab"><i class="fa fa-fw fa-map col-blue-grey"></i>
role="tab"><i class="fa fa-fw fa-map col-purple"></i>
World
Load</a>
</li>
<li class="nav-item">
<a aria-controls="contact" aria-selected="false" class="nav-link col-black"
data-toggle="tab" href="#ping" id="performance-ping-tab" role="tab"><i
class="fa fa-fw fa-signal col-blue-grey"></i> Ping</a>
class="fa fa-fw fa-signal col-amber"></i> Ping</a>
</li>
<li class="nav-item">
<a aria-controls="contact" aria-selected="false" class="nav-link col-black"
data-toggle="tab" href="#disk" id="performance-disk-tab" role="tab"><i
class="fa fa-fw fa-hdd col-blue-grey"></i> Disk Space</a>
class="fa fa-fw fa-hdd col-green"></i> Disk Space</a>
</li>
</ul>
<div class="tab-content" id="performanceChartTabContent">
@ -1150,9 +1147,9 @@
class="float-right"><b id="data_low_tps_players"></b></span></p>
<p><i class="fa fa-fw fa-dragon col-red"></i> Average Entities<span
class="float-right"><b id="data_low_tps_entities"></b></span></p>
<p><i class="fa fa-fw fa-dragon col-red"></i> Average Chunks<span
<p><i class="fa fa-fw fa-map col-red"></i> Average Chunks<span
class="float-right"><b id="data_low_tps_chunks"></b></span></p>
<p><i class="fa fa-fw fa-dragon col-red"></i> Average CPU<span
<p><i class="fa fa-fw fa-tachometer-alt col-red"></i> Average CPU<span
class="float-right"><b id="data_low_tps_cpu"></b></span></p>
</div>
</div>
@ -1530,7 +1527,8 @@
$('#diskGraph').text("Failed to load graph data: " + error);
}
});
jsonRequest("../v1/graph?type=ping&server=${serverName}", function (json, error) {
jsonRequest("../v1/graph?type=aggregatedPing&server=${serverName}", function (json, error) {
if (json) {
var series = {
avgPing: {

View File

@ -105,7 +105,7 @@ Type | Description
`worldPie` | World Pie data of all sessions combined
`activity` | Activity stack graph and pie graph data
`geolocation` | World Map and bar graph data. World Map uses iso-a3 specification of Country codes and Bar graph uses country names.
`ping` | Min, Avg, Max ping graph data.
`aggregatedPing` | Min, Avg, Max ping graph data.
`punchCard` | PunchCard graph data. (Scatter plot)
### `GET /v1/player`