webui: added transfer rate

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8398 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-06-08 09:25:11 +00:00
parent e1fbd77d80
commit a28543708d
3 changed files with 8 additions and 3 deletions

View File

@ -126,7 +126,8 @@ void TransfersHandler::handleDownloads(Request &req, Response &resp)
double size = fi.size;
double transfered = fi.transfered;
stream << makeKeyValueReference("size", size)
<< makeKeyValueReference("transfered", transfered);
<< makeKeyValueReference("transfered", transfered)
<< makeKeyValue("transfer_rate", fi.tfRate);
std::string dl_status;
/*

View File

@ -457,7 +457,7 @@ function makeFriendlyUnit(bytes)
{
if(bytes < 1e3)
return bytes.toFixed(1) + "B";
if(bytes < 1e3)
if(bytes < 1e6)
return (bytes/1e3).toFixed(1) + "kB";
if(bytes < 1e9)
return (bytes/1e6).toFixed(1) + "MB";
@ -532,6 +532,7 @@ var DownloadsWidget = React.createClass({
<td>{this.props.data.name}</td>
<td>{makeFriendlyUnit(this.props.data.size)}</td>
<td><ProgressBar progress={this.props.data.transfered / this.props.data.size}/></td>
<td>{makeFriendlyUnit(this.props.data.transfer_rate*1e3)}/s</td>
<td>{this.props.data.download_status}</td>
<td>{ctrlBtn} <div className="btn" onClick={cancelFn}>cancel</div> {playBtn}</td>
</tr>);
@ -543,6 +544,7 @@ var DownloadsWidget = React.createClass({
<th>name</th>
<th>size</th>
<th>completed</th>
<th>transfer rate</th>
<th>download status</th>
<th>actions</th>
</tr>

View File

@ -457,7 +457,7 @@ function makeFriendlyUnit(bytes)
{
if(bytes < 1e3)
return bytes.toFixed(1) + "B";
if(bytes < 1e3)
if(bytes < 1e6)
return (bytes/1e3).toFixed(1) + "kB";
if(bytes < 1e9)
return (bytes/1e6).toFixed(1) + "MB";
@ -532,6 +532,7 @@ var DownloadsWidget = React.createClass({
<td>{this.props.data.name}</td>
<td>{makeFriendlyUnit(this.props.data.size)}</td>
<td><ProgressBar progress={this.props.data.transfered / this.props.data.size}/></td>
<td>{makeFriendlyUnit(this.props.data.transfer_rate*1e3)}/s</td>
<td>{this.props.data.download_status}</td>
<td>{ctrlBtn} <div className="btn" onClick={cancelFn}>cancel</div> {playBtn}</td>
</tr>);
@ -543,6 +544,7 @@ var DownloadsWidget = React.createClass({
<th>name</th>
<th>size</th>
<th>completed</th>
<th>transfer rate</th>
<th>download status</th>
<th>actions</th>
</tr>