From 87a33ad268324683188fc31de8def24e8ddbcbb8 Mon Sep 17 00:00:00 2001 From: Prabhat Khera Date: Mon, 20 Mar 2023 16:15:55 +1300 Subject: [PATCH] fix error when editiing non-exitent pvc --- app/kubernetes/helpers/application/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/kubernetes/helpers/application/index.js b/app/kubernetes/helpers/application/index.js index f068868db..2b2f71f36 100644 --- a/app/kubernetes/helpers/application/index.js +++ b/app/kubernetes/helpers/application/index.js @@ -397,14 +397,16 @@ class KubernetesApplicationHelper { static generatePersistedFoldersFormValuesFromPersistedFolders(persistedFolders, persistentVolumeClaims) { const finalRes = _.map(persistedFolders, (folder) => { const pvc = _.find(persistentVolumeClaims, (item) => _.startsWith(item.Name, folder.PersistentVolumeClaimName)); - const res = new KubernetesApplicationPersistedFolderFormValue(pvc.StorageClass); - res.PersistentVolumeClaimName = folder.PersistentVolumeClaimName; - res.Size = parseInt(pvc.Storage, 10); - res.SizeUnit = pvc.Storage.slice(-2); - res.ContainerPath = folder.MountPath; - return res; + if (pvc) { + const res = new KubernetesApplicationPersistedFolderFormValue(pvc.StorageClass); + res.PersistentVolumeClaimName = folder.PersistentVolumeClaimName; + res.Size = parseInt(pvc.Storage, 10); + res.SizeUnit = pvc.Storage.slice(-2); + res.ContainerPath = folder.MountPath; + return res; + } }); - return finalRes; + return finalRes.filter((item) => item !== undefined); } static generateVolumesFromPersistentVolumClaims(app, volumeClaims) {