mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 15:44:21 +00:00
Remove not working stats
This commit is contained in:
@@ -8,8 +8,6 @@ type SystemStats struct {
|
||||
TotalUsers int `json:"totalUsers"`
|
||||
TotalWorkspaces int `json:"totalWorkspaces"`
|
||||
ActiveUsers int `json:"activeUsers"` // Users with activity in last 30 days
|
||||
StorageUsed int `json:"storageUsed"` // Total storage used in bytes
|
||||
TotalFiles int `json:"totalFiles"` // Total number of files across all workspaces
|
||||
}
|
||||
|
||||
// GetAllUsers returns a list of all users in the system
|
||||
@@ -66,15 +64,5 @@ func (db *DB) GetSystemStats() (*SystemStats, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get total files and storage used
|
||||
// Note: This assumes you're tracking file sizes in your filesystem
|
||||
err = db.QueryRow(`
|
||||
SELECT COUNT(*), COALESCE(SUM(size), 0)
|
||||
FROM files`).
|
||||
Scan(&stats.TotalFiles, &stats.StorageUsed)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
@@ -9,27 +9,10 @@ import {
|
||||
Alert,
|
||||
RingProgress,
|
||||
} from '@mantine/core';
|
||||
import {
|
||||
IconUsers,
|
||||
IconFolders,
|
||||
IconServer,
|
||||
IconFiles,
|
||||
IconAlertCircle,
|
||||
} from '@tabler/icons-react';
|
||||
import { IconUsers, IconFolders, IconAlertCircle } from '@tabler/icons-react';
|
||||
import { useAdmin } from '../../../hooks/useAdmin';
|
||||
import StatCard from './StatCard';
|
||||
|
||||
const formatBytes = (bytes) => {
|
||||
const units = ['B', 'KB', 'MB', 'GB'];
|
||||
let size = bytes;
|
||||
let unitIndex = 0;
|
||||
while (size >= 1024 && unitIndex < units.length - 1) {
|
||||
size /= 1024;
|
||||
unitIndex++;
|
||||
}
|
||||
return `${size.toFixed(1)} ${units[unitIndex]}`;
|
||||
};
|
||||
|
||||
const AdminStatsTab = () => {
|
||||
const { data: stats, loading, error } = useAdmin('stats');
|
||||
|
||||
@@ -68,22 +51,6 @@ const AdminStatsTab = () => {
|
||||
color="grape"
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={{ base: 12, md: 6, lg: 3 }}>
|
||||
<StatCard
|
||||
title="Storage Used"
|
||||
value={formatBytes(stats.storageUsed)}
|
||||
icon={IconServer}
|
||||
color="teal"
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={{ base: 12, md: 6, lg: 3 }}>
|
||||
<StatCard
|
||||
title="Total Files"
|
||||
value={stats.totalFiles}
|
||||
icon={IconFiles}
|
||||
color="orange"
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Grid mt="md">
|
||||
|
||||
Reference in New Issue
Block a user