From c81a55d83ff876a8de4c977a3103cf4eea9ff6d5 Mon Sep 17 00:00:00 2001
From: jingyang <72259332+zjy365@users.noreply.github.com>
Date: Mon, 2 Sep 2024 14:27:23 +0800
Subject: [PATCH] fix: resolve desktop monitoring issue (#5019)
---
frontend/desktop/src/components/signin/index.tsx | 2 +-
.../desktop/src/pages/api/desktop/getResource.ts | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/frontend/desktop/src/components/signin/index.tsx b/frontend/desktop/src/components/signin/index.tsx
index 16f95a1e1870..bbf3d104c751 100644
--- a/frontend/desktop/src/components/signin/index.tsx
+++ b/frontend/desktop/src/components/signin/index.tsx
@@ -241,7 +241,7 @@ export default function SigninComponent() {
? (t('common:loading') || 'Loading') + '...'
: t('common:log_in') || 'Log In'}
- {hasBaiduToken && getBaiduId() ? : }
+
>
)}
diff --git a/frontend/desktop/src/pages/api/desktop/getResource.ts b/frontend/desktop/src/pages/api/desktop/getResource.ts
index 6610b06e02df..f8dc202a7f2e 100644
--- a/frontend/desktop/src/pages/api/desktop/getResource.ts
+++ b/frontend/desktop/src/pages/api/desktop/getResource.ts
@@ -48,11 +48,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
for (const volume of pod.spec.volumes) {
if (!volume.persistentVolumeClaim?.claimName) continue;
const pvcName = volume.persistentVolumeClaim.claimName;
- const pvc = await kc
- .makeApiClient(k8s.CoreV1Api)
- .readNamespacedPersistentVolumeClaim(pvcName, namespace);
- const storage = pvc?.body?.spec?.resources?.requests?.storage || '0';
- totalStorageRequests += parseResourceValue(storage);
+ try {
+ const pvc = await kc
+ .makeApiClient(k8s.CoreV1Api)
+ .readNamespacedPersistentVolumeClaim(pvcName, namespace);
+ const storage = pvc?.body?.spec?.resources?.requests?.storage || '0';
+ totalStorageRequests += parseResourceValue(storage);
+ } catch (error) {}
}
}