From 8ae8be8e49fa3681ccf405109c363e5433573938 Mon Sep 17 00:00:00 2001 From: xingyuv Date: Thu, 23 Mar 2023 17:30:40 +0800 Subject: [PATCH] feat: redis view --- src/views/infra/redis/components/Memory.vue | 10 ++++------ src/views/infra/redis/index.vue | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/views/infra/redis/components/Memory.vue b/src/views/infra/redis/components/Memory.vue index 32a481e..ac591f1 100644 --- a/src/views/infra/redis/components/Memory.vue +++ b/src/views/infra/redis/components/Memory.vue @@ -11,7 +11,7 @@ import { propTypes } from '@/utils/propTypes' const props = defineProps({ loading: Boolean, - cacheInfo: Object, + memoryHuman: String, width: propTypes.string.def('100%'), height: propTypes.string.def('300px') }) @@ -19,8 +19,6 @@ const props = defineProps({ const chartRef = ref(null) const { setOptions } = useECharts(chartRef as Ref) -const optionsData = ref(props.cacheInfo) - watch( () => props.loading, () => { @@ -29,7 +27,7 @@ watch( } setOptions({ tooltip: { - formatter: '{b}
{a} : ' + optionsData.value.used_memory_human + formatter: '{b}
{a} : ' + props.memoryHuman }, series: [ { @@ -38,11 +36,11 @@ watch( min: 0, max: 100, detail: { - formatter: optionsData.value.used_memory_human + formatter: props.memoryHuman }, data: [ { - value: parseFloat(optionsData.value.used_memory_human), + value: parseFloat(props.memoryHuman as unknown as number), name: '内存消耗' } ] diff --git a/src/views/infra/redis/index.vue b/src/views/infra/redis/index.vue index a7f2ae7..d572989 100644 --- a/src/views/infra/redis/index.vue +++ b/src/views/infra/redis/index.vue @@ -9,7 +9,7 @@ />
- +
@@ -27,10 +27,12 @@ const Memory = createAsyncComponent(() => import('./components/Memory.vue')) const loading = ref(true) const cacheInfo = ref() const commandStats = ref([]) +const memoryHuman = ref() async function getList() { const res = await getCache() cacheInfo.value = res.info + memoryHuman.value = res.info.used_memory_human await res.commandStats.forEach((val) => { commandStats.value.push({ name: val.command, value: val.calls }) })