From 331dcd4d7904b32e091698cc1ef7546171ece335 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Wed, 4 Dec 2024 17:06:43 -0800 Subject: [PATCH] improvement: support search by integration destination --- .../components/IntegrationDetails.tsx | 19 +++++++++---------- .../components/IntegrationRow.tsx | 13 ++----------- .../components/IntegrationsTable.tsx | 15 ++++++++++++--- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationDetails.tsx b/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationDetails.tsx index 7af717f81..1631fc8c4 100644 --- a/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationDetails.tsx +++ b/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationDetails.tsx @@ -8,6 +8,14 @@ type Props = { const FIELD_CLASSNAME = "truncate rounded-md border border-mineshaft-700 bg-mineshaft-900 px-3 py-2 font-inter text-sm text-bunker-200"; +export const getIntegrationDestination = (integration: TIntegration) => + (integration.integration === "hashicorp-vault" && + `${integration.app} - path: ${integration.path}`) || + (integration.scope === "github-org" && `${integration.owner}`) || + (["aws-parameter-store", "rundeck"].includes(integration.integration) && `${integration.path}`) || + (integration.scope?.startsWith("github-") && `${integration.owner}/${integration.app}`) || + integration.app; + export const IntegrationDetails = ({ integration }: Props) => { return (
@@ -55,16 +63,7 @@ export const IntegrationDetails = ({ integration }: Props) => { "App" } /> -
- {(integration.integration === "hashicorp-vault" && - `${integration.app} - path: ${integration.path}`) || - (integration.scope === "github-org" && `${integration.owner}`) || - (["aws-parameter-store", "rundeck"].includes(integration.integration) && - `${integration.path}`) || - (integration.scope?.startsWith("github-") && - `${integration.owner}/${integration.app}`) || - integration.app} -
+
{getIntegrationDestination(integration)}
)} {(integration.integration === "vercel" || diff --git a/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationRow.tsx b/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationRow.tsx index 85bd3aeeb..6640e0c41 100644 --- a/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationRow.tsx +++ b/frontend/src/views/IntegrationsPage/components/IntegrationsSection/components/IntegrationRow.tsx @@ -18,7 +18,7 @@ import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context"; import { TCloudIntegration } from "@app/hooks/api/integrations/types"; import { TIntegration } from "@app/hooks/api/types"; -import { IntegrationDetails } from "./IntegrationDetails"; +import { getIntegrationDestination, IntegrationDetails } from "./IntegrationDetails"; type IProps = { integration: TIntegration; @@ -77,16 +77,7 @@ export const IntegrationRow = ({ {environment?.name ?? "-"}
-

- {(integration.integration === "hashicorp-vault" && - `${integration.app} - path: ${integration.path}`) || - (integration.scope === "github-org" && `${integration.owner}`) || - (["aws-parameter-store", "rundeck"].includes(integration.integration) && - `${integration.path}`) || - (integration.scope?.startsWith("github-") && - `${integration.owner}/${integration.app}`) || - integration.app} -

+

{getIntegrationDestination(integration)}

integrations - .filter(({ integration, secretPath, envId, isSynced }) => { + .filter((integration) => { + const { secretPath, envId, isSynced } = integration; + if (!filters.status.includes(IntegrationStatus.Synced) && isSynced) return false; if (!filters.status.includes(IntegrationStatus.NotSynced) && isSynced === false) return false; @@ -130,13 +133,19 @@ export const IntegrationsTable = ({ ) return false; - if (!filters.integrations.includes(integration)) return false; + if (!filters.integrations.includes(integration.integration)) return false; if (!filters.environmentIds.includes(envId)) return false; return ( - integration.replace("-", " ").toLowerCase().includes(search.trim().toLowerCase()) || + integration.integration + .replace("-", " ") + .toLowerCase() + .includes(search.trim().toLowerCase()) || secretPath.replace("-", " ").toLowerCase().includes(search.trim().toLowerCase()) || + getIntegrationDestination(integration) + ?.toLowerCase() + .includes(search.trim().toLowerCase()) || environmentMap .get(envId) ?.name.replace("-", " ")