mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 14:27:23 +00:00
* 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>
30 lines
1.1 KiB
TypeScript
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>
|
|
</>
|
|
);
|
|
};
|