From fa0adfde888d44067dc2b051cd0f7eb84b5a5b8b Mon Sep 17 00:00:00 2001 From: matthieu Date: Tue, 10 Mar 2026 22:19:25 +0100 Subject: [PATCH] refactor(frontend) : extract reusable DataTable component from repeated table markup Replace inline table HTML in 8 files with a shared DataTable component supporting columns definition, scoped slots for custom cells, and built-in delete action. Co-Authored-By: Claude Opus 4.6 --- frontend/components/AdminEffortTab.vue | 48 +++++---------- frontend/components/AdminPriorityTab.vue | 63 +++++++------------ frontend/components/AdminStatusTab.vue | 66 ++++++++------------ frontend/components/AdminTypeTab.vue | 63 +++++++------------ frontend/components/AdminUserTab.vue | 69 ++++++++------------- frontend/components/DataTable.vue | 77 ++++++++++++++++++++++++ frontend/components/ProjectGroupTab.vue | 71 +++++++++------------- frontend/components/ProjectStatusTab.vue | 66 ++++++++------------ frontend/pages/clients.vue | 67 +++++++++------------ 9 files changed, 267 insertions(+), 323 deletions(-) create mode 100644 frontend/components/DataTable.vue diff --git a/frontend/components/AdminEffortTab.vue b/frontend/components/AdminEffortTab.vue index 140c885..ecd0e67 100644 --- a/frontend/components/AdminEffortTab.vue +++ b/frontend/components/AdminEffortTab.vue @@ -10,39 +10,15 @@ -
- - - - - - - - - - - - - - - - -
LibelléActions
{{ item.label }} - -
- Aucun effort trouvé. -
-
+ ([]) const isLoading = ref(true) diff --git a/frontend/components/AdminPriorityTab.vue b/frontend/components/AdminPriorityTab.vue index 1e87bcb..65d78cd 100644 --- a/frontend/components/AdminPriorityTab.vue +++ b/frontend/components/AdminPriorityTab.vue @@ -10,46 +10,22 @@ -
- - - - - - - - - - - - - - - - - - -
LibelléCouleurActions
{{ item.label }} - - - -
- Aucune priorité trouvée. -
-
+ + + ([]) const isLoading = ref(true) diff --git a/frontend/components/AdminStatusTab.vue b/frontend/components/AdminStatusTab.vue index 93c106b..7ce33a1 100644 --- a/frontend/components/AdminStatusTab.vue +++ b/frontend/components/AdminStatusTab.vue @@ -10,48 +10,22 @@ -
- - - - - - - - - - - - - - - - - - - - -
LibelléCouleurPositionActions
{{ item.label }} - - {{ item.position }} - -
- Aucun statut trouvé. -
-
+ + + ([]) const isLoading = ref(true) diff --git a/frontend/components/AdminTypeTab.vue b/frontend/components/AdminTypeTab.vue index 17ae000..e786acf 100644 --- a/frontend/components/AdminTypeTab.vue +++ b/frontend/components/AdminTypeTab.vue @@ -10,46 +10,22 @@ -
- - - - - - - - - - - - - - - - - - -
LibelléCouleurActions
{{ item.label }} - - - -
- Aucun type trouvé. -
-
+ + + ([]) const isLoading = ref(true) diff --git a/frontend/components/AdminUserTab.vue b/frontend/components/AdminUserTab.vue index 8c537d6..861a1e5 100644 --- a/frontend/components/AdminUserTab.vue +++ b/frontend/components/AdminUserTab.vue @@ -10,49 +10,25 @@ -
- - - - - - - - - - - - - - - - - - -
Nom d'utilisateurRôlesActions
{{ item.username }} - - {{ role }} - - - -
- Aucun utilisateur trouvé. -
-
+ + + ([]) const isLoading = ref(true) diff --git a/frontend/components/DataTable.vue b/frontend/components/DataTable.vue new file mode 100644 index 0000000..b430277 --- /dev/null +++ b/frontend/components/DataTable.vue @@ -0,0 +1,77 @@ + + + diff --git a/frontend/components/ProjectGroupTab.vue b/frontend/components/ProjectGroupTab.vue index 44e85c6..457ea8d 100644 --- a/frontend/components/ProjectGroupTab.vue +++ b/frontend/components/ProjectGroupTab.vue @@ -10,50 +10,25 @@ -
- - - - - - - - - - - - - - - - - - - - -
TitreCouleurDescriptionActions
{{ item.title }} - - - {{ item.description ?? '—' }} - - -
- Aucun groupe trouvé. -
-
+ + + + () +import type { DataTableColumn } from '~/components/DataTable.vue' + +const columns: DataTableColumn[] = [ + { key: 'title', label: 'Titre', primary: true }, + { key: 'color', label: 'Couleur' }, + { key: 'description', label: 'Description', class: 'max-w-xs truncate text-neutral-700' }, +] + const { getByProject, remove } = useTaskGroupService() const items = ref([]) const isLoading = ref(true) diff --git a/frontend/components/ProjectStatusTab.vue b/frontend/components/ProjectStatusTab.vue index 40e752a..71804c4 100644 --- a/frontend/components/ProjectStatusTab.vue +++ b/frontend/components/ProjectStatusTab.vue @@ -10,48 +10,22 @@ -
- - - - - - - - - - - - - - - - - - - - -
LibelléCouleurPositionActions
{{ item.label }} - - {{ item.position }} - -
- Aucun statut trouvé. -
-
+ + + () +import type { DataTableColumn } from '~/components/DataTable.vue' + +const columns: DataTableColumn[] = [ + { key: 'label', label: 'Libellé', primary: true }, + { key: 'color', label: 'Couleur' }, + { key: 'position', label: 'Position', class: 'text-neutral-700' }, +] + const statusService = useTaskStatusService() const taskService = useTaskService() diff --git a/frontend/pages/clients.vue b/frontend/pages/clients.vue index f16a9fb..cce2a4a 100644 --- a/frontend/pages/clients.vue +++ b/frontend/pages/clients.vue @@ -10,45 +10,25 @@ -
- - - - - - - - - - - - - - - - - - - - - - -
NomEmailAdresseTéléphone
{{ client.name }}{{ client.email ?? '-' }}{{ formatAddress(client) }}{{ client.phone ?? '-' }} - -
- Aucun client trouvé. -
-
+ + + + + ([]) const isLoading = ref(true)