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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

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

View File

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