50e3d9e43a
* Added EndpointIndex status. Default is PENDING, existing rows are SUCCESS * Made it easier to create a migration SQL file * Created a job-catalog file for misconfigured Jobs that should error when running the CLI * EndpointIndex data and state are now optional * The Environments page now shows the status of the last refresh * Improved the UI about endpoints * Added EndpointIndex error column * WIP making the endpoint indexing more robust * Indexing errors are now surfaced * Improved the error show it shows the job id * Use “performEndpointIndexing” when you create your first endpoint from the UI * Use “performEndpointIndexing” for the recurring endpoint checker * Staging is now auto-indexed every 10 mins too * Use “performEndpointIndexing” for the webhook * Moved the throttling to a util * Removed instructional comments * Created a reusable retry system with exponential backoff * Use p-retry for retrying with backoff * The CLI gets indexing results and displays errors * Improved the indexing error messages and display in the console * Use a pre so the Indexing error is correctly split over multiple lines * Use a db transaction for webhook that triggers endpoint indexing * Tidied up imports * Support older versions of the server * Improved the comment on the misconfigured job * Changeset: When indexing user's jobs errors are now stored and displayed
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import type { z } from "zod";
|
|
import { Paragraph } from "./Paragraph";
|
|
import { NamedIcon } from "./NamedIcon";
|
|
import { motion } from "framer-motion";
|
|
import { cn } from "~/utils/cn";
|
|
|
|
export function FormError({
|
|
children,
|
|
id,
|
|
className,
|
|
}: {
|
|
children: React.ReactNode;
|
|
id?: string;
|
|
className?: string;
|
|
}) {
|
|
return (
|
|
<>
|
|
{children && (
|
|
<motion.div
|
|
initial={{ opacity: 0 }}
|
|
animate={{ opacity: 1 }}
|
|
transition={{ duration: 0.3 }}
|
|
className={cn("flex items-start gap-0.5", className)}
|
|
>
|
|
<NamedIcon name="error" className="h-4 w-4 shrink-0 justify-start" />
|
|
<Paragraph id={id} variant="extra-small" className="text-rose-500">
|
|
{children}
|
|
</Paragraph>
|
|
</motion.div>
|
|
)}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export function ZodFormErrors({ errors, path }: { errors: z.ZodIssue[]; path: string[] }) {
|
|
if (errors.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
const relevantErrors = errors.filter((error) => {
|
|
return error.path.join(".") === path.join(".");
|
|
});
|
|
|
|
if (relevantErrors.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="col-span-full mt-1 text-sm text-rose-600">
|
|
{relevantErrors.map((error, index) => (
|
|
<FormError key={index}>{error.message}</FormError>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|