fix: systeme metrics chart
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue"
|
||||
import { Icon as IconifyIcon } from "@iconify/vue"
|
||||
import backupOptions from "~/server/config/backup-options.json"
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
<script setup>
|
||||
<script setup lang="ts">
|
||||
import {Icon as IconifyIcon} from "@iconify/vue"
|
||||
import { apiFetch } from "~/composables/useApiAuth"
|
||||
|
||||
const { data: messages, error } = await useFetch('/api/discord/messages', {
|
||||
interface DiscordMessage {
|
||||
id: string
|
||||
content: string
|
||||
author: { username: string }
|
||||
}
|
||||
|
||||
const { data: messages, error } = await useFetch<DiscordMessage[]>('/api/discord/messages', {
|
||||
$fetch: apiFetch,
|
||||
server: false
|
||||
})
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from "vue"
|
||||
import {Icon as IconifyIcon} from "@iconify/vue"
|
||||
import { apiRequest } from "~/composables/useApiAuth"
|
||||
|
||||
@@ -66,9 +65,14 @@ async function testDownload() {
|
||||
if (!res.ok) {
|
||||
throw new Error(`HTTP ${res.status}`)
|
||||
}
|
||||
const blob = await res.blob()
|
||||
const end = performance.now()
|
||||
const size = blob.size
|
||||
const reader = res.body!.getReader()
|
||||
let size = 0
|
||||
while (true) {
|
||||
const { done, value } = await reader.read()
|
||||
if (done) break
|
||||
size += value.length
|
||||
}
|
||||
const seconds = (end - start) / 1000
|
||||
download.value = Math.round((size * 8) / seconds / 1000000)
|
||||
}
|
||||
@@ -88,7 +92,7 @@ async function testUpload() {
|
||||
|
||||
async function testPing() {
|
||||
const start = performance.now()
|
||||
const response = await fetch('/api/ping')
|
||||
const response = await apiRequest('/api/ping')
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`)
|
||||
}
|
||||
@@ -47,7 +47,6 @@
|
||||
<script setup lang="ts">
|
||||
import CircleSkeleton from "~/components/skeleton/CircleSkeleton.vue"
|
||||
import TextSkeleton from "~/components/skeleton/TextSkeleton.vue"
|
||||
import {onBeforeUnmount, onMounted, ref} from "vue"
|
||||
import { apiFetch } from "~/composables/useApiAuth"
|
||||
|
||||
interface StatusRow {
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import CircleSkeleton from "~/components/skeleton/CircleSkeleton.vue"
|
||||
import TextSkeleton from "~/components/skeleton/TextSkeleton.vue"
|
||||
import {onBeforeUnmount, onMounted, ref} from "vue"
|
||||
import { apiFetch } from "~/composables/useApiAuth"
|
||||
|
||||
interface StatusRow {
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from "vue"
|
||||
import type { SystemMetrics } from "~/types/system"
|
||||
|
||||
type MetricKey = "cpu" | "ram"
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {computed} from "vue"
|
||||
import type { SystemMetrics } from "~/types/system";
|
||||
|
||||
const props = defineProps<{
|
||||
|
||||
Reference in New Issue
Block a user