fix: support filtering imported secrets in singl env view

This commit is contained in:
Scott Wilson
2025-07-07 18:06:09 -07:00
parent 0191eb48f3
commit d2e6743f22
2 changed files with 26 additions and 16 deletions
@@ -732,8 +732,8 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
actorOrgId: req.permission.orgId, actorOrgId: req.permission.orgId,
projectId, projectId,
environment, environment,
path: secretPath, path: secretPath
search // search scott: removing for now because this prevents searching imported secrets which are fetched separately client side
}); });
if (remainingLimit > 0 && totalImportCount > adjustedOffset) { if (remainingLimit > 0 && totalImportCount > adjustedOffset) {
@@ -745,7 +745,7 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
projectId, projectId,
environment, environment,
path: secretPath, path: secretPath,
search, // search scott: removing for now because this prevents searching imported secrets which are fetched separately client side
limit: remainingLimit, limit: remainingLimit,
offset: adjustedOffset offset: adjustedOffset
}); });
@@ -9,6 +9,7 @@ import {
faInfoCircle, faInfoCircle,
faKey, faKey,
faRotate, faRotate,
faSearch,
faUpDown, faUpDown,
faWarning, faWarning,
faXmark faXmark
@@ -140,6 +141,10 @@ export const SecretImportItem = ({
} }
}; };
const filteredImportedSecrets = importedSecrets.filter((secret) =>
secret.key.toUpperCase().includes(searchTerm.toUpperCase())
);
return ( return (
<> <>
<div <div
@@ -305,9 +310,14 @@ export const SecretImportItem = ({
</td> </td>
</tr> </tr>
)} )}
{importedSecrets {filteredImportedSecrets.length === 0 && importedSecrets?.length !== 0 && (
.filter((secret) => secret.key.toUpperCase().includes(searchTerm.toUpperCase())) <tr>
.map(({ key, value }, index) => ( <td colSpan={3}>
<EmptyState title="No secrets match search" icon={faSearch} />
</td>
</tr>
)}
{filteredImportedSecrets.map(({ key, value }, index) => (
<tr key={`${id}-${key}-${index + 1}`}> <tr key={`${id}-${key}-${index + 1}`}>
<td className="h-10" style={{ padding: "0.25rem 1rem" }}> <td className="h-10" style={{ padding: "0.25rem 1rem" }}>
{key} {key}