feat: redis base info

pull/3/head
xingyuv 2023-03-23 16:12:24 +08:00
parent 294189e16b
commit fe72d10ff2
2 changed files with 95 additions and 1 deletions

View File

@ -1,3 +1,32 @@
<template>
<div>开发中</div>
<div>
<Description
title="基础信息"
:collapseOptions="{ canExpand: true, helpMessage: 'Redis 基本信息' }"
:column="6"
:data="cacheInfo"
:schema="baseInfoSchema"
/>
</div>
</template>
<script lang="ts" setup name="Redis">
import { Description } from '@/components/Description'
import { baseInfoSchema } from './redis.data'
// import { getCache, getKeyDefineList, getKeyList, getKeyValue, deleteKey, deleteKeys } from '@/api/infra/redis'
import { getCache } from '@/api/infra/redis'
import { ref } from 'vue'
import { onMounted } from 'vue'
const cacheInfo = ref()
const commandStats = ref()
async function getList() {
const res = await getCache()
cacheInfo.value = res.info
commandStats.value = res.commandStats
}
onMounted(async () => {
await getList()
})
</script>

View File

@ -0,0 +1,65 @@
import { DescItem } from '@/components/Description'
export const baseInfoSchema: DescItem[] = [
{
label: 'Redis版本',
field: 'redis_version'
},
{
label: '运行模式',
field: 'redis_mode',
render: (val) => {
return val === 'standalone' ? '单机' : '集群'
}
},
{
label: '端口',
field: 'tcp_port'
},
{
label: '客户端数',
field: 'connected_clients'
},
{
label: '运行时间(天)',
field: 'uptime_in_days'
},
{
label: '使用内存',
field: 'used_memory_human'
},
{
label: '使用CPU',
field: 'tcp_port',
render: (val) => {
return parseFloat(val).toFixed(2)
}
},
{
label: '内存配置',
field: 'maxmemory_human'
},
{
label: 'AOF是否开启',
field: 'maxmemory_human',
render: (val) => {
return val === '0' ? '否' : '是'
}
},
{
label: 'RDB是否成功',
field: 'rdb_last_bgsave_status'
},
{
label: 'Key数量',
field: 'expired_keys'
},
{
label: '网络入口/出口',
field: 'instantaneous_input_kbps',
render: (val, data) => {
console.info(val)
return data.instantaneous_input_kbps + 'kps / ' + data.instantaneous_output_kbps + 'kps'
}
}
]