From a98bde86d30667fb4973765e1acedc9b5d564221 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Thu, 18 Sep 2025 13:29:15 +0200 Subject: [PATCH] feat: implement project ignore list for Jira synchronization - Updated `JiraConfigForm` to include an input for ignored projects, allowing users to specify projects to exclude from synchronization. - Enhanced `JiraService` with a method to filter out tasks from ignored projects, improving task management. - Modified user preferences to store ignored projects, ensuring persistence across sessions. - Updated API routes to handle ignored projects in configuration, enhancing overall functionality. - Marked the corresponding task as complete in TODO.md. --- TODO.md | 2 +- components/settings/JiraConfigForm.tsx | 56 ++++++++++++++++++- lib/types.ts | 1 + services/jira.ts | 33 ++++++++++- services/user-preferences.ts | 3 +- src/app/api/jira/sync/route.ts | 41 ++++++++++++-- .../api/user-preferences/jira-config/route.ts | 10 +++- 7 files changed, 131 insertions(+), 15 deletions(-) diff --git a/TODO.md b/TODO.md index 103adf6..141e99d 100644 --- a/TODO.md +++ b/TODO.md @@ -147,7 +147,7 @@ ## Autre Todo - [x] Avoir un bouton pour réduire/agrandir la font des taches dans les kanban (swimlane et classique) - [ ] Refactorer les couleurs des priorités dans un seul endroit -- [ ] Settings synchro Jira : ajouter une liste de projet à ignorer, doit etre pris en compte par le service bien sur +- [x] Settings synchro Jira : ajouter une liste de projet à ignorer, doit etre pris en compte par le service bien sur - [ ] Système de sauvegarde automatique base de données - [ ] Sauvegarde automatique toutes les 6 heures (configurable) - [ ] Configuration dans les paramètres (intervalle de temps + bouton sauvegarde manuelle) diff --git a/components/settings/JiraConfigForm.tsx b/components/settings/JiraConfigForm.tsx index e5ef9e5..39447e0 100644 --- a/components/settings/JiraConfigForm.tsx +++ b/components/settings/JiraConfigForm.tsx @@ -11,7 +11,8 @@ export function JiraConfigForm() { const [formData, setFormData] = useState({ baseUrl: '', email: '', - apiToken: '' + apiToken: '', + ignoredProjects: [] as string[] }); const [isSubmitting, setIsSubmitting] = useState(false); const [message, setMessage] = useState<{ type: 'success' | 'error', text: string } | null>(null); @@ -22,7 +23,8 @@ export function JiraConfigForm() { setFormData({ baseUrl: config.baseUrl || '', email: config.email || '', - apiToken: config.apiToken || '' + apiToken: config.apiToken || '', + ignoredProjects: config.ignoredProjects || [] }); } }, [config]); @@ -71,7 +73,8 @@ export function JiraConfigForm() { setFormData({ baseUrl: '', email: '', - apiToken: '' + apiToken: '', + ignoredProjects: [] }); setMessage({ type: 'success', @@ -136,6 +139,20 @@ export function JiraConfigForm() { {config?.apiToken ? '••••••••' : 'Non défini'} +
+ Projets ignorés:{' '} + {config?.ignoredProjects && config.ignoredProjects.length > 0 ? ( +
+ {config.ignoredProjects.map(project => ( + + {project} + + ))} +
+ ) : ( + Aucun + )} +
)} @@ -201,6 +218,39 @@ export function JiraConfigForm() {

+
+ + { + const projects = e.target.value + .split(',') + .map(p => p.trim().toUpperCase()) + .filter(p => p.length > 0); + setFormData(prev => ({ ...prev, ignoredProjects: projects })); + }} + placeholder="DEMO, TEST, SANDBOX" + className="w-full px-3 py-2 border border-[var(--border)] rounded bg-[var(--background)] text-[var(--foreground)] focus:outline-none focus:ring-2 focus:ring-[var(--primary)] focus:border-transparent" + /> +

+ Liste des clés de projets à ignorer lors de la synchronisation, séparées par des virgules (ex: DEMO, TEST, SANDBOX). + Ces projets ne seront pas synchronisés vers TowerControl. +

+ {formData.ignoredProjects.length > 0 && ( +
+ Projets qui seront ignorés: + {formData.ignoredProjects.map(project => ( + + {project} + + ))} +
+ )} +
+