up
This commit is contained in:
@@ -118,11 +118,32 @@
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import AppLayout from '../components/Layout/AppLayout.vue'
|
||||
|
||||
const stats = ref({
|
||||
totalUsers: 0,
|
||||
activeSessions: 0,
|
||||
systemHealth: 98,
|
||||
uptime: '99.9%'
|
||||
const stats = ref({ totalUsers: 0, activeSessions: 0, systemHealth: 100, uptime: '99.9%' })
|
||||
|
||||
async function loadStats() {
|
||||
try {
|
||||
const [usersRes, sessionsRes, healthRes] = await Promise.all([
|
||||
fetch('/api/admin/users'),
|
||||
fetch('/api/admin/active-sessions'),
|
||||
fetch('/api/health')
|
||||
])
|
||||
const users = await usersRes.json()
|
||||
const sessions = await sessionsRes.json()
|
||||
const health = await healthRes.json()
|
||||
|
||||
stats.value.totalUsers = users.length
|
||||
stats.value.activeSessions = sessions.count || 0
|
||||
|
||||
const upCount = health.checks?.filter(c => c.status === 'UP').length || 0
|
||||
const total = health.checks?.length || 1
|
||||
stats.value.systemHealth = Math.round((upCount / total) * 100)
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadStats()
|
||||
const interval = setInterval(loadStats, 5000)
|
||||
onUnmounted(() => clearInterval(interval))
|
||||
})
|
||||
|
||||
const recentUsers = ref([])
|
||||
|
||||
Reference in New Issue
Block a user