forked from github/plane
chore: update the content of webhooks form (#2932)
This commit is contained in:
parent
4f64f431a7
commit
f4af3db7b6
@ -138,7 +138,8 @@ export const WebhookForm: FC<Props> = observer((props) => {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-xl font-medium">{data ? "Webhook details" : "Create webhook"}</div>
|
||||
<form className="space-y-8" onSubmit={handleSubmit(handleFormSubmit)}>
|
||||
<form onSubmit={handleSubmit(handleFormSubmit)}>
|
||||
<div className="space-y-8">
|
||||
<div>
|
||||
<Controller
|
||||
control={control}
|
||||
@ -156,11 +157,16 @@ export const WebhookForm: FC<Props> = observer((props) => {
|
||||
<div className="space-y-3">
|
||||
<WebhookOptions value={webhookEventType} onChange={(val) => setWebhookEventType(val)} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
{webhookEventType === "individual" && <WebhookIndividualEventOptions control={control} />}
|
||||
</div>
|
||||
<div className="space-y-8 mt-8">
|
||||
{data && <WebhookSecretKey data={data} />}
|
||||
<Button type="submit" loading={isSubmitting}>
|
||||
{data ? (isSubmitting ? "Updating..." : "Update") : isSubmitting ? "Creating..." : "Create"}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Control, Controller } from "react-hook-form";
|
||||
import { IWebhook } from "types/webhook";
|
||||
|
||||
export const individualWebhookOptions: {
|
||||
export const INDIVIDUAL_WEBHOOK_OPTIONS: {
|
||||
key: keyof IWebhook;
|
||||
label: string;
|
||||
description: string;
|
||||
@ -9,27 +9,27 @@ export const individualWebhookOptions: {
|
||||
{
|
||||
key: "project",
|
||||
label: "Projects",
|
||||
description: "Project created, updated or deleted.",
|
||||
description: "Project created, updated, or deleted",
|
||||
},
|
||||
{
|
||||
key: "cycle",
|
||||
label: "Cycles",
|
||||
description: "Cycle created, updated or deleted.",
|
||||
description: "Cycle created, updated, or deleted",
|
||||
},
|
||||
{
|
||||
key: "issue",
|
||||
label: "Issues",
|
||||
description: "Issue created, updated, deleted, added to a cycle or module.",
|
||||
description: "Issue created, updated, deleted, added to a cycle or module",
|
||||
},
|
||||
{
|
||||
key: "module",
|
||||
label: "Modules",
|
||||
description: "Module created, updated or deleted.",
|
||||
description: "Module created, updated, or deleted",
|
||||
},
|
||||
{
|
||||
key: "issue_comment",
|
||||
label: "Issue comments",
|
||||
description: "Comment posted, updated or deleted.",
|
||||
description: "Comment posted, updated, or deleted",
|
||||
},
|
||||
];
|
||||
|
||||
@ -38,9 +38,8 @@ type Props = {
|
||||
};
|
||||
|
||||
export const WebhookIndividualEventOptions = ({ control }: Props) => (
|
||||
<>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-4 gap-y-8 px-6 mt-5">
|
||||
{individualWebhookOptions.map((option) => (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-4 gap-y-8 px-6">
|
||||
{INDIVIDUAL_WEBHOOK_OPTIONS.map((option) => (
|
||||
<Controller
|
||||
key={option.key}
|
||||
control={control}
|
||||
@ -65,5 +64,4 @@ export const WebhookIndividualEventOptions = ({ control }: Props) => (
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user