Skip to content

Commit

Permalink
WebAdmin active connections: fix active transfer display
Browse files Browse the repository at this point in the history
Signed-off-by: Nicola Murino <[email protected]>
  • Loading branch information
drakkan committed Oct 28, 2024
1 parent 256e3c1 commit 10e4843
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions templates/webadmin/connections.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,27 @@ <h3 data-i18n="connections.view_manage" class="card-title section-title">View an
render: function (data, type, row) {
if (type === 'display') {
let result = "";
if (row.active_transfers && row.active_transfers.length > 0){
let transfer = row.active_transfers[0];
let path = escapeHTML(transfer.path);
let elapsed = row.current_time - transfer.start_time;
if (elapsed > 0 && transfer.size > 0){
let speed = (transfer.size*1.0) / (elapsed/1000.0);
if (transfer.operation_type === 'upload'){
result = $.t('connections.upload_info', {path: path, size: fileSizeIEC(transfer.size), speed: humanizeSpeed(speed)});
} else {
result = $.t('connections.download_info', {path: path, size: fileSizeIEC(transfer.size), speed: humanizeSpeed(speed)});
if (row.active_transfers && row.active_transfers.length > 0) {
for (let i = 0; i < row.active_transfers.length; i++) {
if (i > 0){
result+=". ";
}
} else {
if (transfer.operation_type === 'upload'){
result = $.t('connections.upload', {path: path});
let transfer = row.active_transfers[i];
let path = escapeHTML(transfer.path);
let elapsed = row.current_time - transfer.start_time;
if (elapsed > 0 && transfer.size > 0) {
let speed = (transfer.size * 1.0) / (elapsed / 1000.0);
if (transfer.operation_type === 'upload') {
result += $.t('connections.upload_info', { path: path, size: fileSizeIEC(transfer.size), speed: humanizeSpeed(speed) });
} else {
result += $.t('connections.download_info', { path: path, size: fileSizeIEC(transfer.size), speed: humanizeSpeed(speed) });
}
} else {
result = $.t('connections.download', {path: path});
if (transfer.operation_type === 'upload') {
result += $.t('connections.upload', { path: path });
} else {
result += $.t('connections.download', { path: path });
}
}
}
}
Expand Down

0 comments on commit 10e4843

Please sign in to comment.