diff --git a/package.json b/package.json index 0accecd1..43af1f53 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ ], "main": "index.js", "private": false, - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "repository": { "type": "git", diff --git a/ui/components/RedisStats.js b/ui/components/RedisStats.js index d5b7fe37..ac815c88 100644 --- a/ui/components/RedisStats.js +++ b/ui/components/RedisStats.js @@ -26,41 +26,67 @@ function RedisLogo({ width = 32 }) { ) } +function getMemoryUsage(used_memory, total_system_memory) { + if (!total_system_memory) { + return formatBytes(parseInt(used_memory)) + } + + return `${((used_memory / total_system_memory) * 100).toFixed(2)}%` +} + export default function RedisStats({ stats }) { if (isEmpty(stats)) { return 'No stats to display' } + const { + redis_version, + used_memory, + total_system_memory, + mem_fragmentation_ratio, + connected_clients, + blocked_clients, + } = stats + return (
+
Version -

{stats.redis_version}

+

{redis_version}

+
Memory usage -

- {((stats.used_memory / stats.total_system_memory) * 100).toFixed(2)}% -

- - {formatBytes(parseInt(stats.used_memory))} of{' '} - {formatBytes(parseInt(stats.total_system_memory))} - +

{getMemoryUsage(used_memory, total_system_memory)}

+ {Boolean(total_system_memory) ? ( + + {formatBytes(parseInt(used_memory))} of{' '} + {formatBytes(parseInt(total_system_memory))} + + ) : ( + + Could not retrieve total_system_memory + + )}
+
Fragmentation ratio -

{stats.mem_fragmentation_ratio}

+

{mem_fragmentation_ratio}

+
Connected clients -

{stats.connected_clients}

+

{connected_clients}

+
Blocked clients -

{stats.blocked_clients}

+

{blocked_clients}

) diff --git a/ui/index.css b/ui/index.css index 915e6f34..e1fe4b40 100644 --- a/ui/index.css +++ b/ui/index.css @@ -113,6 +113,12 @@ tr.highlight td { flex-grow: 1; } +.error { + display: flex; + font-weight: 100; + color: #cd5c5c; +} + .menu-list { display: flex; border-bottom: 1px solid #dde;