Browse Source

Merge pull request #8484 from Piccirello/improve-webui-stats

Improve WebUI stats dialog (addendum to #8349)
adaptive-webui-19844
Mike Tzou 7 years ago committed by GitHub
parent
commit
7aa5bc4bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/webui/api/synccontroller.cpp
  2. 5
      src/webui/www/private/css/style.css
  3. 2
      src/webui/www/private/scripts/client.js
  4. 12
      src/webui/www/private/scripts/mocha-init.js
  5. 20
      src/webui/www/private/statistics.html

2
src/webui/api/synccontroller.cpp

@ -122,7 +122,7 @@ namespace @@ -122,7 +122,7 @@ namespace
map[KEY_TRANSFER_TOTAL_PEER_CONNECTIONS] = sessionStatus.peersCount;
qreal readRatio = cacheStatus.readRatio;
map[KEY_TRANSFER_READ_CACHE_HITS] = (readRatio >= 0) ? Utils::String::fromDouble(100 * readRatio, 2) : "-";
map[KEY_TRANSFER_READ_CACHE_HITS] = (readRatio > 0) ? Utils::String::fromDouble(100 * readRatio, 2) : "0";
map[KEY_TRANSFER_TOTAL_BUFFERS_SIZE] = cacheStatus.totalUsedBuffers * 16 * 1024;
// num_peers is not reliable (adds up peers, which didn't even overcome tcp handshake)

5
src/webui/www/private/css/style.css

@ -479,3 +479,8 @@ td.statusBarSeparator { @@ -479,3 +479,8 @@ td.statusBarSeparator {
background-position: center 1px;
background-size: 2px 18px;
}
/* Statistics window */
.statisticsValue {
text-align: right;
}

2
src/webui/www/private/scripts/client.js

@ -401,7 +401,7 @@ window.addEvent('load', function () { @@ -401,7 +401,7 @@ window.addEvent('load', function () {
$('TotalWastedSession').set('html', friendlyUnit(serverState.total_wasted_session, false));
$('GlobalRatio').set('html', serverState.global_ratio);
$('TotalPeerConnections').set('html', serverState.total_peer_connections);
$('ReadCacheHits').set('html', serverState.read_cache_hits);
$('ReadCacheHits').set('html', serverState.read_cache_hits + "%");
$('TotalBuffersSize').set('html', friendlyUnit(serverState.total_buffers_size, false));
$('WriteCacheOverload').set('html', serverState.write_cache_overload + "%");
$('ReadCacheOverload').set('html', serverState.read_cache_overload + "%");

12
src/webui/www/private/scripts/mocha-init.js

@ -236,17 +236,19 @@ initializeWindows = function() { @@ -236,17 +236,19 @@ initializeWindows = function() {
};
StatisticsLinkFN = function() {
var id = 'statisticspage';
new MochaUI.Window({
id: 'statisticspage',
id: id,
title: 'QBT_TR(Statistics)QBT_TR[CONTEXT=StatsDialog]',
loadMethod: 'xhr',
contentURL: 'statistics.html',
scrollbars: false,
resizable: false,
maximizable: false,
width: 275,
height: 370,
padding: 10
width: loadWindowWidth(id, 275),
height: loadWindowHeight(id, 370),
onResize: function() {
saveWindowSize(id);
}
});
};

20
src/webui/www/private/statistics.html

@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
<h3>QBT_TR(User statistics)QBT_TR[CONTEXT=StatsDialog]</h3>
<table style="width:100%">
<tr>
<td>QBT_TR(Alltime download:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="AlltimeDL" class="statisticsValue"></td>
</tr>
<tr>
<td>QBT_TR(Alltime upload:)QBT_TR[CONTEXT=StatsDialog]</td>
<td>QBT_TR(All-time upload:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="AlltimeUL" class="statisticsValue"></td>
</tr>
<tr>
<td>QBT_TR(Total wasted (this session):)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="TotalWastedSession" class="statisticsValue"></td>
<td>QBT_TR(All-time download:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="AlltimeDL" class="statisticsValue"></td>
</tr>
<tr>
<td>QBT_TR(Global ratio:)QBT_TR[CONTEXT=StatsDialog]</td>
<td>QBT_TR(All-time share ratio:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="GlobalRatio" class="statisticsValue"></td>
</tr>
<tr>
<td>QBT_TR(Total peer connections:)QBT_TR[CONTEXT=StatsDialog]</td>
<td>QBT_TR(Session waste:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="TotalWastedSession" class="statisticsValue"></td>
</tr>
<tr>
<td>QBT_TR(Connected peers:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="TotalPeerConnections" class="statisticsValue"></td>
</tr>
</table>
@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
<td id="ReadCacheHits" class="statisticsValue"></td>
</tr>
<tr>
<td>QBT_TR(Total buffers size:)QBT_TR[CONTEXT=StatsDialog]</td>
<td>QBT_TR(Total buffer size:)QBT_TR[CONTEXT=StatsDialog]</td>
<td id="TotalBuffersSize" class="statisticsValue"></td>
</tr>
</table>

Loading…
Cancel
Save