Feat: Import indicator

This commit is contained in:
Daniel Hougaard
2024-03-20 20:25:48 +01:00
parent 671adee4d7
commit 90be28b87a
4 changed files with 117 additions and 10 deletions
@@ -17,7 +17,7 @@ import {
} from "@app/context";
import { usePopUp } from "@app/hooks";
import {
useGetImportedSecrets,
useGetImportedSecretsSingleEnv,
useGetProjectFolders,
useGetProjectSecrets,
useGetSecretApprovalPolicyOfABoard,
@@ -124,7 +124,7 @@ export const SecretMainPage = () => {
});
// fetch imported secrets to show user the overriden ones
const { data: importedSecrets } = useGetImportedSecrets({
const { data: importedSecrets } = useGetImportedSecretsSingleEnv({
projectId: workspaceId,
environment,
decryptFileKey: decryptFileKey!,
@@ -56,6 +56,7 @@ import {
useDeleteSecretV3,
useGetFoldersByEnv,
useGetImportedFoldersByEnv,
useGetImportedSecretsAllEnvs,
useGetProjectSecretsAllEnv,
useGetUserWsKey,
useUpdateSecretV3
@@ -134,7 +135,12 @@ export const SecretOverviewPage = () => {
const { isImportedFolderPresentInEnv } = useGetImportedFoldersByEnv({
projectId: workspaceId,
path: secretPath,
environments: userAvailableEnvs.map(({ slug }) => slug)
});
const { isImportedSecretPresentInEnv } = useGetImportedSecretsAllEnvs({
projectId: workspaceId,
decryptFileKey: latestFileKey!,
environments: userAvailableEnvs.map(({ slug }) => slug)
});
@@ -657,6 +663,7 @@ export const SecretOverviewPage = () => {
filteredSecretNames.map((key, index) => (
<SecretOverviewTableRow
secretPath={secretPath}
isImportedSecretPresentInEnv={isImportedSecretPresentInEnv}
onSecretCreate={handleSecretCreate}
onSecretDelete={handleSecretDelete}
onSecretUpdate={handleSecretUpdate}
@@ -40,7 +40,11 @@ export const SecretOverviewFolderRow = ({
isPresent || isImportPresent ? "text-green-600" : "text-red-600"
)}
>
<Tooltip isDisabled={!isImportPresent} content="Folder is imported">
<Tooltip
center
isDisabled={!isImportPresent}
content="Folder is imported from another environment"
>
<div className="flex justify-center">
<FontAwesomeIcon
// eslint-disable-next-line no-nested-ternary