Files
infisical/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/RailwaySyncReviewFields.tsx
T
Sidandgreptile-apps[bot] fedffea8d5 ENG-2595 (#3976)
* feat: implement railway secret sync

* fix: railway sync config

* feat: add documentation on railway

* fix: undo mock on-prem change

* lint: fix

* fix: cleanup railway integration

* fix: retry and doc images

* fix: sync fields

* fix: query typo

* Update docs/docs.json

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-07-10 22:53:18 +05:30

30 lines
1.1 KiB
TypeScript

import { useFormContext } from "react-hook-form";
import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
import { GenericFieldLabel } from "@app/components/v2";
import { useRailwayConnectionListProjects } from "@app/hooks/api/appConnections/railway";
import { SecretSync } from "@app/hooks/api/secretSyncs";
export const RailwaySyncReviewFields = () => {
const { watch } = useFormContext<TSecretSyncForm & { destination: SecretSync.Railway }>();
const connectionId = watch("connection.id");
const projectId = watch("destinationConfig.projectId");
const environmentId = watch("destinationConfig.environmentId");
const { data: projects = [] } = useRailwayConnectionListProjects(connectionId, {
enabled: Boolean(connectionId)
});
const project = projects.find((p) => p.id === projectId);
const environment = project?.environments.find((e) => e.id === environmentId);
return (
<>
<GenericFieldLabel label="Project">{project?.name ?? projectId}</GenericFieldLabel>
<GenericFieldLabel label="Environment">
{environment?.name ?? environmentId}
</GenericFieldLabel>
</>
);
};