feat : ajout download backup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="bg-m-secondary w-[509px] h-[184px] mx-4 rounded-md shadow-md/50 shadow-black p-2">
|
||||
<div class="bg-m-secondary w-[507px] h-[184px] mx-4 rounded-md shadow-md/50 shadow-black p-2">
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<p class="font-bold text-3xl text-m-tertiary">
|
||||
Speedtest
|
||||
@@ -7,7 +7,7 @@
|
||||
<IconifyIcon
|
||||
icon="mdi:reload"
|
||||
class="bg-m-tertiary text-2xl text-black rounded-md shadow-md/50 mr-1 cursor-pointer"
|
||||
@Click="runTests"
|
||||
@click="runTests"
|
||||
/>
|
||||
</div>
|
||||
<div class="grid grid-cols-3 gap-3">
|
||||
@@ -22,8 +22,11 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="mx-2 flex flex-col items-center justify-center">
|
||||
<span class="text-4xl">
|
||||
{{ download !== null ? `${download}` : "..." }}
|
||||
<template v-if="isTesting">
|
||||
<TextSkeleton custom-class="h-10 w-16 mb-1" />
|
||||
</template>
|
||||
<span v-else class="text-4xl">
|
||||
{{ download !== null ? `${download}` : "--" }}
|
||||
</span>
|
||||
<p class="font-bold text-xl leading-tight">
|
||||
Mbps
|
||||
@@ -41,8 +44,11 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="mx-2 flex flex-col items-center justify-center">
|
||||
<span class="text-4xl">
|
||||
{{ upload !== null ? `${upload}` : "..." }}
|
||||
<template v-if="isTesting">
|
||||
<TextSkeleton custom-class="h-10 w-16 mb-1" />
|
||||
</template>
|
||||
<span v-else class="text-4xl">
|
||||
{{ upload !== null ? `${upload}` : "--" }}
|
||||
</span>
|
||||
<p class="font-bold text-xl leading-tight">
|
||||
Mbps
|
||||
@@ -60,8 +66,11 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="mx-2 flex flex-col items-center justify-center">
|
||||
<span class="text-4xl">
|
||||
{{ ping !== null ? `${ping}` : "..." }}
|
||||
<template v-if="isTesting">
|
||||
<TextSkeleton custom-class="h-10 w-16 mb-1" />
|
||||
</template>
|
||||
<span v-else class="text-4xl">
|
||||
{{ ping !== null ? `${ping}` : "--" }}
|
||||
</span>
|
||||
<p class="font-bold text-xl leading-tight">
|
||||
Ms
|
||||
@@ -72,12 +81,14 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {onMounted, ref} from "vue";
|
||||
import {ref} from "vue";
|
||||
import {Icon as IconifyIcon} from "@iconify/vue"
|
||||
import TextSkeleton from "~/components/skeleton/TextSkeleton.vue"
|
||||
|
||||
const ping = ref<number | null>(null)
|
||||
const download = ref<number | null>(null)
|
||||
const upload = ref<number | null>(null)
|
||||
const isTesting = ref(false)
|
||||
|
||||
async function testDownload() {
|
||||
const start = performance.now()
|
||||
@@ -121,11 +132,17 @@ async function testPing() {
|
||||
}
|
||||
|
||||
async function runTests() {
|
||||
await testDownload()
|
||||
await testUpload()
|
||||
await testPing()
|
||||
isTesting.value = true
|
||||
download.value = null
|
||||
upload.value = null
|
||||
ping.value = null
|
||||
|
||||
try {
|
||||
await testDownload()
|
||||
await testUpload()
|
||||
await testPing()
|
||||
} finally {
|
||||
isTesting.value = false
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
runTests()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user