Fix #1960 : Web UI statusbar shows total_payload_download for upload

This commit is contained in:
Calum Lind 2011-11-18 01:07:39 +00:00
parent 46ab11961e
commit ead734cbf0
1 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
/*!
* Deluge.details.StatusTab.js
*
*
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -38,19 +38,19 @@ Ext.ns('Deluge.details');
Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
title: _('Status'),
autoScroll: true,
onRender: function(ct, position) {
Deluge.details.StatusTab.superclass.onRender.call(this, ct, position);
this.progressBar = this.add({
xtype: 'progress',
cls: 'x-deluge-status-progressbar'
});
this.status = this.add({
cls: 'x-deluge-status',
id: 'deluge-details-status',
border: false,
width: 1000,
listeners: {
@ -67,14 +67,14 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
}
});
},
clear: function() {
this.progressBar.updateProgress(0, ' ');
for (var k in this.fields) {
this.fields[k].innerHTML = '';
}
},
update: function(torrentId) {
if (!this.fields) this.getFields();
deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Status, {
@ -82,14 +82,14 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
scope: this
});
},
onPanelUpdate: function(el, response) {
this.fields = {};
Ext.each(Ext.query('dd', this.status.body.dom), function(field) {
this.fields[field.className] = field;
}, this);
},
onRequestComplete: function(status) {
seeders = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds;
peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers;
@ -116,8 +116,8 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False');
data.downloaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download) : '0.0 KiB') + ')';
data.uploaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download): '0.0 KiB') + ')';
data.uploaded += ' (' + ((status.total_payload_upload) ? fsize(status.total_payload_upload): '0.0 KiB') + ')';
for (var field in this.fields) {
this.fields[field].innerHTML = data[field];
}