mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
fix(proxy): wrap subscription info usage percentage with toFinite
This commit is contained in:
parent
5402fdb9cb
commit
ed947f62a2
@ -1,5 +1,6 @@
|
|||||||
import byteSize from 'byte-size'
|
import byteSize from 'byte-size'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
import { toFinite } from 'lodash'
|
||||||
import type { SubscriptionInfo as ISubscriptionInfo } from '~/types'
|
import type { SubscriptionInfo as ISubscriptionInfo } from '~/types'
|
||||||
|
|
||||||
const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
|
const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
|
||||||
@ -9,10 +10,10 @@ const getSubscriptionsInfo = (subscriptionInfo: ISubscriptionInfo) => {
|
|||||||
const used = byteSize(Download + Upload, {
|
const used = byteSize(Download + Upload, {
|
||||||
units: 'iec',
|
units: 'iec',
|
||||||
})
|
})
|
||||||
const percentage = (((Download + Upload) / Total) * 100).toFixed(2)
|
const percentage = toFinite((((Download + Upload) / Total) * 100).toFixed(2))
|
||||||
|
|
||||||
const expireStr = () => {
|
const expireStr = () => {
|
||||||
if (subscriptionInfo.Expire === 0) {
|
if (Expire === 0) {
|
||||||
return 'Null'
|
return 'Null'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,6 +422,7 @@ export default () => {
|
|||||||
{(cell) => {
|
{(cell) => {
|
||||||
return (
|
return (
|
||||||
<td
|
<td
|
||||||
|
class="py-2"
|
||||||
onContextMenu={(e) => {
|
onContextMenu={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
|
@ -204,10 +204,10 @@ export default () => {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<For each={table.getRowModel().rows}>
|
<For each={table.getRowModel().rows}>
|
||||||
{(row) => (
|
{(row) => (
|
||||||
<tr class="hover">
|
<tr class="hover:!bg-primary hover:text-primary-content">
|
||||||
<For each={row.getVisibleCells()}>
|
<For each={row.getVisibleCells()}>
|
||||||
{(cell) => (
|
{(cell) => (
|
||||||
<td>
|
<td class="py-2">
|
||||||
{flexRender(
|
{flexRender(
|
||||||
cell.column.columnDef.cell,
|
cell.column.columnDef.cell,
|
||||||
cell.getContext(),
|
cell.getContext(),
|
||||||
|
Loading…
Reference in New Issue
Block a user