mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
Merge pull request #8 from xAlokyx/copilot/update-overall-speed-display
feat: Change Overall Speed display from MB/s to Mb/s
This commit is contained in:
commit
036c509173
2 changed files with 12 additions and 2 deletions
|
|
@ -591,6 +591,16 @@ class SizeFormatter {
|
|||
if (size < this.ONE_PB) return (size / this.ONE_TB).toFixed(2) + " TB";
|
||||
return (size / this.ONE_PB).toFixed(2) + " PB";
|
||||
}
|
||||
|
||||
static bitFormat(size) {
|
||||
const bits = size * 8;
|
||||
if (bits <= 0) return "0 b";
|
||||
if (bits < 1000) return bits.toFixed(0) + " b";
|
||||
if (bits < 1000000) return (bits / 1000).toFixed(2) + " Kb";
|
||||
if (bits < 1000000000) return (bits / 1000000).toFixed(2) + " Mb";
|
||||
if (bits < 1000000000000) return (bits / 1000000000).toFixed(2) + " Gb";
|
||||
return (bits / 1000000000000).toFixed(2) + " Tb";
|
||||
}
|
||||
}
|
||||
|
||||
class CPUFormatter {
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@
|
|||
<a-row :gutter="isMobile ? [8,8] : 0">
|
||||
<a-col :span="12">
|
||||
<a-custom-statistic title='{{ i18n "pages.index.upload" }}'
|
||||
:value="SizeFormatter.sizeFormat(status.netIO.up)">
|
||||
:value="SizeFormatter.bitFormat(status.netIO.up)">
|
||||
<template #prefix>
|
||||
<a-icon type="arrow-up" />
|
||||
</template>
|
||||
|
|
@ -216,7 +216,7 @@
|
|||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-custom-statistic title='{{ i18n "pages.index.download" }}'
|
||||
:value="SizeFormatter.sizeFormat(status.netIO.down)">
|
||||
:value="SizeFormatter.bitFormat(status.netIO.down)">
|
||||
<template #prefix>
|
||||
<a-icon type="arrow-down" />
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in a new issue