mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 16:52:38 +00:00
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { ReactNode } from "react";
|
|
|
|
import { GenericFieldLabel } from "@app/components/secret-syncs";
|
|
import {
|
|
TerraformCloudSyncScope,
|
|
TTerraformCloudSync
|
|
} from "@app/hooks/api/secretSyncs/types/terraform-cloud-sync";
|
|
|
|
type Props = {
|
|
secretSync: TTerraformCloudSync;
|
|
};
|
|
|
|
export const TerraformCloudSyncDestinationSection = ({ secretSync }: Props) => {
|
|
const { destinationConfig } = secretSync;
|
|
|
|
let Components: ReactNode;
|
|
switch (destinationConfig.scope) {
|
|
case TerraformCloudSyncScope.VariableSet:
|
|
Components = (
|
|
<>
|
|
<GenericFieldLabel label="Organization">{destinationConfig.org}</GenericFieldLabel>
|
|
<GenericFieldLabel label="Variable Set">
|
|
{destinationConfig.destinationName}
|
|
</GenericFieldLabel>
|
|
</>
|
|
);
|
|
break;
|
|
case TerraformCloudSyncScope.Workspace:
|
|
Components = (
|
|
<>
|
|
<GenericFieldLabel label="Organization">{destinationConfig.org}</GenericFieldLabel>
|
|
<GenericFieldLabel label="Workspace">
|
|
{destinationConfig.destinationName}
|
|
</GenericFieldLabel>
|
|
</>
|
|
);
|
|
break;
|
|
default:
|
|
throw new Error(
|
|
`Unhandled Terraform Cloud Sync Destination Section Scope ${secretSync.destinationConfig.scope}`
|
|
);
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<GenericFieldLabel className="capitalize" label="Scope">
|
|
{destinationConfig.scope.replace("-", " ")}
|
|
</GenericFieldLabel>
|
|
{Components}
|
|
</>
|
|
);
|
|
};
|