From d7fd44b845bc197f961d4f64e81604127b12e36b Mon Sep 17 00:00:00 2001 From: carlosmonastyrski Date: Fri, 21 Mar 2025 15:06:17 -0300 Subject: [PATCH] Fix secret imports issue on isSecretPresentInEnv validation --- .../SecretOverviewImportListView.tsx | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewImportListView/SecretOverviewImportListView.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewImportListView/SecretOverviewImportListView.tsx index b92ea6dce..e646362b8 100644 --- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewImportListView/SecretOverviewImportListView.tsx +++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewImportListView/SecretOverviewImportListView.tsx @@ -20,16 +20,25 @@ export const SecretOverviewImportListView = ({ const isSecretPresentInEnv = (envSlug: string) => { return allSecretImports.some((item) => { if (item.isReplication) { - const reservedItem = allSecretImports.find((element) => - element.importPath.includes(`__reserve_replication_${item.id}`) - ); - // If the reserved item exists, check if the envSlug matches - if (reservedItem) { - return reservedItem.environment === envSlug; + if ( + item.importPath === secretImport.importPath && + item.importEnv.slug === secretImport.importEnv.slug + ) { + const reservedItem = allSecretImports.find((element) => + element.importPath.includes(`__reserve_replication_${item.id}`) + ); + // If the reserved item exists, check if the envSlug matches + if (reservedItem) { + return reservedItem.environment === envSlug; + } } } else { // If the item is not replication, check if the envSlug matches directly - return item.environment === envSlug; + return ( + item.environment === envSlug && + item.importPath === secretImport.importPath && + item.importEnv.slug === secretImport.importEnv.slug + ); } return false; }); @@ -37,7 +46,7 @@ export const SecretOverviewImportListView = ({ return ( - +