Skip to content

Commit c90051c

Browse files
committed
fix: update lifecycle column rendering and remove unused cycle conversion function
1 parent 235f2b0 commit c90051c

File tree

1 file changed

+17
-60
lines changed

1 file changed

+17
-60
lines changed

src/pages/lifecycles/table.vue

Lines changed: 17 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
:key="col.name"
2929
:props="props"
3030
)
31-
template(v-if="col.name === 'identity'")
31+
template(v-if="col.name === 'lifecycle'")
32+
q-icon(:name="getLifecycleIcon(props.row.lifecycle)" :color="getLifecycleColor(props.row.lifecycle)" :style='{color: getLifecycleColor(props?.row?.lifecycle).startsWith("#") ? getLifecycleColor(props?.row?.lifecycle) : "inherit"}' left)
33+
span {{ getLifecycleName(props.row.lifecycle) }}  
34+
small(v-text="'(' + props.row?.lifecycle + ')'")
35+
template(v-else-if="col.name === 'identity'")
3236
q-chip(
3337
href='javascript:void(0)'
3438
v-if="props.row?.refId?.inetOrgPerson?.cn"
@@ -59,25 +63,6 @@
5963

6064
<script lang="ts">
6165
import dayjs from 'dayjs'
62-
import { IdentityLifecycle } from '~/composables/useIdentityLifecycle'
63-
64-
// Helper function to convert cycle to text
65-
function cycleToText(cycle: string): string {
66-
switch (cycle) {
67-
case IdentityLifecycle.DELETED:
68-
return 'Suppression'
69-
case IdentityLifecycle.INACTIVE:
70-
return 'Inactif'
71-
case IdentityLifecycle.PROVISIONAL:
72-
return 'Provisionnel'
73-
case IdentityLifecycle.ACTIVE:
74-
return 'Actif'
75-
case IdentityLifecycle.OFFICIAL:
76-
return 'Officiel'
77-
default:
78-
return 'Inconnu'
79-
}
80-
}
8166
8267
export default {
8368
name: 'LifecyclesTablePage',
@@ -86,38 +71,26 @@ export default {
8671
filter: ref(''),
8772
expanded: ref<any[]>([]),
8873
columns: [
89-
{
90-
name: 'identity',
91-
align: 'left',
92-
label: 'Identité(e)',
93-
field: (row) => row?.refId || {},
94-
sortable: true,
95-
},
74+
{ name: 'identity', align: 'left', label: 'Identité(e)', field: (row) => row?.refId || {}, sortable: true },
9675
{
9776
name: 'lifecycle',
9877
required: true,
9978
label: 'Cycle déclanché',
10079
align: 'left',
10180
field: (row) => row.lifecycle,
102-
format: (lifecycle) => cycleToText(lifecycle),
81+
// format: (lifecycle) => getLifecycleName(lifecycle),
10382
sortable: false,
10483
},
105-
{
106-
name: 'date',
107-
required: true,
108-
label: 'Date',
109-
align: 'left',
110-
field: (row) => row.date,
111-
format: (date) => `${dayjs(date).format('DD/MM/YYYY HH:mm:ss')}`,
112-
sortable: true,
113-
},
84+
{ name: 'date', required: true, label: 'Date', align: 'left', field: (row) => row.date, format: (date) => `${dayjs(date).format('DD/MM/YYYY HH:mm:ss')}`, sortable: true },
11485
],
11586
}
11687
},
11788
async setup() {
11889
const route = useRoute()
11990
const router = useRouter()
12091
92+
const { getLifecycleName, getLifecycleIcon, getLifecycleColor } = await useIdentityLifecycles()
93+
12194
const pagination = ref({
12295
sortBy: 'desc',
12396
descending: false,
@@ -127,12 +100,7 @@ export default {
127100
})
128101
129102
const query = computed(() => {
130-
return {
131-
page: pagination.value.page,
132-
limit: pagination.value.rowsPerPage,
133-
'sort[date]': 'desc',
134-
...route.query,
135-
}
103+
return { page: pagination.value.page, limit: pagination.value.rowsPerPage, 'sort[date]': 'desc', ...route.query }
136104
})
137105
138106
const {
@@ -158,6 +126,10 @@ export default {
158126
return {
159127
pagination,
160128
129+
getLifecycleName,
130+
getLifecycleIcon,
131+
getLifecycleColor,
132+
161133
rows,
162134
pending,
163135
error,
@@ -171,30 +143,15 @@ export default {
171143
return this.$q.dark.isActive
172144
},
173145
monacoOptions() {
174-
return {
175-
theme: this.isDark ? 'vs-dark' : 'vs-light',
176-
readOnly: true,
177-
minimap: {
178-
enabled: true,
179-
},
180-
scrollBeyondLastColumn: 0,
181-
scrollBeyondLastLine: false,
182-
}
146+
return { theme: this.isDark ? 'vs-dark' : 'vs-light', readOnly: true, minimap: { enabled: true }, scrollBeyondLastColumn: 0, scrollBeyondLastLine: false }
183147
},
184148
},
185149
methods: {
186150
async onRequest(props) {
187151
const { page, rowsPerPage: limit, sortBy, descending } = props.pagination
188152
const filter = props.filter
189153
190-
console.log('Requesting data with:', {
191-
page,
192-
limit,
193-
sortBy,
194-
descending,
195-
filter,
196-
props,
197-
})
154+
console.log('Requesting data with:', { page, limit, sortBy, descending, filter, props })
198155
199156
await this.router.replace({
200157
query: {

0 commit comments

Comments
 (0)