-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bc2710
commit 5fc76f5
Showing
7 changed files
with
165 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import {inject} from 'vue'; | ||
import {formatSize} from "./size"; | ||
import {useRpc} from "@cordisjs/client"; | ||
const rpc = useRpc(); | ||
const current: any = inject('manager.settings.current') | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-gap-4 flex-col"> | ||
<div class="flex flex-gap-2"> | ||
<div>HTTP <span style="color:green">GET</span> 请求</div> | ||
<div> {{ rpc['stats']?.[current.value.path]?.getCount ?? 0 }} 个 ↑{{formatSize(rpc['stats']?.[current.value.path]?.getCount ?? 0)}} ↓{{formatSize(rpc['stats']?.[current.value.path]?.getCount ?? 0)}}</div> | ||
</div> | ||
<div class="flex flex-gap-2"> | ||
<div>HTTP <span style="color:red">POST</span> 请求</div> | ||
<div> {{ rpc['stats']?.[current.value.path]?.postCount ?? 0 }} 个 ↑{{formatSize(rpc['stats']?.[current.value.path]?.postUpload ?? 0)}} ↓{{formatSize(rpc['stats']?.[current.value.path]?.postDownload ?? 0)}}</div> | ||
</div> | ||
|
||
<div class="flex flex-gap-2"> | ||
<div>HTTP 其他 请求</div> | ||
<div> {{ rpc['stats']?.[current.value.path]?.otherCount ?? 0 }} 个 ↑{{formatSize(rpc['stats']?.[current.value.path]?.otherUpload ?? 0)}} ↓{{formatSize(rpc['stats']?.[current.value.path]?.otherDownload ?? 0)}}</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const SizeFormat = ['', 'K', 'M', 'G', 'T'] | ||
|
||
export function formatSize(number: number) { | ||
return $formatSize(number, 0) + 'B' | ||
} | ||
|
||
function $formatSize(number: number, scale: number) { | ||
if (scale >= SizeFormat.length) { | ||
return number + 'T' | ||
} | ||
if (number < 1024) { | ||
return number + SizeFormat[scale] | ||
} | ||
return $formatSize(number / 1024, scale + 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters