From 763d3ae76a9b0e7ab43e82682ff74835729d2f5c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 17 Sep 2021 16:46:18 +0200 Subject: [PATCH] web/admin: fix ldap sync status for new API Signed-off-by: Jens Langhammer --- .../charts/LDAPSyncStatusChart.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/web/src/pages/admin-overview/charts/LDAPSyncStatusChart.ts b/web/src/pages/admin-overview/charts/LDAPSyncStatusChart.ts index ae2876448..e904038fe 100644 --- a/web/src/pages/admin-overview/charts/LDAPSyncStatusChart.ts +++ b/web/src/pages/admin-overview/charts/LDAPSyncStatusChart.ts @@ -38,19 +38,21 @@ export class LDAPSyncStatusChart extends AKChart { await Promise.all( sources.results.map(async (element) => { try { - const health = await api.sourcesLdapSyncStatusRetrieve({ + const health = await api.sourcesLdapSyncStatusList({ slug: element.slug, }); - if (health.status !== StatusEnum.Successful) { - failed += 1; - } - const now = new Date().getTime(); - const maxDelta = 3600000; // 1 hour - if (!health || now - health.taskFinishTimestamp.getTime() > maxDelta) { - unsynced += 1; - } else { - healthy += 1; - } + health.forEach(task => { + if (task.status !== StatusEnum.Successful) { + failed += 1; + } + const now = new Date().getTime(); + const maxDelta = 3600000; // 1 hour + if (!health || now - task.taskFinishTimestamp.getTime() > maxDelta) { + unsynced += 1; + } else { + healthy += 1; + } + }) } catch { unsynced += 1; }