mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-24 00:20:25 +00:00
WebAdmin active connections: fix active transfer display
Some checks are pending
Code scanning - action / CodeQL-Build (push) Waiting to run
CI / Test and deploy (push) Waiting to run
CI / Test build flags (push) Waiting to run
CI / Test with PgSQL/MySQL/Cockroach (push) Waiting to run
CI / Build Linux packages (push) Waiting to run
CI / golangci-lint (push) Waiting to run
Docker / Build (push) Waiting to run
Some checks are pending
Code scanning - action / CodeQL-Build (push) Waiting to run
CI / Test and deploy (push) Waiting to run
CI / Test build flags (push) Waiting to run
CI / Test with PgSQL/MySQL/Cockroach (push) Waiting to run
CI / Build Linux packages (push) Waiting to run
CI / golangci-lint (push) Waiting to run
Docker / Build (push) Waiting to run
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
21bd8c5660
commit
9ae0bc4ec4
1 changed files with 19 additions and 14 deletions
|
@ -245,22 +245,27 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
|||
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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue