refact & cleanup : Sidebar, Button, card, EmptyState, Loader, ServiceObject, StatusBadge, UptameObject, BackupWidget, SecurityWidget, ServicesWidget, SupportCtaWidget, UptimeWidget, DashboardLayout

This commit is contained in:
LathanDevers
2026-07-29 22:50:04 +02:00
parent 438d739b1a
commit ec900efe3a
42 changed files with 3357 additions and 3966 deletions
+29
View File
@@ -0,0 +1,29 @@
import { useState, useEffect } from 'react';
import { pb } from '@services/pocketbase';
import type { InfrastructureNode } from '@/types/InfrastructureNode';
export const useInfrastructureNodes = () => {
const [nodes, setNodes] = useState<InfrastructureNode[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const fetchNodes = async () => {
try {
setIsLoading(true);
const records = await pb.collection('aegis_infrastructure_nodes').getFullList<InfrastructureNode>({
sort: 'created',
});
setNodes(records);
} catch (err) {
setError("Impossible de charger l'infrastructure.");
} finally {
setIsLoading(false);
}
};
fetchNodes();
}, []);
return { nodes, isLoading, error };
};