Skip to content

Commit 844c53d

Browse files
Mise à jour des traductions des états et des cycles de vie des identités
1 parent f0a459e commit 844c53d

File tree

2 files changed

+44
-27
lines changed

2 files changed

+44
-27
lines changed

src/composables/useIdentityLifecycle.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,47 @@ export enum IdentityLifecycle {
1818

1919

2020
export const IdentityLifecycleList = [
21-
{ value: IdentityLifecycle.IMPORTED, text: 'Imported', color: '#F0E68C', icon: 'mdi-circle' }, // Khaki
22-
{ value: IdentityLifecycle.OFFICIAL, text: 'Official', color: '#228B22', icon: 'mdi-circle' }, // Forest Green
23-
{ value: IdentityLifecycle.ACTIVE, text: 'Active', color: '#00FF00', icon: 'mdi-circle' }, // Lime
24-
{ value: IdentityLifecycle.PROVISIONAL, text: 'Provisional', color: '#FFD700', icon: 'mdi-circle' }, // Gold
25-
{ value: IdentityLifecycle.INACTIVE, text: 'Inactive', color: '#808080', icon: 'mdi-circle' }, // Gray
26-
{ value: IdentityLifecycle.DELETED, text: 'Deleted', color: '#FF0000', icon: 'mdi-circle' }, // Red
21+
{ value: IdentityLifecycle.IMPORTED, text: 'Importé', color: '#F0E68C', icon: 'mdi-circle', display: true }, // Khaki
22+
{ value: IdentityLifecycle.OFFICIAL, text: 'Officiel', color: '#228B22', icon: 'mdi-circle', display: true }, // Forest Green
23+
{ value: IdentityLifecycle.ACTIVE, text: 'Actif', color: '#00FF00', icon: 'mdi-circle', display: true }, // Lime
24+
{ value: IdentityLifecycle.PROVISIONAL, text: 'Provisoir', color: '#FFD700', icon: 'mdi-circle', display: true }, // Gold
25+
{ value: IdentityLifecycle.INACTIVE, text: 'Inactif', color: '#808080', icon: 'mdi-circle', display: true }, // Gray
26+
{ value: IdentityLifecycle.DELETED, text: 'Supprimé', color: '#FF0000', icon: 'mdi-circle', display: true }, // Red
2727
];
2828

2929
export function useIdentityLifecycles(): useIdentityLifecycleReturnType {
3030
function getLifecycleName(state: number): string {
31-
return IdentityLifecycleList.find(item => item.value === state)?.text || 'Unknown';
31+
const found = IdentityLifecycleList.find(item => item.value === state);
32+
if (found && found?.display) return found.text;
33+
return 'Inconnu';
3234
}
3335

3436
function getLifecycleColor(state: number): string {
35-
return IdentityLifecycleList.find(item => item.value === state)?.color || 'grey';
37+
const found = IdentityLifecycleList.find(item => item.value === state);
38+
if (found && found?.display) return found.color;
39+
return 'grey';
3640
}
3741

3842
function getLifecycleIcon(state: number): string {
39-
return IdentityLifecycleList.find(item => item.value === state)?.icon || 'mdi-circle';
43+
const found = IdentityLifecycleList.find(item => item.value === state);
44+
if (found && found?.display) return found.icon;
45+
return 'mdi-circle';
4046
}
4147

4248
function getLifecycleInfos(state: number): { color: string, name: string, icon: string, value: number }{
43-
const found = IdentityLifecycleList.find(item => item.value === state);
44-
return {
45-
color: found ? found.color : 'grey',
46-
name: found ? found.text : 'Unknown',
47-
icon: found ? found.icon : 'mdi-circle',
48-
value: state
49-
};
49+
const found = IdentityLifecycleList.find(item => item.value === state);
50+
if (found && found?.display) return {
51+
color: found.color,
52+
name: found.text,
53+
icon: found.icon,
54+
value: state
55+
};
56+
return {
57+
color: 'grey',
58+
name: 'Inconnu',
59+
icon: 'mdi-circle',
60+
value: state
61+
};
5062
}
5163

5264

src/composables/useIdentityStates.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,35 @@ export enum IdentityState {
1515
}
1616

1717
export const IdentityStateList = [
18-
{ value: IdentityState.SYNCED, text: 'Synchronized', color: 'info', icon: 'mdi-circle' },
19-
{ value: IdentityState.TO_SYNC, text: 'To sync', color: 'grey', icon: 'mdi-circle' },
20-
{ value: IdentityState.TO_VALIDATE, text: 'To validate', color: 'positive', icon: 'mdi-circle' },
21-
{ value: IdentityState.UNKNOWN, text: 'Unknown', color: 'grey', icon: 'mdi-circle' },
22-
{ value: IdentityState.TO_CREATE, text: 'To create', color: 'grey', icon: 'mdi-circle' },
23-
{ value: IdentityState.TO_COMPLETE, text: 'To complete', color: 'warning', icon: 'mdi-circle' },
24-
{ value: IdentityState.ON_ERROR, text: 'On error', color: 'negative', icon: 'mdi-circle' },
18+
{ value: IdentityState.SYNCED, text: 'Synchronisé', color: 'info', icon: 'mdi-circle', display: true},
19+
{ value: IdentityState.TO_SYNC, text: 'A syncroniser', color: 'info', icon: 'mdi-circle', display: true },
20+
{ value: IdentityState.TO_VALIDATE, text: 'A valider', color: 'positive', icon: 'mdi-circle', display: true },
21+
{ value: IdentityState.UNKNOWN, text: 'Inconnu', color: 'grey', icon: 'mdi-circle', display: true},
22+
{ value: IdentityState.TO_CREATE, text: 'A créer', color: 'grey', icon: 'mdi-circle', display: false},
23+
{ value: IdentityState.TO_COMPLETE, text: 'A compléter', color: 'warning', icon: 'mdi-circle', display: true },
24+
{ value: IdentityState.ON_ERROR, text: 'En erreur', color: 'negative', icon: 'mdi-circle', display: true },
2525
];
2626

2727
export function useIdentityStates(): useIdentityStateReturnType
2828
{
2929
function getStateColor(state: number): string {
30-
return IdentityStateList.find(item => item.value === state)?.color || 'grey';
30+
const found = IdentityStateList.find(item => item.value === state);
31+
if (found && found?.display) return found.color;
32+
return 'grey';
3133
}
3234

3335
function getStateName(state: number): string {
34-
return IdentityStateList.find(item => item.value === state)?.text || 'Unknown';
36+
const found = IdentityStateList.find(item => item.value === state);
37+
if (found && found?.display) return found.text;
38+
return 'Inconnu';
3539
}
3640

3741
function getStateIcon(state: number): string {
38-
return IdentityStateList.find(item => item.value === state)?.icon || 'mdi-circle';
42+
const found = IdentityStateList.find(item => item.value === state);
43+
if (found && found?.display) return found.icon;
44+
return 'mdi-circle';
3945
}
4046

41-
4247
function getStateInfos(state: number): { color: string, name: string, icon: string, value: number }{
4348
const found = IdentityStateList.find(item => item.value === state);
4449
return {

0 commit comments

Comments
 (0)