Skip to content

Commit 6c2b48f

Browse files
authored
feat: add basic information and styles (#17)
1 parent 1df4114 commit 6c2b48f

File tree

3 files changed

+121
-19
lines changed

3 files changed

+121
-19
lines changed

apps/web-antd/src/locales/langs/en-US/page.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@
5959
"title": {
6060
"used_memory": "Used Memory"
6161
}
62+
},
63+
"info": {
64+
"title": "Basic Info",
65+
"version": "Version",
66+
"mode": "Mode",
67+
"os": "OS",
68+
"arch": "Arch",
69+
"uptime": "Uptime",
70+
"clients": "Connections",
71+
"memory_human": "Allocated Memory",
72+
"connections_received": "Connections Received",
73+
"commands_processed": "Commands Processed",
74+
"rejected_connections": "Rejected Connections",
75+
"keys_command_stats": "Keys Stats",
76+
"role": "Role",
77+
"used_cpu": "Used CPU",
78+
"used_cpu_children": "Used CPU Children",
79+
"keys_num": "Keys Num"
6280
}
6381
}
6482
}

apps/web-antd/src/locales/langs/zh-CN/page.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@
5959
"title": {
6060
"used_memory": "已使用内存"
6161
}
62+
},
63+
"info": {
64+
"title": "基础信息",
65+
"version": "版本",
66+
"mode": "模式",
67+
"os": "操作系统",
68+
"arch": "架构",
69+
"uptime": "运行时间",
70+
"clients": "连接数",
71+
"memory_human": "已分配内存",
72+
"connections_received": "可接受连接数",
73+
"commands_processed": "已执行命令",
74+
"rejected_connections": "已拒绝连接",
75+
"keys_command_stats": "查询次数",
76+
"role": "角色",
77+
"used_cpu": "CPU 消耗",
78+
"used_cpu_children": "后台 CPU 占用",
79+
"keys_num": "Keys 数量"
6280
}
6381
}
6482
}

apps/web-antd/src/views/monitor/redis/index.vue

Lines changed: 85 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,71 @@ const fetchRedisData = async () => {
3232
};
3333
fetchRedisData();
3434
35+
const redisDescriptionItems = computed(() => [
36+
{
37+
label: $t('page.monitor.redis.info.version'),
38+
value: redisInfo.value?.redis_version,
39+
},
40+
{
41+
label: $t('page.monitor.redis.info.os'),
42+
value: redisInfo.value?.os,
43+
},
44+
{
45+
label: $t('page.monitor.redis.info.arch'),
46+
value: redisInfo.value?.arch_bits,
47+
},
48+
{
49+
label: $t('page.monitor.redis.info.mode'),
50+
value: redisInfo.value?.redis_mode,
51+
},
52+
{
53+
label: $t('page.monitor.redis.info.role'),
54+
value: redisInfo.value?.role,
55+
},
56+
{
57+
label: $t('page.monitor.redis.info.memory_human'),
58+
value: redisInfo.value?.used_memory_human,
59+
},
60+
{
61+
label: $t('page.monitor.redis.info.connections_received'),
62+
value: redisInfo.value?.total_connections_received,
63+
},
64+
{
65+
label: $t('page.monitor.redis.info.clients'),
66+
value: redisInfo.value?.blocked_clients,
67+
},
68+
{
69+
label: $t('page.monitor.redis.info.rejected_connections'),
70+
value: redisInfo.value?.rejected_connections,
71+
},
72+
{
73+
label: $t('page.monitor.redis.info.commands_processed'),
74+
value: redisInfo.value?.total_commands_processed,
75+
},
76+
{
77+
label: $t('page.monitor.redis.info.keys_command_stats'),
78+
value:
79+
Number(redisInfo.value?.keyspace_hits) +
80+
Number(redisInfo.value?.keyspace_misses),
81+
},
82+
{
83+
label: $t('page.monitor.redis.info.keys_num'),
84+
value: redisInfo.value?.keys_num,
85+
},
86+
{
87+
label: $t('page.monitor.redis.info.used_cpu'),
88+
value: redisInfo.value?.used_cpu_sys,
89+
},
90+
{
91+
label: $t('page.monitor.redis.info.used_cpu_children'),
92+
value: redisInfo.value?.used_cpu_sys_children,
93+
},
94+
{
95+
label: $t('page.monitor.redis.info.uptime'),
96+
value: redisInfo.value?.uptime_in_seconds,
97+
},
98+
]);
99+
35100
watch(redisInfo, (val) => {
36101
usedMemory.value = Number.parseFloat(
37102
(Number(val.used_memory) / 1024 / 1024).toFixed(2),
@@ -40,36 +105,37 @@ watch(redisInfo, (val) => {
40105
</script>
41106

42107
<template>
43-
<div>
44-
<a-card
45-
:title="$t('page.monitor.redis.desc.title')"
46-
:loading="loading"
47-
class="info-card"
48-
>
49-
<a-descriptions>
50-
<a-descriptions-item label="Test">123</a-descriptions-item>
51-
</a-descriptions>
52-
</a-card>
53-
<a-space style="padding-top: 22px" />
54-
<a-row :gutter="20">
55-
<a-col :span="12">
108+
<div class="container mx-auto p-4">
109+
<div class="mb-2 rounded-lg p-2 shadow-md">
110+
<a-card :title="$t('page.monitor.redis.desc.title')" :loading="loading">
111+
<a-descriptions>
112+
<a-descriptions-item
113+
v-for="item in redisDescriptionItems"
114+
:label="item.label"
115+
:key="item.label"
116+
>
117+
{{ item.value }}
118+
</a-descriptions-item>
119+
</a-descriptions>
120+
</a-card>
121+
</div>
122+
<div class="flex flex-col gap-2 md:flex-row">
123+
<div class="rounded-lg p-2 shadow-md md:w-1/2">
56124
<a-card
57125
:title="$t('page.monitor.redis.cards.commands.title')"
58126
:loading="loading"
59-
class="info-card"
60127
>
61128
<CommandsSeries :stats="redisStats" />
62129
</a-card>
63-
</a-col>
64-
<a-col :span="12">
130+
</div>
131+
<div class="rounded-lg p-2 shadow-md md:w-1/2">
65132
<a-card
66133
:title="$t('page.monitor.redis.cards.memory.title')"
67134
:loading="loading"
68-
class="info-card"
69135
>
70136
<ActiveSeries :memory="redisUsedMemory" />
71137
</a-card>
72-
</a-col>
73-
</a-row>
138+
</div>
139+
</div>
74140
</div>
75141
</template>

0 commit comments

Comments
 (0)