Apply suggestions from code review

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Felix Cornelius
2024-11-19 22:36:05 +01:00
committed by GitHub
parent d08383d759
commit 63e07652a0
2 changed files with 2 additions and 3 deletions

View File

@@ -992,7 +992,7 @@
"argocd": {
"apps": "Apps",
"synced": "Synced",
"outOfSync": "OutOfSync",
"outOfSync": "Out Of Sync",
"healthy": "Healthy",
"degraded": "Degraded",
"progressing": "Progressing",

View File

@@ -20,9 +20,8 @@ export default function Component({ service }) {
if (status === "apps") {
return { status, count: appsData?.items?.length };
}
const apiStatus = status.charAt(0).toUpperCase() + status.slice(1);
const count = appsData?.items?.filter(
(item) => item.status?.sync?.status === apiStatus || item.status?.health?.status === apiStatus,
(item) => item.status?.sync?.status.toLowerCase() === status.toLowerCase() || item.status?.health?.status.toLowerCase() === status.toLowerCase(),
).length;
return { status, count };
});