Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Enhance metrics display with live badge and formatting

Juan Denis99f1cc13eb22
diff --git a/frontend/dist/index.html b/frontend/dist/index.html
index f2297b64..38af6e4d 100644
--- a/frontend/dist/index.html
+++ b/frontend/dist/index.html
@@ -6,8 +6,8 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Dashboard Template</title>
- <script type="module" crossorigin src="/assets/index-wLsYZs2i.js"></script>
- <link rel="stylesheet" crossorigin href="/assets/index-D-CG0J1N.css">
+ <script type="module" crossorigin src="/assets/index-IQpYnTvr.js"></script>
+ <link rel="stylesheet" crossorigin href="/assets/index-BFijD2gh.css">
</head>
<body>
diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx
index ec3dc1f4..7d70162e 100644
--- a/frontend/src/pages/Dashboard.jsx
+++ b/frontend/src/pages/Dashboard.jsx
@@ -133,17 +133,18 @@ const Dashboard = () => {
</div>
</div>
- {/* System Metrics */}
+ {/* System Metrics - Live */}
{metrics && (
<div className="metrics-grid">
<div className="metric-card">
<div className="metric-header">
<Cpu size={16} className="metric-icon" />
<span>CPU</span>
+ <span className="metric-live-badge">Live</span>
</div>
<div className="metric-value-row">
- <span className="metric-value">{metrics.cpu?.percent || 0}%</span>
- <span className="metric-detail">{metrics.cpu?.cores} cores</span>
+ <span className="metric-value">{(metrics.cpu?.percent || 0).toFixed(1)}%</span>
+ <span className="metric-detail">{metrics.cpu?.count_logical || 0} cores</span>
</div>
<div className="metric-bar">
<div
@@ -161,9 +162,10 @@ const Dashboard = () => {
<div className="metric-header">
<MemoryStick size={16} className="metric-icon" />
<span>Memory</span>
+ <span className="metric-live-badge">Live</span>
</div>
<div className="metric-value-row">
- <span className="metric-value">{metrics.memory?.ram?.percent || 0}%</span>
+ <span className="metric-value">{(metrics.memory?.ram?.percent || 0).toFixed(1)}%</span>
<span className="metric-detail">{metrics.memory?.ram?.used_human} / {metrics.memory?.ram?.total_human}</span>
</div>
<div className="metric-bar">
@@ -181,9 +183,10 @@ const Dashboard = () => {
<div className="metric-header">
<HardDrive size={16} className="metric-icon" />
<span>Disk</span>
+ <span className="metric-live-badge">Live</span>
</div>
<div className="metric-value-row">
- <span className="metric-value">{metrics.disk?.partitions?.[0]?.percent || 0}%</span>
+ <span className="metric-value">{(metrics.disk?.partitions?.[0]?.percent || 0).toFixed(1)}%</span>
<span className="metric-detail">{metrics.disk?.partitions?.[0]?.used_human} / {metrics.disk?.partitions?.[0]?.total_human}</span>
</div>
<div className="metric-bar">
@@ -201,6 +204,7 @@ const Dashboard = () => {
<div className="metric-header">
<Activity size={16} className="metric-icon" />
<span>Network</span>
+ <span className="metric-live-badge">Live</span>
</div>
<div className="metric-value-row">
<span className="metric-value">{metrics.network?.io?.bytes_sent_human || '0B'}</span>
diff --git a/frontend/src/styles/pages/_dashboard.less b/frontend/src/styles/pages/_dashboard.less
index 55b6dbbe..71c65724 100644
--- a/frontend/src/styles/pages/_dashboard.less
+++ b/frontend/src/styles/pages/_dashboard.less
@@ -113,6 +113,19 @@
color: @text-tertiary;
font-weight: @font-weight-medium;
}
+
+ .metric-live-badge {
+ margin-left: auto;
+ font-size: 9px;
+ color: @success;
+ background: fade(@success, 15%);
+ padding: 2px 6px;
+ border-radius: @radius-full;
+ font-weight: @font-weight-bold;
+ text-transform: uppercase;
+ letter-spacing: 0.5px;
+ animation: pulse-live 2s ease-in-out infinite;
+ }
}
.metric-value-row {
@@ -514,6 +527,12 @@
}
}
+// Live badge animation
+@keyframes pulse-live {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.5; }
+}
+
// Responsive adjustments
@media (max-width: @breakpoint-md) {
.server-status-bar {