From 179bccfcd08cf471e819bd9f0c425db19431a836 Mon Sep 17 00:00:00 2001 From: SanjalKatiyar Date: Tue, 19 Sep 2023 19:09:03 +0530 Subject: [PATCH] fix StorageClass filtering for add capacity modal --- packages/odf/modals/add-capacity/add-capacity-modal.tsx | 6 +++--- packages/odf/utils/ocs.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/odf/modals/add-capacity/add-capacity-modal.tsx b/packages/odf/modals/add-capacity/add-capacity-modal.tsx index 8139dcb00..7225dd3d7 100644 --- a/packages/odf/modals/add-capacity/add-capacity-modal.tsx +++ b/packages/odf/modals/add-capacity/add-capacity-modal.tsx @@ -78,7 +78,7 @@ type StorageClassDropdownProps = { onChange: any; 'data-test': string; initialSelection: (args) => any; - filter: (resource: StorageClassResourceKind) => boolean; + filter: (resource: StorageClassResourceKind) => StorageClassResourceKind; }; const StorageClassDropdown: React.FC = ({ @@ -275,10 +275,10 @@ export const AddCapacityModal: React.FC = ({ (item) => getName(item) === installStorageClass ); if (initialSC?.provisioner === NO_PROVISIONER) { - return sc.provisioner === NO_PROVISIONER; + return sc.provisioner === NO_PROVISIONER ? sc : undefined; } } - return true; + return sc; }, [installStorageClass, scResources, scResourcesLoadError, scResourcesLoaded] ); diff --git a/packages/odf/utils/ocs.ts b/packages/odf/utils/ocs.ts index 8cd78c2f9..a2b59cc6c 100644 --- a/packages/odf/utils/ocs.ts +++ b/packages/odf/utils/ocs.ts @@ -195,6 +195,7 @@ export const getDeviceSetCount = (pvCount: number, replica: number): number => Math.floor(pvCount / replica) || 1; export const filterSC = (sc: StorageClassResourceKind) => + !!sc && !OCS_PROVISIONERS.some((ocsProvisioner: string) => sc?.provisioner?.includes(ocsProvisioner) );