import { Link } from "@remix-run/react"; import { Paragraph } from "~/components/primitives/Paragraph"; import { StepNumber } from "~/components/primitives/StepNumber"; import { useJob } from "~/hooks/useJob"; import { useOrganization } from "~/hooks/useOrganizations"; import { useProject } from "~/hooks/useProject"; import { IntegrationIcon } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.integrations/route"; import { jobTestPath } from "~/utils/pathBuilder"; import { CodeBlock } from "../code/CodeBlock"; import { InlineCode } from "../code/InlineCode"; import { EnvironmentLabel } from "../environments/EnvironmentLabel"; import { HelpPanelProps } from "../integrations/ApiKeyHelp"; import { HelpInstall } from "../integrations/HelpInstall"; import { HelpSamples } from "../integrations/HelpSamples"; import { LinkButton } from "../primitives/Buttons"; import { Callout, variantClasses } from "../primitives/Callout"; import { Header2 } from "../primitives/Headers"; import { TextLink } from "../primitives/TextLink"; import integrationButton from "./integration-button.png"; import selectEnvironment from "./select-environment.png"; import selectExample from "./select-example.png"; import { StepContentContainer } from "../StepContentContainer"; import { TriggerDevCommand } from "../SetupCommands"; export function HowToRunYourJob() { const organization = useOrganization(); const project = useProject(); const job = useJob(); return ( <> There are two ways to run your Job: You can perform a Run with any payload you want, or use one of our examples, on the test page. Test Performing a real run depends on the type of Trigger your Job is using. How to run a Job Scheduled Triggers do not trigger Jobs in the DEV Environment. When developing locally you should use the{" "} Test feature {" "} to trigger any scheduled Jobs. ); } export function HowToRunATest() { return ( <> Select the environment you’d like the test to run against. Write your own payload specific to your Job. Some Triggers also provide example payloads that you can select from. This will populate the code editor below. When you’re happy with the payload, click Run test. Learn more about running tests. ); } export function HowToConnectAnIntegration() { return ( <> APIs marked with a are Trigger.dev Integrations. These Integrations make connecting to the API easier by offering OAuth or API key authentication. All APIs can also be used with fetch or an SDK. Follow the instructions for your chosen connection method in the popover form. If no Integration exists yet, you can request one by clicking the "I want an Integration" button. Once you've connected your API, it will appear in the list of Integrations below. You can view details and manage your connection by selecting it from the table. View the Integration docs page for more information on connecting an API using an Integration or other method. ); } export function HowToUseThisIntegration({ integration, help, integrationClient }: HelpPanelProps) { return ( <> {help && ( <> )} ); } export function HowToDisableAJob({ id, name, version, }: { id: string; name: string; version: string; }) { return ( <> To disable a job, you need to set the enabled property to{" "} false. Set enabled to false } /> Run the @trigger.dev/cli dev command } /> If you aren't already running the dev command, run it now. ); } export function HowToUseApiKeysAndEndpoints() { return ( <> Environments and Endpoints are used to connect your server to the Trigger.dev platform. Environments Each environment has API Keys associated with it. The Server API Key is used to authenticate your Jobs with the Trigger.dev platform. The Server API Key you use for your{" "} Client {" "} is how we know which environment to run your code against: Development } /> The DEV environment should only be used for local development. It’s where you can test your Jobs before deploying them to servers. Scheduled Triggers do not trigger Jobs in the DEV Environment. When you’re working locally you should use the Test feature to trigger any scheduled Jobs. Production } /> The PROD environment is where your Jobs will run in production. It’s where you can run your Jobs against real data. Endpoints An Endpoint is a URL on your server that Trigger.dev can connect to. This URL is used to register Jobs, start them and orchestrate runs and retries. DEV has multiple endpoints associated with it – one for each team member. This allows each team member to run their own Jobs, without interfering with each other. All other environments have just a single endpoint (with a single URL) associated with them. Deployment Deployment uses Environments and Endpoints to connect your Jobs to the Trigger.dev platform. Read the deployment guide to learn more. ); }