mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 23:44:22 +00:00
Remove not working stats
This commit is contained in:
@@ -8,8 +8,6 @@ type SystemStats struct {
|
|||||||
TotalUsers int `json:"totalUsers"`
|
TotalUsers int `json:"totalUsers"`
|
||||||
TotalWorkspaces int `json:"totalWorkspaces"`
|
TotalWorkspaces int `json:"totalWorkspaces"`
|
||||||
ActiveUsers int `json:"activeUsers"` // Users with activity in last 30 days
|
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
|
// GetAllUsers returns a list of all users in the system
|
||||||
@@ -66,15 +64,5 @@ func (db *DB) GetSystemStats() (*SystemStats, error) {
|
|||||||
return nil, err
|
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
|
return stats, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,27 +9,10 @@ import {
|
|||||||
Alert,
|
Alert,
|
||||||
RingProgress,
|
RingProgress,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import {
|
import { IconUsers, IconFolders, IconAlertCircle } from '@tabler/icons-react';
|
||||||
IconUsers,
|
|
||||||
IconFolders,
|
|
||||||
IconServer,
|
|
||||||
IconFiles,
|
|
||||||
IconAlertCircle,
|
|
||||||
} from '@tabler/icons-react';
|
|
||||||
import { useAdmin } from '../../../hooks/useAdmin';
|
import { useAdmin } from '../../../hooks/useAdmin';
|
||||||
import StatCard from './StatCard';
|
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 AdminStatsTab = () => {
|
||||||
const { data: stats, loading, error } = useAdmin('stats');
|
const { data: stats, loading, error } = useAdmin('stats');
|
||||||
|
|
||||||
@@ -68,22 +51,6 @@ const AdminStatsTab = () => {
|
|||||||
color="grape"
|
color="grape"
|
||||||
/>
|
/>
|
||||||
</Grid.Col>
|
</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>
|
||||||
|
|
||||||
<Grid mt="md">
|
<Grid mt="md">
|
||||||
|
|||||||
Reference in New Issue
Block a user