Skip to content

Commit d99636b

Browse files
committed
feat: improve audit table collection labels
- Refactored the audit table component to use a dedicated method for generating collection labels, enhancing readability and maintainability. - Updated the collection options mapping to utilize the new label generation method, ensuring consistent display of collection names.
1 parent db98805 commit d99636b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

apps/web/src/pages/audits/table.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ q-page.container.q-pa-sm
6666
)
6767
template(#body-cell-coll='props')
6868
q-td(:props='props')
69-
q-chip(size='sm' dense color='blue-grey-2' text-color='dark' :label='props.row?.coll || "N/A"')
69+
q-chip(size='sm' dense color='blue-grey-2' text-color='dark' :label='getCollectionLabel(props.row?.coll)')
7070
template(#body-cell-document='props')
7171
q-td(:props='props')
7272
q-chip.bg-positive.text-white.q-pa-sm(
@@ -345,12 +345,23 @@ export default defineNuxtComponent({
345345
},
346346
},
347347
methods: {
348+
getCollectionLabel(value?: string): string {
349+
const labelsByValue: Record<string, string> = {
350+
auth: 'Auth',
351+
Agents: 'Agents',
352+
Identities: 'Identités',
353+
}
354+
return labelsByValue[value || ''] || value || 'N/A'
355+
},
348356
async fetchCollections() {
349357
this.loadingCollections = true
350358
try {
351359
const res = await this.$http.get('/core/audits/collections')
352360
const values: string[] = res?._data?.data || []
353-
this.collectionOptions = values.map((value) => ({ label: value, value }))
361+
this.collectionOptions = values.map((value) => ({
362+
label: this.getCollectionLabel(value),
363+
value,
364+
}))
354365
} catch (error: any) {
355366
this.$q.notify({
356367
message: "Erreur lors du chargement des collections d'audit",

0 commit comments

Comments
 (0)