1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

improve upload ui (#2780)

This commit is contained in:
杨顺强
2019-01-08 11:26:20 +08:00
committed by Daniel Pan
parent db2d0e01e7
commit 93a2be4ada
5 changed files with 136 additions and 39 deletions

View File

@@ -363,6 +363,24 @@ export const Utils = {
}
},
formatBitRate: function(bits) {
var Bs;
if (typeof bits !== 'number') {
return '';
}
Bs = bits / 8;
if (Bs >= 1000000000) {
return (Bs / 1000000000).toFixed(2) + ' GB/s';
}
if (Bs >= 1000000) {
return (Bs / 1000000).toFixed(2) + ' MB/s';
}
if (Bs >= 1000) {
return (Bs / 1000).toFixed(2) + ' kB/s';
}
return Bs.toFixed(2) + ' B/s';
},
isMarkdownFile: function(filePath) {
let index = filePath.lastIndexOf('.');
if (index === -1) {