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.

feat(ui): denser activity tab — inline stats + compact audit-log rows

Juan Denis3dc1943da5a4
diff --git a/frontend/src/components/settings/ActivityTab.jsx b/frontend/src/components/settings/ActivityTab.jsx
index 41251ed2..617b9c2d 100644
--- a/frontend/src/components/settings/ActivityTab.jsx
+++ b/frontend/src/components/settings/ActivityTab.jsx
@@ -1,7 +1,7 @@
import { useState, useEffect } from 'react';
import api from '../../services/api';
import ContributionGraph from './ContributionGraph';
-import { Search, Filter, X, ChevronRight, User as UserIcon, Activity as ActivityIcon, Terminal } from 'lucide-react';
+import { Search, Filter, X, User as UserIcon } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
@@ -90,19 +90,6 @@ const ActivityTab = () => {
});
}
- function getActionIcon(action) {
- if (action.includes('login')) {
- return <UserIcon size={16} />;
- }
- if (action.includes('app') || action.includes('deploy')) {
- return <Terminal size={16} />;
- }
- if (action.includes('setting')) {
- return <ActivityIcon size={16} />;
- }
- return <ChevronRight size={16} />;
- }
-
function getActionClass(action) {
if (action?.includes('failed') || action?.includes('delete') || action?.includes('revoke')) return 'action-danger';
if (action?.includes('create') || action?.includes('enable') || action?.includes('login') || action?.includes('accept')) return 'action-success';
@@ -114,20 +101,14 @@ const ActivityTab = () => {
return action.replace(/\./g, ' ').replace(/_/g, ' ');
}
- function renderDetails(details) {
+ function renderDetailsInline(details) {
if (!details || Object.keys(details).length === 0) return null;
- return (
- <div className="log-details">
- {Object.entries(details).map(([key, value]) => (
- <span key={key} className="detail-item">
- <span className="detail-key">{key}</span>
- <span className="detail-value">
- {typeof value === 'object' ? JSON.stringify(value) : String(value)}
- </span>
- </span>
- ))}
- </div>
- );
+ return Object.entries(details).map(([key, value]) => (
+ <span key={key} className="log-row__detail">
+ <span className="log-row__detail-key">{key}=</span>
+ {typeof value === 'object' ? JSON.stringify(value) : String(value)}
+ </span>
+ ));
}
if (loading) {
@@ -149,19 +130,19 @@ const ActivityTab = () => {
{summary && (
<>
- <div className="activity-summary">
- <div className="activity-stat-card">
- <span className="stat-label">Active Users Today</span>
- <span className="stat-number">{summary.active_users_today}</span>
- </div>
- <div className="activity-stat-card">
- <span className="stat-label">Actions This Week</span>
- <span className="stat-number">{summary.actions_this_week}</span>
- </div>
- <div className="activity-stat-card">
- <span className="stat-label">Total Users</span>
- <span className="stat-number">{summary.total_users}</span>
- </div>
+ <div className="activity-stats">
+ <span className="activity-stats__item">
+ <span className="activity-stats__value">{summary.active_users_today}</span>
+ active today
+ </span>
+ <span className="activity-stats__item">
+ <span className="activity-stats__value">{summary.actions_this_week}</span>
+ actions this week
+ </span>
+ <span className="activity-stats__item">
+ <span className="activity-stats__value">{summary.total_users}</span>
+ total users
+ </span>
</div>
<div className="graphs-section">
@@ -268,32 +249,24 @@ const ActivityTab = () => {
<p>No audit logs found</p>
</div>
) : (
- <div className="audit-log-list">
+ <div className="audit-log-list" role="list">
{logs.map(log => (
- <div key={log.id} className={`log-entry ${getActionClass(log.action)}`}>
- <div className="log-icon">
- {getActionIcon(log.action)}
- </div>
- <div className="log-content">
- <div className="log-header">
- <span className="log-action">{formatActionName(log.action)}</span>
- <span className="log-user">
- {log.username || 'System'}
- </span>
- {log.target_type && (
- <span className="log-target">
- on {log.target_type} {log.target_id ? `#${log.target_id}` : ''}
- </span>
- )}
- <span className="log-time">{formatDate(log.created_at)}</span>
- </div>
- {renderDetails(log.details)}
- {log.ip_address && (
- <div className="log-meta">
- <span className="log-ip">{log.ip_address}</span>
- </div>
- )}
- </div>
+ <div key={log.id} className={`log-row ${getActionClass(log.action)}`} role="listitem">
+ <time className="log-row__time" dateTime={log.created_at}>
+ {formatDate(log.created_at)}
+ </time>
+ <span className="log-row__dot" aria-hidden="true" />
+ <span className="log-row__action">{log.action}</span>
+ <span className="log-row__user">{log.username || 'system'}</span>
+ {log.target_type && (
+ <span className="log-row__target">
+ {log.target_type}{log.target_id ? ` #${log.target_id}` : ''}
+ </span>
+ )}
+ <span className="log-row__meta">
+ {renderDetailsInline(log.details)}
+ {log.ip_address && <span className="log-row__ip">{log.ip_address}</span>}
+ </span>
</div>
))}
</div>
diff --git a/frontend/src/styles/components/_users.scss b/frontend/src/styles/components/_users.scss
index 24148f1f..c7c6fa3e 100644
--- a/frontend/src/styles/components/_users.scss
+++ b/frontend/src/styles/components/_users.scss
@@ -284,141 +284,9 @@
}
}
-.filters-bar {
- display: flex;
- gap: $space-4;
- align-items: flex-end;
- margin-bottom: $space-6;
- padding: $space-4;
- background: $bg-hover;
- border-radius: $radius-md;
-
- .filter-group {
- display: flex;
- flex-direction: column;
- gap: $space-1;
-
- label {
- font-size: $font-size-sm;
- font-weight: 500;
- color: $text-secondary;
- }
-
- select {
- min-width: 180px;
- }
- }
-}
-
-.audit-log-list {
- display: flex;
- flex-direction: column;
- gap: $space-2;
-}
-
-.log-entry {
- display: flex;
- gap: $space-4;
- padding: $space-4;
- background: $bg-card;
- border-radius: $radius-md;
- border-left: 3px solid transparent;
-
- &.action-success {
- border-left-color: $success;
- }
-
- &.action-warning {
- border-left-color: $warning;
- }
-
- &.action-danger {
- border-left-color: $danger;
- }
-
- &.action-info {
- border-left-color: $accent-primary;
- }
-
- .log-icon {
- flex-shrink: 0;
- width: 32px;
- height: 32px;
- display: flex;
- align-items: center;
- justify-content: center;
- background: $bg-hover;
- border-radius: $radius-sm;
- color: $text-secondary;
- }
-
- .log-content {
- flex: 1;
- min-width: 0;
- }
-
- .log-header {
- display: flex;
- flex-wrap: wrap;
- gap: $space-2;
- align-items: center;
- margin-bottom: $space-1;
-
- .log-action {
- font-weight: 500;
- text-transform: capitalize;
- }
-
- .log-user {
- color: $text-secondary;
- font-size: $font-size-sm;
- }
-
- .log-target {
- color: $text-tertiary;
- font-size: $font-size-sm;
- }
- }
-
- .log-details {
- display: flex;
- flex-wrap: wrap;
- gap: $space-2;
- margin-bottom: $space-2;
-
- .detail-item {
- display: inline-flex;
- gap: $space-1;
- padding: 2px $space-2;
- background: $bg-hover;
- border-radius: $radius-sm;
- font-size: $font-size-xs;
-
- .detail-key {
- color: $text-tertiary;
- }
-
- .detail-value {
- color: $text-secondary;
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
-
- .log-meta {
- display: flex;
- gap: $space-4;
- font-size: $font-size-xs;
- color: $text-tertiary;
-
- .log-ip {
- font-family: $font-mono;
- }
- }
-}
+// NOTE: the audit-log / filters styles that previously lived here were a
+// stale duplicate (overridden by the definitions further down). Removed to
+// kill the dead code, including an orphaned colored left-border side-stripe.
.pagination {
display: flex;
@@ -678,46 +546,31 @@
}
}
-.activity-summary {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: $space-6;
- margin-bottom: $space-8;
-
- @media (max-width: 768px) {
- grid-template-columns: 1fr;
- }
-}
-
-.activity-stat-card {
+// Restrained readout strip (replaces the hero-metric stat cards). Reads like
+// the dashboard's server-identity line: mono numbers, muted labels, one row.
+.activity-stats {
display: flex;
- flex-direction: column;
- padding: $space-6;
- background: $bg-card;
- border: 1px solid $border-default;
- border-radius: $radius-lg;
- box-shadow: $shadow-sm;
- transition: transform 0.2s ease, box-shadow 0.2s ease;
-
- &:hover {
- transform: translateY(-2px);
- box-shadow: $shadow-md;
- }
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: $space-3 $space-6;
+ margin-bottom: $space-8;
+ padding-bottom: $space-5;
+ border-bottom: 1px solid $border-subtle;
+ color: $text-tertiary;
+ font-size: $font-size-sm;
- .stat-label {
- font-size: $font-size-sm;
- font-weight: 500;
- color: $text-tertiary;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- margin-bottom: $space-2;
+ &__item {
+ display: inline-flex;
+ align-items: baseline;
+ gap: $space-2;
}
- .stat-number {
- font-size: 2.25rem;
- font-weight: 800;
- color: $accent-primary;
- line-height: 1;
+ &__value {
+ font-family: $font-mono;
+ font-size: $font-size-lg;
+ font-weight: $font-weight-semibold;
+ color: $text-primary;
+ font-variant-numeric: tabular-nums;
}
}
@@ -880,132 +733,99 @@
}
}
+// Dense, scannable audit log (journalctl-style), not a social feed. One row
+// per event inside a single bordered surface with hairline separators.
.audit-log-list {
- display: flex;
- flex-direction: column;
- gap: $space-3;
+ border: 1px solid $border-default;
+ border-radius: $radius-lg;
+ overflow: hidden;
+ background: $bg-card;
}
-.log-entry {
+.log-row {
display: flex;
- gap: $space-5;
- padding: $space-5;
- background: $bg-card;
- border-radius: $radius-lg;
- border: 1px solid $border-default;
- transition: transform 0.2s ease, box-shadow 0.2s ease;
-
- &:hover {
- transform: translateX(4px);
- box-shadow: $shadow-sm;
- border-color: $border-active;
- }
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: $space-2 $space-3;
+ padding: $space-2 $space-4;
+ border-bottom: 1px solid $border-subtle;
+ font-size: $font-size-sm;
+ transition: background-color $transition-fast;
- &.action-success .log-icon { background: fade($success, 10%); color: $success; }
- &.action-warning .log-icon { background: fade($warning, 10%); color: $warning; }
- &.action-danger .log-icon { background: fade($danger, 10%); color: $danger; }
- &.action-info .log-icon { background: fade($accent-primary-raw, 10%); color: $accent-primary; }
+ &:last-child { border-bottom: none; }
- .log-icon {
- flex-shrink: 0;
- width: 42px;
- height: 42px;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: $radius-md;
+ &:hover {
background: $bg-hover;
- color: $text-secondary;
}
- .log-content {
- flex: 1;
- min-width: 0;
+ // Severity reads from the dot color AND the action text, never color alone.
+ .log-row__dot {
+ flex-shrink: 0;
+ align-self: center;
+ width: 7px;
+ height: 7px;
+ border-radius: 50%;
+ background: $text-tertiary;
}
- .log-header {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: $space-2;
- margin-bottom: $space-2;
+ &.action-success .log-row__dot { background: $success; }
+ &.action-warning .log-row__dot { background: $warning; }
+ &.action-danger .log-row__dot { background: $danger; }
+ &.action-info .log-row__dot { background: $accent-primary; }
- .log-action {
- font-weight: 600;
- color: $text-primary;
- text-transform: capitalize;
- font-size: $font-size-md;
- }
+ .log-row__time {
+ flex-shrink: 0;
+ width: 124px;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+ }
- .log-user {
- font-weight: 500;
- color: $accent-primary;
- background: fade($accent-primary-raw, 8%);
- padding: 2px 8px;
- border-radius: $radius-full;
- font-size: $font-size-xs;
- }
+ .log-row__action {
+ font-family: $font-mono;
+ font-weight: $font-weight-medium;
+ color: $text-primary;
+ }
- .log-target {
- color: $text-tertiary;
- font-size: $font-size-sm;
- }
+ .log-row__user {
+ color: $accent-primary;
+ font-weight: $font-weight-medium;
+ white-space: nowrap;
+ }
- .log-time {
- margin-left: auto;
- color: $text-tertiary;
- font-size: $font-size-xs;
- font-weight: 500;
- }
+ .log-row__target {
+ color: $text-tertiary;
+ white-space: nowrap;
}
- .log-details {
- display: flex;
+ .log-row__meta {
+ margin-left: auto;
+ display: inline-flex;
flex-wrap: wrap;
- gap: $space-2;
- margin-top: $space-3;
-
- .detail-item {
- display: inline-flex;
- align-items: center;
- gap: $space-2;
- padding: 4px $space-3;
- background: $bg-hover;
- border: 1px solid $border-default;
- border-radius: $radius-md;
- font-size: $font-size-xs;
-
- .detail-key {
- color: $text-tertiary;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- font-size: 0.7rem;
- }
+ justify-content: flex-end;
+ align-items: baseline;
+ gap: $space-1 $space-3;
+ min-width: 0;
+ font-family: $font-mono;
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ }
- .detail-value {
- color: $text-secondary;
- font-family: $font-mono;
- max-width: 300px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
+ .log-row__detail {
+ color: $text-secondary;
+ max-width: 320px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
- .log-meta {
- margin-top: $space-3;
- display: flex;
- gap: $space-4;
+ .log-row__detail-key {
+ color: $text-tertiary;
+ }
- .log-ip {
- font-size: $font-size-xs;
- color: $text-tertiary;
- background: $bg-hover;
- padding: 2px 6px;
- border-radius: $radius-sm;
- font-family: $font-mono;
- }
+ .log-row__ip {
+ color: $text-tertiary;
}
}