From 5a4b83d90065c0fac8a321d4a4f11743269321a2 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Wed, 17 Sep 2025 18:36:15 -0700 Subject: [PATCH] improvements: address feedback progress --- .../secret-v2-bridge/secret-v2-bridge-dal.ts | 7 ++-- .../SecretReferenceDetails.tsx | 8 +++++ frontend/src/hooks/api/secrets/queries.tsx | 1 + .../SecretOverviewTableRow/SecretEditRow.tsx | 28 ++++++++-------- .../SecretListView/SecretDetailSidebar.tsx | 32 ++++++------------- 5 files changed, 35 insertions(+), 41 deletions(-) diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts index 93afb3b55..d8220e4f5 100644 --- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts +++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts @@ -446,9 +446,10 @@ export const secretV2BridgeDALFactory = ({ db, keyStore }: TSecretV2DalArg) => { } }) .where((bd) => { - void bd - .whereNull(`${TableName.SecretV2}.userId`) - .orWhere({ [`${TableName.SecretV2}.userId` as "userId"]: userId || null }); + void bd.whereNull(`${TableName.SecretV2}.userId`); + // scott: removing this as we don't need to count overrides + // and there is currently a bug when you move secrets that doesn't move the override so this can skew count + // .orWhere({ [`${TableName.SecretV2}.userId` as "userId"]: userId || null }); }) .countDistinct(`${TableName.SecretV2}.key`); diff --git a/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx b/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx index ada741145..d4f09ea8f 100644 --- a/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx +++ b/frontend/src/components/secrets/SecretReferenceDetails/SecretReferenceDetails.tsx @@ -130,6 +130,14 @@ export const SecretReferenceTree = ({ secretPath, environment, secretKey }: Prop ); } + if (tree?.children?.length === 0) { + return ( +
+ This secret does not contain references +
+ ); + } + return (
diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsx index b12cca38b..e3cbf7f0e 100644 --- a/frontend/src/hooks/api/secrets/queries.tsx +++ b/frontend/src/hooks/api/secrets/queries.tsx @@ -119,6 +119,7 @@ export const mergePersonalSecrets = (rawSecrets: SecretV3Raw[]) => { sec.valueOverride = personalSecret.value; sec.overrideAction = "modified"; sec.isEmpty = personalSecret.isEmpty; + sec.secretValueHidden = false; } }); diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx index 84b58fb7f..be914024e 100644 --- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx +++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx @@ -1,4 +1,4 @@ -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Controller, useForm } from "react-hook-form"; import { subject } from "@casl/ability"; import { @@ -15,10 +15,7 @@ import { twMerge } from "tailwind-merge"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; -import { - hasSecretReference, - SecretReferenceTree -} from "@app/components/secrets/SecretReferenceDetails"; +import { SecretReferenceTree } from "@app/components/secrets/SecretReferenceDetails"; import { DeleteActionModal, IconButton, @@ -150,13 +147,20 @@ export const SecretEditRow = ({ control, reset, getValues, + setValue, formState: { isDirty, isSubmitting } } = useForm({ - values: { + defaultValues: { value: (secretValueData?.valueOverride ?? secretValueData?.value) || null } }); + useEffect(() => { + if (secretValueData && !isDirty) { + setValue("value", secretValueData.valueOverride ?? secretValueData.value); + } + }, [secretValueData]); + const { permission } = useProjectPermission(); const [isDeleting, setIsDeleting] = useToggle(); @@ -171,7 +175,7 @@ export const SecretEditRow = ({ }; const handleCopySecretToClipboard = async () => { - if (!isSecretValueFetched) { + if (!isSecretValueFetched && !isDirty) { try { const data = await fetchSecretValue(fetchSecretValueParams); @@ -402,18 +406,12 @@ export const SecretEditRow = ({
- + diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx index fa839be84..c0ba7184e 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretDetailSidebar.tsx @@ -21,10 +21,7 @@ import { Link } from "@tanstack/react-router"; import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; import { createNotification } from "@app/components/notifications"; import { ProjectPermissionCan } from "@app/components/permissions"; -import { - hasSecretReference, - SecretReferenceTree -} from "@app/components/secrets/SecretReferenceDetails"; +import { SecretReferenceTree } from "@app/components/secrets/SecretReferenceDetails"; import { Button, Drawer, @@ -843,26 +840,15 @@ export const SecretDetailSidebar = ({ )}
- } + onClick={() => handlePopUpOpen("secretReferenceTree", secretKey)} > -
- -
-
+ Secret Reference Tree +