Commit Graph

55 Commits

Author SHA1 Message Date
dahoud
e15d717a40 Fix: Correction critique de la boucle OAuth - Empêcher les échanges multiples du code
PROBLÈME RÉSOLU:
- Erreur "Code already used" répétée dans les logs Keycloak
- Boucle infinie de tentatives d'échange du code d'autorisation OAuth
- Utilisateurs bloqués à la connexion

CORRECTIONS APPLIQUÉES:
1. Ajout de useRef pour protéger contre les exécutions multiples
   - hasExchanged.current: Flag pour prévenir les réexécutions
   - isProcessing.current: Protection pendant le traitement

2. Modification des dépendances useEffect
   - AVANT: [searchParams, router] → exécution à chaque changement
   - APRÈS: [] → exécution unique au montage du composant

3. Amélioration du logging
   - Console logs pour debug OAuth flow
   - Messages emoji pour faciliter le suivi

4. Nettoyage de l'URL
   - window.history.replaceState() pour retirer les paramètres OAuth
   - Évite les re-renders causés par les paramètres dans l'URL

5. Gestion d'erreurs améliorée
   - Capture des erreurs JSON du serveur
   - Messages d'erreur plus explicites

FICHIERS AJOUTÉS:
- app/(main)/aide/* - 4 pages du module Aide (documentation, tutoriels, support)
- app/(main)/messages/* - 4 pages du module Messages (inbox, envoyés, archives)
- app/auth/callback/page.tsx.backup - Sauvegarde avant modification

IMPACT:
 Un seul échange de code par authentification
 Plus d'erreur "Code already used"
 Connexion fluide et sans boucle
 Logs propres et lisibles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 23:45:33 +00:00
dahoud
9b55f5219a Fix: Use ARG for NEXT_PUBLIC variables to ensure correct API URL during build
Problem: Frontend was trying to contact http://localhost:8080 instead of
https://api.lions.dev/btpxpress because NEXT_PUBLIC_API_URL wasn't correctly
baked into the Next.js bundle during build.

Solution:
- Added ARG declarations with correct default values for all NEXT_PUBLIC_* variables
- Convert ARG to ENV before running npm run build
- This ensures Next.js bakes the correct values into the bundle
- ARG allows override at docker build time if needed
- Fixed ENV format to use = instead of space (removes Docker warnings)

Variables defined:
- NEXT_PUBLIC_API_URL=https://api.lions.dev/btpxpress
- NEXT_PUBLIC_KEYCLOAK_URL=https://security.lions.dev
- NEXT_PUBLIC_KEYCLOAK_REALM=btpxpress
- NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=btpxpress-frontend
- NEXT_PUBLIC_APP_ENV=production

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 17:46:44 +00:00
dahoud
728b2d31d6 Revert "Fix: Define NEXT_PUBLIC variables explicitly in Dockerfile for build time"
This reverts commit e56e485fcd.
2025-10-25 17:08:34 +00:00
dahoud
e56e485fcd Fix: Define NEXT_PUBLIC variables explicitly in Dockerfile for build time
Added explicit ENV declarations for all NEXT_PUBLIC_* variables in the
builder stage before npm run build. This ensures Next.js correctly bakes
these values into the JavaScript bundle, regardless of lionsctl's
automatic manifest generation.

Variables defined:
- NEXT_PUBLIC_API_URL=https://api.lions.dev/btpxpress
- NEXT_PUBLIC_KEYCLOAK_URL=https://security.lions.dev
- NEXT_PUBLIC_KEYCLOAK_REALM=btpxpress
- NEXT_PUBLIC_KEYCLOAK_CLIENT_ID=btpxpress-frontend
- NEXT_PUBLIC_APP_ENV=production

This fixes the issue where the frontend was using https://api.lions.dev
instead of https://api.lions.dev/btpxpress for API calls.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 16:46:02 +00:00
dahoud
0078301ccc Fix: Autoriser .env.production dans git pour le build Docker
Ajoute !.env.production au .gitignore pour permettre au fichier d'être versionné.
Cela permet au build Docker de copier .env.production et de le charger avec ENV NODE_ENV production.

Fixes the issue where NEXT_PUBLIC_API_URL was not set correctly in production builds.
2025-10-24 08:15:29 +00:00
dahoud
2cf0378270 Fix: Add NODE_ENV=production during Next.js build to load .env.production
Next.js only loads .env.production when NODE_ENV=production is set during build time.
Previously, NODE_ENV was only set in the runner stage, causing the builder stage to
ignore .env.production and use default values.

This fixes NEXT_PUBLIC_API_URL to correctly point to https://api.lions.dev/btpxpress
instead of just https://api.lions.dev.
2025-10-24 08:04:55 +00:00
dahoud
ba82f5b168 Fix: Add .env.production with correct API_URL including /btpxpress path
The frontend now correctly points to https://api.lions.dev/btpxpress
instead of just https://api.lions.dev, which fixes the communication
issue between frontend and backend.

This file is needed at build-time because Next.js bakes NEXT_PUBLIC_*
variables into the bundle during the build process.

Fixes:
- Frontend can now call backend API endpoints correctly
- Resolves 404 errors when making API requests
- Works with Ingress rewrite-target configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 10:36:32 +00:00
dahoud
0e21771b7c Fix: Mise à jour du callback OAuth pour utiliser les cookies HttpOnly
- Suppression du stockage localStorage dans /auth/callback
- Utilisation de window.location.href pour la redirection
- Les tokens sont maintenant gérés uniquement par les cookies HttpOnly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 17:49:49 +00:00
dahoud
418fac529a Fix: Correction de la boucle de redirection OAuth infinie
- Stockage des tokens dans des cookies HttpOnly côté serveur
- Suppression du stockage localStorage côté client
- Modification du middleware pour vérifier les cookies HttpOnly
- Redirection propre après authentification
- Suppression du nettoyage précoce des paramètres URL

Cela corrige le problème où le dashboard se rafraîchissait en boucle
après l'authentification Keycloak.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 12:37:00 +00:00
dahoud
a8825a058b Fix: Corriger toutes les erreurs de build du frontend
- Correction des erreurs TypeScript dans userService.ts et workflowTester.ts
- Ajout des propriétés manquantes aux objets User mockés
- Conversion des dates de string vers objets Date
- Correction des appels asynchrones et des types incompatibles
- Ajout de dynamic rendering pour résoudre les erreurs useSearchParams
- Enveloppement de useSearchParams dans Suspense boundary
- Configuration de force-dynamic au niveau du layout principal

Build réussi: 126 pages générées avec succès

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-18 13:23:08 +00:00
dahoud
c377291608 fix: Explicitly type label as string in statutBodyTemplate 2025-10-16 09:12:14 +00:00
dahoud
20c7bbada3 fix: Explicitly type label as string in typeBodyTemplate 2025-10-16 01:36:51 +00:00
dahoud
0c84ef7874 fix: Explicitly type label as string in typeBodyTemplate 2025-10-16 01:34:15 +00:00
dahoud
6f0c2c09c8 fix: Add selectionMode to DataTable for maintenances 2025-10-16 01:21:59 +00:00
dahoud
514bed1cf3 fix: Add selectionMode to DataTable for materiels 2025-10-15 23:20:38 +00:00
dahoud
8484d4cb27 fix: Add selectionMode to DataTable for materiels 2025-10-15 23:17:01 +00:00
dahoud
515798026d fix: Add tooltip prop to maintenance EditButton and DeleteButton 2025-10-15 23:02:31 +00:00
dahoud
60bc115d27 fix: Add tooltip prop to EditButton and DeleteButton 2025-10-15 22:57:35 +00:00
dahoud
10dba332c2 fix: Replace ActionButton with Button for maintenance action to support event parameter 2025-10-15 22:53:08 +00:00
dahoud
04459d0cfa fix: Change ActionButton color from info/secondary to blue/default 2025-10-15 22:47:59 +00:00
dahoud
d2fb2def34 fix: Remove size prop from Tag components in planning/materiel/page.tsx 2025-10-15 22:34:59 +00:00
dahoud
bd59498155 fix: Add selectionMode to second DataTable in planning/equipes/page.tsx 2025-10-15 21:46:48 +00:00
dahoud
d44657dd5f fix: Add selectionMode to DataTable in planning/equipes/page.tsx 2025-10-15 21:42:05 +00:00
dahoud
c683edb250 fix: Replace timeFormat with hourFormat in Calendar components 2025-10-15 21:37:10 +00:00
dahoud
b5916fbe35 fix: Remove size prop from Tag components 2025-10-15 21:15:05 +00:00
dahoud
d537b0c1c2 fix: Use TypeConflitPlanification and GraviteConflict enums instead of strings 2025-10-15 21:10:33 +00:00
dahoud
9ba1e71041 fix: Convert phase.id to Number for phaseChantierService.resume call 2025-10-15 20:42:19 +00:00
DahoudG
6269c0d096 fix: Change Button size from normal to small 2025-10-15 20:12:57 +00:00
dahoud
bd3c342acd fix: Change Button size from 'normal' to 'small' in phases-chantier/retard/page.tsx 2025-10-15 20:06:40 +00:00
dahoud
aed2ce0182 fix: Resolve TypeScript errors in page.tsx and phases-chantier/page.tsx 2025-10-15 20:01:04 +00:00
dahoud
763ab81da3 fix: Remove incorrect client transformation in factures/page.tsx 2025-10-15 12:51:26 +00:00
dahoud
b0049c8d88 fix: Use typeFacture instead of type and add required Facture fields (dateCreation, dateModification, client) 2025-10-13 19:42:45 +00:00
dahoud
2b6fb084d3 fix: Use StatutFacture and TypeFacture enums instead of string literals 2025-10-13 18:43:23 +00:00
dahoud
bed5c8dced fix: Convert Date to ISO string in Facture state initialization 2025-10-13 18:19:17 +00:00
dahoud
369edac4a3 fix: Convert date strings to Date objects for Calendar component in factures/nouvelle 2025-10-13 18:01:26 +00:00
dahoud
77e6eb2a82 fix: Assign full Devis object instead of just ID in factures/nouvelle 2025-10-13 17:24:52 +00:00
dahoud
f22bfe5760 fix: Revert Date to ISO string conversions for local state objects (they expect Date not string) 2025-10-13 16:30:54 +00:00
dahoud
bb19e2af0d fix: Revert Date conversion for chantierData local state (expects Date not string) 2025-10-13 15:59:04 +00:00
dahoud
1d75cbf580 fix: Convert all remaining Date objects to ISO strings and fix client type in factures/nouvelle 2025-10-13 10:06:05 +00:00
dahoud
7517745505 fix: Convert Date to string for all remaining date fields in stock pages 2025-10-13 09:52:21 +00:00
dahoud
4b19fed103 fix: Convert Date to string for date fields in edit page 2025-10-13 09:50:32 +00:00
dahoud
703b8978fb fix: Convert Date to string for date fields in duplicate page 2025-10-13 08:36:43 +00:00
dahoud
f8796b0831 fix: Convert Date to string for dateEcheance in convert page 2025-10-13 08:30:49 +00:00
dahoud
67ec9bccf3 fix: Convert Date to string for dateEmission in convert page 2025-10-13 08:26:24 +00:00
dahoud
a58ceecd3d fix: Add return true to Chip onRemove handler in parametres page 2025-10-13 08:21:58 +00:00
dahoud
139a2357f4 fix: Update PrimeReact and fix all compilation errors 2025-10-13 07:58:17 +00:00
dahoud
30cad6220b fix: Update PrimeReact to v10.8.3 and fix all compilation errors 2025-10-13 03:01:36 +00:00
dahoud
2a2e54c0e3 fix: Update PrimeReact to v10.8.3 to fix missing modules 2025-10-13 02:59:06 +00:00
dahoud
f2606f8220 fix: Comment out unavailable MeterGroup import 2025-10-02 00:38:14 +00:00
dahoud
ede2fc0645 fix: Fix all newline escapes in attributions page 2025-10-02 00:31:43 +00:00