-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathRetryDeploymentIndexingDialog.tsx
More file actions
60 lines (56 loc) · 1.97 KB
/
RetryDeploymentIndexingDialog.tsx
File metadata and controls
60 lines (56 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { ArrowPathIcon } from "@heroicons/react/20/solid";
import { DialogClose } from "@radix-ui/react-dialog";
import { Form, useNavigation } from "@remix-run/react";
import { Button } from "~/components/primitives/Buttons";
import {
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
} from "~/components/primitives/Dialog";
import { SpinnerWhite } from "~/components/primitives/Spinner";
type RetryDeploymentIndexingDialogProps = {
projectId: string;
deploymentShortCode: string;
redirectPath: string;
};
export function RetryDeploymentIndexingDialog({
projectId,
deploymentShortCode,
redirectPath,
}: RetryDeploymentIndexingDialogProps) {
const navigation = useNavigation();
const formAction = `/resources/${projectId}/deployments/${deploymentShortCode}/retry-indexing`;
const isLoading = navigation.formAction === formAction;
return (
<DialogContent key="retry-indexing">
<DialogHeader>Retry indexing this deployment?</DialogHeader>
<DialogDescription>
Retrying can be useful if indexing failed due to missing environment variables. Make sure
you set them before retrying. In most other cases, indexing will keep failing until you fix
any errors and re-deploy.
</DialogDescription>
<DialogFooter>
<DialogClose asChild>
<Button variant="tertiary/medium">Cancel</Button>
</DialogClose>
<Form
action={`/resources/${projectId}/deployments/${deploymentShortCode}/retry-indexing`}
method="post"
>
<Button
type="submit"
name="redirectUrl"
value={redirectPath}
variant="primary/medium"
LeadingIcon={isLoading ? SpinnerWhite : ArrowPathIcon}
disabled={isLoading}
shortcut={{ modifiers: ["mod"], key: "enter" }}
>
{isLoading ? "Retrying..." : "Retry indexing"}
</Button>
</Form>
</DialogFooter>
</DialogContent>
);
}