Implement statistics window in web UI

This commit is contained in:
FranciscoPombal
2017-03-06 03:05:18 +00:00
parent 76e1c3b10b
commit 1ce71fc63e
6 changed files with 124 additions and 0 deletions

View File

@@ -63,6 +63,7 @@
<ul>
<li><a id="showTopToolbarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(&Top Toolbar)QBT_TR" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Top Toolbar)QBT_TR</a></li>
<li><a id="speedInBrowserTitleBarLink"><img class="MyMenuIcon" src="theme/checked" alt="QBT_TR(S&peed in Title Bar)QBT_TR" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(S&peed in Title Bar)QBT_TR</a></li>
<li><a id=StatisticsLink ><img class="MyMenuIcon" src="theme/view-statistics" alt="QBT_TR(&About)QBT_TR" width="16" height="16" onload="fixPNG(this)"/>QBT_TR(&Statistics)QBT_TR</a></li>
</ul>
</li>
<li>

View File

@@ -367,6 +367,23 @@ window.addEvent('load', function () {
}else
document.title = "qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR";
$('DHTNodes').set('html', 'QBT_TR(DHT: %1 nodes)QBT_TR'.replace("%1", serverState.dht_nodes));
<!-- Statistics dialog -->
if (document.getElementById("statisticspage")) {
$('AlltimeDL').set('html', 'Alltime download: %1'.replace("%1", friendlyUnit(serverState.alltime_dl, false)));
$('AlltimeUL').set('html', 'Alltime upload: %1'.replace("%1", friendlyUnit(serverState.alltime_ul, false)));
$('TotalWastedSession').set('html', 'Total wasted (this session): %1'.replace("%1", friendlyUnit(serverState.total_wasted_session, false)));
$('GlobalRatio').set('html', 'Global ratio: %1'.replace("%1", serverState.global_ratio ));
$('TotalPeerConnections').set('html', 'Total peer connections: %1'.replace("%1", serverState.total_peer_connections ));
$('ReadCacheHits').set('html', 'Read cache hits: %1'.replace("%1", serverState.read_cache_hits ));
$('TotalBuffersSize').set('html', 'Total buffers size: %1'.replace("%1", friendlyUnit(serverState.total_buffers_size, false)));
$('WriteCacheOverload').set('html', 'Write cache overload: %1'.replace("%1", serverState.write_cache_overload ));
$('ReadCacheOverload').set('html', 'Read cache overload: %1'.replace("%1", serverState.read_cache_overload ));
$('QueuedIOJobs').set('html', 'Queued I/O jobs: %1'.replace("%1", serverState.queued_io_jobs ));
$('AverageTimeInQueue').set('html', 'Average time in queue: %1'.replace("%1", serverState.average_time_queue ));
$('TotalQueuedSize').set('html', 'Total queued size: %1'.replace("%1", friendlyUnit(serverState.total_queued_size, false) ));
}
if (serverState.connection_status == "connected")
$('connectionStatus').src = 'images/skin/connected.png';
else if (serverState.connection_status == "firewalled")
@@ -451,6 +468,8 @@ window.addEvent('load', function () {
processServerState();
});
$('StatisticsLink').addEvent('click', StatisticsLinkFN);
new MochaUI.Panel({
id : 'transferList',
title : 'Panel',

View File

@@ -212,6 +212,21 @@ initializeWindows = function() {
});
}
StatisticsLinkFN = function() {
new MochaUI.Window({
id: 'statisticspage',
title: 'QBT_TR(Statistics)QBT_TR',
loadMethod: 'xhr',
contentURL: 'statistics.html',
scrollbars: false,
resizable: false,
maximizable: false,
width: 275,
height: 370,
padding: 10
});
}
downloadLimitFN = function() {
var h = torrentsTable.selectedRowsIds();
if (h.length) {

View File

@@ -0,0 +1,47 @@
<h3>User Statistics</h3>
<table style="width:100%">
<tr>
<td id="AlltimeDL"></td>
</tr>
<tr>
<td id="AlltimeUL"></td>
</tr>
<tr>
<td id="TotalWastedSession"></td>
</tr>
<tr>
<td id="GlobalRatio"></td>
</tr>
<tr>
<td id="TotalPeerConnections"></td>
</tr>
</table>
<h3>Cache Statistics</h3>
<table style="width:100%">
<tr>
<td id="ReadCacheHits"></td>
</tr>
<tr>
<td id="TotalBuffersSize"></td>
</tr>
</table>
<h3>Performance Statistics</h3>
<table style="width:100%">
<tr>
<td id="WriteCacheOverload"></td>
</tr>
<tr>
<td id="ReadCacheOverload"></td>
</tr>
<tr>
<td id="QueuedIOJobs"></td>
</tr>
<tr>
<td id="AverageTimeInQueue"></td>
</tr>
<tr>
<td id="TotalQueuedSize"></td>
</tr>
</table>