misc: renamed enum

This commit is contained in:
Sheen Capadngan
2025-01-27 21:47:27 +08:00
parent 49e6d7a861
commit 18cf3c89c1
19 changed files with 62 additions and 27 deletions
@@ -10,7 +10,9 @@ import { SecretSync } from "@app/hooks/api/secretSyncs";
import { TSecretSyncForm } from "../schemas";
export const GcpSyncFields = () => {
const { control, setValue } = useFormContext<TSecretSyncForm & { destination: SecretSync.GCP }>();
const { control, setValue } = useFormContext<
TSecretSyncForm & { destination: SecretSync.GCPSecretManager }
>();
const connectionId = useWatch({ name: "connection.id", control });
@@ -17,7 +17,7 @@ export const SecretSyncDestinationFields = () => {
return <AwsParameterStoreSyncFields />;
case SecretSync.GitHub:
return <GitHubSyncFields />;
case SecretSync.GCP:
case SecretSync.GCPSecretManager:
return <GcpSyncFields />;
default:
throw new Error(`Unhandled Destination Config Field: ${destination}`);
@@ -5,7 +5,9 @@ import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { SecretSync } from "@app/hooks/api/secretSyncs";
export const GcpSyncReviewFields = () => {
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.GCP }>();
const { watch } = useFormContext<
TSecretSyncForm & { destination: SecretSync.GCPSecretManager }
>();
const projectId = watch("destinationConfig.projectId");
return <SecretSyncLabel label="Project ID">{projectId}</SecretSyncLabel>;
@@ -39,7 +39,7 @@ export const SecretSyncReviewFields = () => {
case SecretSync.GitHub:
DestinationFieldsComponent = <GitHubSyncReviewFields />;
break;
case SecretSync.GCP:
case SecretSync.GCPSecretManager:
DestinationFieldsComponent = <GcpSyncReviewFields />;
break;
default:
@@ -3,7 +3,7 @@ import { z } from "zod";
import { SecretSync } from "@app/hooks/api/secretSyncs";
export const GcpSyncDestinationSchema = z.object({
destination: z.literal(SecretSync.GCP),
destination: z.literal(SecretSync.GCPSecretManager),
destinationConfig: z.object({
projectId: z.string().min(1, "Project ID required")
})
+2 -2
View File
@@ -8,13 +8,13 @@ import {
export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }> = {
[SecretSync.AWSParameterStore]: { name: "Parameter Store", image: "Amazon Web Services.png" },
[SecretSync.GitHub]: { name: "GitHub", image: "GitHub.png" },
[SecretSync.GCP]: { name: "GCP Secret Manager", image: "Google Cloud Platform.png" }
[SecretSync.GCPSecretManager]: { name: "GCP Secret Manager", image: "Google Cloud Platform.png" }
};
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.AWSParameterStore]: AppConnection.AWS,
[SecretSync.GitHub]: AppConnection.GitHub,
[SecretSync.GCP]: AppConnection.GCP
[SecretSync.GCPSecretManager]: AppConnection.GCP
};
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
+1 -1
View File
@@ -1,7 +1,7 @@
export enum SecretSync {
AWSParameterStore = "aws-parameter-store",
GitHub = "github",
GCP = "gcp-secret-manager"
GCPSecretManager = "gcp-secret-manager"
}
export enum SecretSyncStatus {
@@ -3,7 +3,7 @@ import { SecretSync } from "@app/hooks/api/secretSyncs";
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
export type TGcpSync = TRootSecretSync & {
destination: SecretSync.GCP;
destination: SecretSync.GCPSecretManager;
destinationConfig: {
projectId: string;
};
@@ -14,7 +14,7 @@ export const SecretSyncDestinationCol = ({ secretSync }: Props) => {
return <AwsParameterStoreSyncDestinationCol secretSync={secretSync} />;
case SecretSync.GitHub:
return <GitHubSyncDestinationCol secretSync={secretSync} />;
case SecretSync.GCP:
case SecretSync.GCPSecretManager:
return <GcpSyncDestinationCol secretSync={secretSync} />;
default:
throw new Error(
@@ -39,7 +39,7 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {
throw new Error(`Unhandled GitHub Scope Destination Col Values ${destination}`);
}
break;
case SecretSync.GCP:
case SecretSync.GCPSecretManager:
primaryText = destinationConfig.projectId;
break;
default:
@@ -32,7 +32,7 @@ export const SecretSyncDestinationSection = ({ secretSync, onEditDestination }:
case SecretSync.GitHub:
DestinationComponents = <GitHubSyncDestinationSection secretSync={secretSync} />;
break;
case SecretSync.GCP:
case SecretSync.GCPSecretManager:
DestinationComponents = <GcpSyncDestinationSection secretSync={secretSync} />;
break;
default: