feat: chef secret-sync

This commit is contained in:
Piyush Gupta
2025-10-30 20:06:04 +05:30
parent fd010fe823
commit 30c0cfb8c2
36 changed files with 767 additions and 124 deletions
@@ -0,0 +1,14 @@
import { TChefSync } from "@app/hooks/api/secretSyncs/types/chef-sync";
import { getSecretSyncDestinationColValues } from "../helpers";
import { SecretSyncTableCell } from "../SecretSyncTableCell";
type Props = {
secretSync: TChefSync;
};
export const ChefSyncDestinationCol = ({ secretSync }: Props) => {
const { primaryText, secondaryText } = getSecretSyncDestinationColValues(secretSync);
return <SecretSyncTableCell primaryText={primaryText} secondaryText={secondaryText} />;
};
@@ -31,6 +31,7 @@ import { TerraformCloudSyncDestinationCol } from "./TerraformCloudSyncDestinatio
import { VercelSyncDestinationCol } from "./VercelSyncDestinationCol";
import { WindmillSyncDestinationCol } from "./WindmillSyncDestinationCol";
import { ZabbixSyncDestinationCol } from "./ZabbixSyncDestinationCol";
import { ChefSyncDestinationCol } from "./ChefSyncDestinationCol";
type Props = {
secretSync: TSecretSync;
@@ -100,6 +101,8 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
return <BitbucketSyncDestinationCol secretSync={secretSync} />;
case SecretSync.LaravelForge:
return <LaravelForgeSyncDestinationCol secretSync={secretSync} />;
case SecretSync.Chef:
return <ChefSyncDestinationCol secretSync={secretSync} />;
default:
throw new Error(
`Unhandled Secret Sync Destination Col: ${(secretSync as TSecretSync).destination}`
@@ -198,6 +198,10 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
primaryText = destinationConfig.siteName || destinationConfig.siteId;
secondaryText = destinationConfig.orgName || destinationConfig.orgSlug;
break;
case SecretSync.Chef:
primaryText = destinationConfig.dataBagName;
secondaryText = destinationConfig.dataBagItemName;
break;
default:
throw new Error(`Unhandled Destination Col Values ${destination}`);
}
@@ -0,0 +1,19 @@
import { GenericFieldLabel } from "@app/components/secret-syncs";
import { TChefSync } from "@app/hooks/api/secretSyncs/types/chef-sync";
type Props = {
secretSync: TChefSync;
};
export const ChefSyncDestinationSection = ({ secretSync }: Props) => {
const { destinationConfig } = secretSync;
return (
<>
<GenericFieldLabel label="Data Bag">{destinationConfig.dataBagName}</GenericFieldLabel>
<GenericFieldLabel label="Data Bag Item">
{destinationConfig.dataBagItemName}
</GenericFieldLabel>
</>
);
};
@@ -42,6 +42,7 @@ import { TerraformCloudSyncDestinationSection } from "./TerraformCloudSyncDestin
import { VercelSyncDestinationSection } from "./VercelSyncDestinationSection";
import { WindmillSyncDestinationSection } from "./WindmillSyncDestinationSection";
import { ZabbixSyncDestinationSection } from "./ZabbixSyncDestinationSection";
import { ChefSyncDestinationSection } from "./ChefSyncDestinationSection";
type Props = {
secretSync: TSecretSync;
@@ -152,6 +153,9 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
case SecretSync.LaravelForge:
DestinationComponents = <LaravelForgeSyncDestinationSection secretSync={secretSync} />;
break;
case SecretSync.Chef:
DestinationComponents = <ChefSyncDestinationSection secretSync={secretSync} />;
break;
default:
throw new Error(`Unhandled Destination Section components: ${destination}`);
}
@@ -73,6 +73,7 @@ export const SecretSyncOptionsSection = ({ secretSync, onEditOptions }: Props) =
case SecretSync.Netlify:
case SecretSync.Bitbucket:
case SecretSync.LaravelForge:
case SecretSync.Chef:
AdditionalSyncOptionsComponent = null;
break;
default: