Skip to content

Commit 02114ce

Browse files
committed
Mise à jour de l'état de l'identité pour inclure le traitement en cours de synchronisation
1 parent c83eacc commit 02114ce

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/composables/useIdentityStates.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const IdentityStateList = [
2323
{ value: IdentityState.TO_CREATE, text: 'A créer', color: 'grey', icon: 'mdi-circle', display: false},
2424
{ value: IdentityState.TO_COMPLETE, text: 'A compléter', color: 'warning', icon: 'mdi-circle', display: true },
2525
{ value: IdentityState.ON_ERROR, text: 'En erreur', color: 'negative', icon: 'mdi-circle', display: true },
26+
{ value: IdentityState.PROCESSING, text: 'En cours de synchronisation', color: 'warning', icon: 'mdi-loading', display: true },
2627
];
2728

2829
export function useIdentityStates(): useIdentityStateReturnType

src/layouts/default.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ q-layout
4242
q-tooltip.text-body2(anchor="center right" self="center left") A synchroniser
4343
q-badge(color="primary" floating) {{ TO_SYNC }}
4444

45+
q-item(@click="push(`/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.PROCESSING}`)" clickable)
46+
q-item-section(avatar)
47+
q-icon(name="mdi-loading")
48+
q-tooltip.text-body2(anchor="center right" self="center left") En cours de synchronisation
49+
q-badge(color="primary" floating) {{ PROCESSING }}
50+
4551
q-item(@click="push(`/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.SYNCED}`)" clickable)
4652
q-item-section(avatar)
4753
q-icon(name="mdi-check")
@@ -99,6 +105,7 @@ const TO_COMPLETE = computed(() => identityStore.getToCompleteCount > 99 ? '99+'
99105
const TO_VALIDATE = computed(() => identityStore.getToValidateCount > 99 ? '99+' : identityStore.getToValidateCount)
100106
const ON_ERROR = computed(() => identityStore.getOnErrorCount > 99 ? '99+' : identityStore.getOnErrorCount)
101107
const TO_SYNC = computed(() => identityStore.getToSyncCount > 99 ? '99+' : identityStore.getToSyncCount)
108+
const PROCESSING = computed(() => identityStore.getProcessingCount > 99 ? '99+' : identityStore.getProcessingCount)
102109
const SYNCED = computed(() => identityStore.getSyncedCount > 99 ? '99+' : identityStore.getSyncedCount)
103110
104111
const ADM = computed(() => identityAffectationStore.getAdmCount > 9999 ? '9999+' : identityAffectationStore.getAdmCount)

src/stores/identityState.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ export const useIdentityStateStore = defineStore('identityStates', {
77
[IdentityState.TO_VALIDATE]: 0,
88
[IdentityState.ON_ERROR]: 0,
99
[IdentityState.TO_SYNC]: 0,
10+
[IdentityState.PROCESSING]: 0,
1011
[IdentityState.SYNCED]: 0,
1112
}),
1213
getters: {
1314
getToCompleteCount: state => state[IdentityState.TO_COMPLETE],
1415
getToValidateCount: state => state[IdentityState.TO_VALIDATE],
1516
getOnErrorCount: state => state[IdentityState.ON_ERROR],
1617
getToSyncCount: state => state[IdentityState.TO_SYNC],
18+
getProcessingCount: state => state[IdentityState.PROCESSING],
1719
getSyncedCount: state => state[IdentityState.SYNCED],
1820
},
1921
actions: {
@@ -24,6 +26,7 @@ export const useIdentityStateStore = defineStore('identityStates', {
2426
this.fetchToValidateCount(),
2527
this.fetchOnErrorCount(),
2628
this.fetchToSyncCount(),
29+
this.fetchProcessingCount(),
2730
this.fetchSyncedCount(),
2831
]);
2932
} catch (error) {
@@ -62,6 +65,14 @@ export const useIdentityStateStore = defineStore('identityStates', {
6265
console.error(error);
6366
}
6467
},
68+
async fetchProcessingCount() {
69+
try {
70+
const { data } = await useHttp(`/management/identities/count?filters[@state][]=${IdentityState.PROCESSING}&limit=100`);
71+
this[IdentityState.PROCESSING] = data.value.data;
72+
} catch (error) {
73+
console.error(error);
74+
}
75+
},
6576
async fetchSyncedCount() {
6677
try {
6778
const { data } = await useHttp(`/management/identities/count?filters[@state][]=${IdentityState.SYNCED}&limit=100`);

0 commit comments

Comments
 (0)