reactor:【infra 基础设施】redis 进一步统一代码风格
This commit is contained in:
@@ -24,8 +24,8 @@ async function loadRedisData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(() => {
|
||||||
await loadRedisData();
|
loadRedisData();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -36,11 +36,9 @@ onMounted(async () => {
|
|||||||
<DocAlert title="本地缓存" url="https://doc.iocoder.cn/local-cache/" />
|
<DocAlert title="本地缓存" url="https://doc.iocoder.cn/local-cache/" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="class=" mt-5>
|
|
||||||
<Card title="Redis 概览">
|
<Card title="Redis 概览">
|
||||||
<Info :redis-data="redisData" />
|
<Info :redis-data="redisData" />
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-5 grid grid-cols-1 gap-4 md:grid-cols-2">
|
<div class="mt-5 grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||||
<Card title="内存使用">
|
<Card title="内存使用">
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ function renderMemoryChart() {
|
|||||||
detail: {
|
detail: {
|
||||||
show: true,
|
show: true,
|
||||||
offsetCenter: [0, '50%'],
|
offsetCenter: [0, '50%'],
|
||||||
color: 'inherit',
|
color: 'auto',
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
formatter: usedMemory,
|
formatter: usedMemory,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ import Memory from './modules/memory.vue';
|
|||||||
const redisData = ref<InfraRedisApi.RedisMonitorInfo>();
|
const redisData = ref<InfraRedisApi.RedisMonitorInfo>();
|
||||||
|
|
||||||
/** 统一加载 Redis 数据 */
|
/** 统一加载 Redis 数据 */
|
||||||
const loadRedisData = async () => {
|
async function loadRedisData() {
|
||||||
try {
|
try {
|
||||||
redisData.value = await getRedisMonitorInfo();
|
redisData.value = await getRedisMonitorInfo();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载 Redis 数据失败', error);
|
console.error('加载 Redis 数据失败', error);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadRedisData();
|
loadRedisData();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const chartRef = ref<EchartsUIType>();
|
|||||||
const { renderEcharts } = useEcharts(chartRef);
|
const { renderEcharts } = useEcharts(chartRef);
|
||||||
|
|
||||||
/** 渲染命令统计图表 */
|
/** 渲染命令统计图表 */
|
||||||
const renderCommandStats = () => {
|
function renderCommandStats() {
|
||||||
if (!props.redisData?.commandStats) {
|
if (!props.redisData?.commandStats) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ const renderCommandStats = () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/** 监听数据变化,重新渲染图表 */
|
/** 监听数据变化,重新渲染图表 */
|
||||||
watch(
|
watch(
|
||||||
@@ -97,7 +97,5 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<EchartsUI ref="chartRef" height="420px" />
|
<EchartsUI ref="chartRef" height="420px" />
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const chartRef = ref<EchartsUIType>();
|
|||||||
const { renderEcharts } = useEcharts(chartRef);
|
const { renderEcharts } = useEcharts(chartRef);
|
||||||
|
|
||||||
/** 解析内存值,移除单位,转为数字 */
|
/** 解析内存值,移除单位,转为数字 */
|
||||||
const parseMemoryValue = (memStr: string | undefined): number => {
|
function parseMemoryValue(memStr: string | undefined): number {
|
||||||
if (!memStr) {
|
if (!memStr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -27,10 +27,10 @@ const parseMemoryValue = (memStr: string | undefined): number => {
|
|||||||
} catch {
|
} catch {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/** 渲染内存使用图表 */
|
/** 渲染内存使用图表 */
|
||||||
const renderMemoryChart = () => {
|
function renderMemoryChart() {
|
||||||
if (!props.redisData?.info) {
|
if (!props.redisData?.info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ const renderMemoryChart = () => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
/** 监听数据变化,重新渲染图表 */
|
/** 监听数据变化,重新渲染图表 */
|
||||||
watch(
|
watch(
|
||||||
@@ -131,7 +131,5 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<EchartsUI ref="chartRef" height="420px" />
|
<EchartsUI ref="chartRef" height="420px" />
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user