-
This commit is contained in:
@ -41,16 +41,26 @@ const Dashboard: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
// Load applications and tokens data
|
// Load applications
|
||||||
const [appsResponse] = await Promise.all([
|
const appsResponse = await apiService.getApplications(100, 0);
|
||||||
apiService.getApplications(100, 0),
|
|
||||||
]);
|
// Load tokens for each application and count them
|
||||||
|
let totalTokens = 0;
|
||||||
|
for (const app of appsResponse.data) {
|
||||||
|
try {
|
||||||
|
const tokensResponse = await apiService.getTokensForApplication(app.app_id, 100, 0);
|
||||||
|
totalTokens += tokensResponse.count;
|
||||||
|
} catch (error) {
|
||||||
|
// Some apps might not have tokens, that's OK
|
||||||
|
console.debug(`No tokens found for app ${app.app_id}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate stats
|
// Calculate stats
|
||||||
const dashboardStats: DashboardStats = {
|
const dashboardStats: DashboardStats = {
|
||||||
totalApplications: appsResponse.count,
|
totalApplications: appsResponse.count,
|
||||||
totalTokens: 0, // We'd need to aggregate from all apps
|
totalTokens: totalTokens,
|
||||||
recentActivity: 0,
|
recentActivity: 0, // TODO: Could load from audit events
|
||||||
systemHealth: 'healthy',
|
systemHealth: 'healthy',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user