221 lines
8.1 KiB
Bash
221 lines
8.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Script de vérification complète de l'implémentation
|
|
# Fonctionnalité: Disques et Partitions
|
|
|
|
echo "╔════════════════════════════════════════════════════════════════╗"
|
|
echo "║ Vérification de l'implémentation - Disques et Partitions ║"
|
|
echo "╚════════════════════════════════════════════════════════════════╝"
|
|
echo ""
|
|
|
|
# Couleurs
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
# Counters
|
|
total_checks=0
|
|
passed_checks=0
|
|
failed_checks=0
|
|
|
|
check() {
|
|
total_checks=$((total_checks + 1))
|
|
if [ $1 -eq 0 ]; then
|
|
echo -e "${GREEN}✓${NC} $2"
|
|
passed_checks=$((passed_checks + 1))
|
|
else
|
|
echo -e "${RED}✗${NC} $2"
|
|
failed_checks=$((failed_checks + 1))
|
|
fi
|
|
}
|
|
|
|
echo -e "${BLUE}1. Vérification des fichiers créés${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
[ -f "frontend/src/views/DisksView.vue" ]
|
|
check $? "DisksView.vue existe"
|
|
|
|
[ -f "DISKS_FEATURE.md" ]
|
|
check $? "Documentation: DISKS_FEATURE.md"
|
|
|
|
[ -f "DISKS_TROUBLESHOOTING.md" ]
|
|
check $? "Documentation: DISKS_TROUBLESHOOTING.md"
|
|
|
|
[ -f "DISKS_INTEGRATION_GUIDE.md" ]
|
|
check $? "Documentation: DISKS_INTEGRATION_GUIDE.md"
|
|
|
|
[ -f "DISKS_VISUALISÉ.txt" ]
|
|
check $? "Documentation: DISKS_VISUALISÉ.txt"
|
|
|
|
[ -f "DISKS_API_RESPONSE_EXAMPLE.json" ]
|
|
check $? "Documentation: DISKS_API_RESPONSE_EXAMPLE.json"
|
|
|
|
[ -f "test_disks.sh" ]
|
|
check $? "Script de test: test_disks.sh"
|
|
|
|
[ -f "DISKS_MODIFICATIONS_SUMMARY.md" ]
|
|
check $? "Documentation: DISKS_MODIFICATIONS_SUMMARY.md"
|
|
|
|
[ -f "DISKS_USE_CASES.md" ]
|
|
check $? "Documentation: DISKS_USE_CASES.md"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}2. Vérification des fichiers modifiés${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
# Vérifier que les imports ont été ajoutés
|
|
grep -q "import json" backend/app/services/system.py
|
|
check $? "backend/services/system.py: import json"
|
|
|
|
grep -q "import subprocess" backend/app/services/system.py
|
|
check $? "backend/services/system.py: import subprocess"
|
|
|
|
grep -q "class BlockDevice" backend/app/services/system.py
|
|
check $? "backend/services/system.py: BlockDevice class"
|
|
|
|
grep -q "def get_block_devices" backend/app/services/system.py
|
|
check $? "backend/services/system.py: get_block_devices method"
|
|
|
|
grep -q "BlockDevicesInfo" backend/app/api/endpoints/system.py
|
|
check $? "backend/endpoints/system.py: BlockDevicesInfo import"
|
|
|
|
grep -q "def get_block_devices" backend/app/api/endpoints/system.py
|
|
check $? "backend/endpoints/system.py: endpoint /disks"
|
|
|
|
grep -q "DisksView" frontend/src/router/index.js
|
|
check $? "frontend/router/index.js: DisksView import"
|
|
|
|
grep -q "path: '/disks'" frontend/src/router/index.js
|
|
check $? "frontend/router/index.js: /disks route"
|
|
|
|
grep -q "Disques et Partitions" frontend/src/App.vue
|
|
check $? "frontend/App.vue: navigation link"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}3. Vérification de la syntaxe Python${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
if command -v python3 &> /dev/null; then
|
|
python3 -m py_compile backend/app/services/system.py 2>/dev/null
|
|
check $? "backend/services/system.py: syntaxe valide"
|
|
|
|
python3 -m py_compile backend/app/api/endpoints/system.py 2>/dev/null
|
|
check $? "backend/endpoints/system.py: syntaxe valide"
|
|
else
|
|
echo -e "${YELLOW}!${NC} Python3 non trouvé, tests de syntaxe ignorés"
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${BLUE}4. Vérification des prérequis système${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
which lsblk &> /dev/null
|
|
check $? "lsblk disponible (commande système)"
|
|
|
|
command -v npm &> /dev/null
|
|
check $? "npm disponible (frontend)"
|
|
|
|
command -v python3 &> /dev/null
|
|
check $? "python3 disponible (backend)"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}5. Vérification du contenu des fichiers${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
grep -q "percent_used" frontend/src/views/DisksView.vue
|
|
check $? "DisksView.vue: gestion du pourcentage"
|
|
|
|
grep -q "getProgressColor" frontend/src/views/DisksView.vue
|
|
check $? "DisksView.vue: fonction de couleur"
|
|
|
|
grep -q "getProgressBarClass" frontend/src/views/DisksView.vue
|
|
check $? "DisksView.vue: fonction de style"
|
|
|
|
grep -q "refreshInterval" frontend/src/views/DisksView.vue
|
|
check $? "DisksView.vue: auto-refresh"
|
|
|
|
grep -q "30000" frontend/src/views/DisksView.vue
|
|
check $? "DisksView.vue: interval 30s"
|
|
|
|
grep -q "Authorization" frontend/src/views/DisksView.vue
|
|
check $? "DisksView.vue: authentification"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}6. Vérification des modèles de données${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
grep -q "class BlockDevicePartition" backend/app/services/system.py
|
|
check $? "BlockDevicePartition model"
|
|
|
|
grep -q "class BlockDevice" backend/app/services/system.py
|
|
check $? "BlockDevice model"
|
|
|
|
grep -q "class BlockDevicesInfo" backend/app/services/system.py
|
|
check $? "BlockDevicesInfo model"
|
|
|
|
grep -q "response_model=BlockDevicesInfo" backend/app/api/endpoints/system.py
|
|
check $? "Endpoint response model"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}7. Vérification de la structure JSON exemple${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
if command -v jq &> /dev/null; then
|
|
jq . DISKS_API_RESPONSE_EXAMPLE.json > /dev/null 2>&1
|
|
check $? "DISKS_API_RESPONSE_EXAMPLE.json: JSON valide"
|
|
else
|
|
echo -e "${YELLOW}!${NC} jq non trouvé, validation JSON ignorée"
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${BLUE}8. Vérification de la documentation${NC}"
|
|
echo "═════════════════════════════════════════════════════════"
|
|
|
|
[ -s "DISKS_FEATURE.md" ]
|
|
check $? "DISKS_FEATURE.md: non vide"
|
|
|
|
[ -s "DISKS_TROUBLESHOOTING.md" ]
|
|
check $? "DISKS_TROUBLESHOOTING.md: non vide"
|
|
|
|
[ -s "DISKS_INTEGRATION_GUIDE.md" ]
|
|
check $? "DISKS_INTEGRATION_GUIDE.md: non vide"
|
|
|
|
grep -q "lsblk" DISKS_FEATURE.md
|
|
check $? "Documentation: mention de lsblk"
|
|
|
|
grep -q "psutil" DISKS_FEATURE.md
|
|
check $? "Documentation: mention de psutil"
|
|
|
|
echo ""
|
|
echo "════════════════════════════════════════════════════════════"
|
|
echo -e "${BLUE}RÉSUMÉ${NC}"
|
|
echo "════════════════════════════════════════════════════════════"
|
|
echo -e "Total des vérifications: $total_checks"
|
|
echo -e "${GREEN}Réussies: $passed_checks${NC}"
|
|
if [ $failed_checks -gt 0 ]; then
|
|
echo -e "${RED}Échouées: $failed_checks${NC}"
|
|
else
|
|
echo -e "${GREEN}Échouées: $failed_checks${NC}"
|
|
fi
|
|
|
|
echo ""
|
|
if [ $failed_checks -eq 0 ]; then
|
|
echo -e "${GREEN}✓ TOUTES LES VÉRIFICATIONS RÉUSSIES!${NC}"
|
|
echo ""
|
|
echo "Prochaines étapes:"
|
|
echo "1. cd backend && python main.py"
|
|
echo "2. cd frontend && npm run dev"
|
|
echo "3. Naviguer vers http://localhost:5173"
|
|
echo "4. Cliquer sur '💾 Disques et Partitions'"
|
|
echo ""
|
|
exit 0
|
|
else
|
|
echo -e "${RED}✗ CERTAINES VÉRIFICATIONS ONT ÉCHOUÉ${NC}"
|
|
echo ""
|
|
echo "Consultez les erreurs ci-dessus et corrigez les problèmes."
|
|
echo ""
|
|
exit 1
|
|
fi
|