Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

make connectionid mandatory on frontend

adilsonc814c6953da6
diff --git a/frontend/src/hooks/api/migration/queries.tsx b/frontend/src/hooks/api/migration/queries.tsx
index d07ac3eab0..b614bbdde8 100644
--- a/frontend/src/hooks/api/migration/queries.tsx
+++ b/frontend/src/hooks/api/migration/queries.tsx
@@ -95,10 +95,11 @@ export const useGetVaultNamespaces = (connectionId?: string) => {
const { data } = await apiRequest.get<{
namespaces: Array<{ id: string; name: string }>;
}>("/api/v3/external-migration/vault/namespaces", {
- params: connectionId ? { connectionId } : undefined
+ params: { connectionId }
});
return data.namespaces;
- }
+ },
+ enabled: !!connectionId
});
};
@@ -111,13 +112,13 @@ export const useGetVaultPolicies = (enabled = true, namespace?: string, connecti
}>("/api/v3/external-migration/vault/policies", {
params: {
namespace,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.policies;
},
- enabled
+ enabled: enabled && !!connectionId
});
};
@@ -130,13 +131,13 @@ export const useGetVaultMounts = (enabled = true, namespace?: string, connection
}>("/api/v3/external-migration/vault/mounts", {
params: {
namespace,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.mounts;
},
- enabled
+ enabled: enabled && !!connectionId
});
};
@@ -159,13 +160,13 @@ export const useGetVaultSecretPaths = (
params: {
namespace,
mountPath,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.secretPaths;
},
- enabled: enabled && !!namespace && !!mountPath
+ enabled: enabled && !!namespace && !!mountPath && !!connectionId
});
};
@@ -184,13 +185,13 @@ export const useGetVaultAuthMounts = (
params: {
namespace,
...(authType && { authType }),
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.mounts;
},
- enabled
+ enabled: enabled && !!connectionId
});
};
@@ -217,13 +218,13 @@ export const useGetVaultKubernetesAuthRoles = (
params: {
namespace,
mountPath,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.roles;
},
- enabled: enabled && !!namespace && !!mountPath
+ enabled: enabled && !!namespace && !!mountPath && !!connectionId
});
};
@@ -246,13 +247,13 @@ export const useGetVaultKubernetesRoles = (
params: {
namespace,
mountPath,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.roles;
},
- enabled: enabled && !!namespace && !!mountPath
+ enabled: enabled && !!namespace && !!mountPath && !!connectionId
});
};
@@ -275,13 +276,13 @@ export const useGetVaultDatabaseRoles = (
params: {
namespace,
mountPath,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.roles;
},
- enabled: enabled && !!namespace && !!mountPath
+ enabled: enabled && !!namespace && !!mountPath && !!connectionId
});
};
@@ -304,13 +305,13 @@ export const useGetVaultLdapRoles = (
params: {
namespace,
mountPath,
- ...(connectionId ? { connectionId } : {})
+ connectionId
}
});
return data.roles;
},
- enabled: enabled && !!namespace && !!mountPath
+ enabled: enabled && !!namespace && !!mountPath && !!connectionId
});
};
diff --git a/frontend/src/hooks/api/migration/types.ts b/frontend/src/hooks/api/migration/types.ts
index acebf2e39a..39aca20410 100644
--- a/frontend/src/hooks/api/migration/types.ts
+++ b/frontend/src/hooks/api/migration/types.ts
@@ -46,7 +46,7 @@ export type TImportVaultSecretsDTO = {
secretPath: string;
vaultNamespace: string;
vaultSecretPaths: string[];
- connectionId?: string;
+ connectionId: string;
};
export type VaultKubernetesAuthRole = {
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 815c7b4c3b..bc4e6e4044 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -878,7 +878,7 @@ const OverviewPageContent = () => {
const handleVaultImport = async (
vaultPaths: string[],
namespace: string,
- connectionId?: string
+ connectionId: string
) => {
const { status } = await importVaultSecrets({
projectId,
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
index 260ab53f46..43e9860c15 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/ActionBar.tsx
@@ -690,7 +690,7 @@ export const ActionBar = ({
const handleVaultImport = async (
vaultPaths: string[],
namespace: string,
- connectionId?: string
+ connectionId: string
) => {
const { status } = await importVaultSecrets({
projectId,
diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx
index f6f4cf3c51..c35d2466c7 100644
--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx
+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/VaultSecretImportModal.tsx
@@ -24,7 +24,7 @@ type Props = {
environment: string;
secretPath: string;
appConnections: TAvailableAppConnection[];
- onImport: (vaultPaths: string[], namespace: string, connectionId?: string) => void;
+ onImport: (vaultPaths: string[], namespace: string, connectionId: string) => void;
};
type ContentProps = {
@@ -32,7 +32,7 @@ type ContentProps = {
environment: string;
secretPath: string;
appConnections: TAvailableAppConnection[];
- onImport: (vaultPaths: string[], namespace: string, connectionId?: string) => void;
+ onImport: (vaultPaths: string[], namespace: string, connectionId: string) => void;
};
const Content = ({ onClose, environment, secretPath, appConnections, onImport }: ContentProps) => {
@@ -100,13 +100,13 @@ const Content = ({ onClose, environment, secretPath, appConnections, onImport }:
return;
}
- if (!selectedNamespace) {
- createNotification({ type: "error", text: "Please select a namespace" });
+ if (!selectedConnectionId) {
+ createNotification({ type: "error", text: "Please select an app connection" });
return;
}
- if (hasAppConnections && !selectedConnectionId) {
- createNotification({ type: "error", text: "Please select an app connection" });
+ if (!selectedNamespace) {
+ createNotification({ type: "error", text: "Please select a namespace" });
return;
}
@@ -118,7 +118,7 @@ const Content = ({ onClose, environment, secretPath, appConnections, onImport }:
return;
}
- onImport(selectedPaths, selectedNamespace, activeConnectionId);
+ onImport(selectedPaths, selectedNamespace, selectedConnectionId);
onClose();
};