2023-01-16 09:45:12 +00:00
|
|
|
import CardTitle from "@dashboard/components/CardTitle";
|
|
|
|
import ControlledCheckbox from "@dashboard/components/ControlledCheckbox";
|
|
|
|
import { ChangeEvent } from "@dashboard/hooks/useForm";
|
2021-05-14 08:15:15 +00:00
|
|
|
import { Card, CardContent, Typography } from "@material-ui/core";
|
2019-10-09 06:01:52 +00:00
|
|
|
import React from "react";
|
|
|
|
import { useIntl } from "react-intl";
|
|
|
|
|
2022-12-15 13:51:05 +00:00
|
|
|
import { WebhookFormData } from "../WebhookDetailsPage";
|
2021-12-13 14:43:30 +00:00
|
|
|
import { messages } from "./messages";
|
2019-10-09 06:01:52 +00:00
|
|
|
|
|
|
|
interface WebhookStatusProps {
|
2019-10-14 14:41:41 +00:00
|
|
|
data: boolean;
|
2019-10-09 06:01:52 +00:00
|
|
|
disabled: boolean;
|
2019-10-14 14:41:41 +00:00
|
|
|
onChange: (event: ChangeEvent, cb?: () => void) => void;
|
2019-10-09 06:01:52 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 13:35:33 +00:00
|
|
|
const WebhookStatus: React.FC<WebhookStatusProps> = ({
|
2019-10-09 06:01:52 +00:00
|
|
|
data,
|
|
|
|
disabled,
|
2022-06-21 09:36:55 +00:00
|
|
|
onChange,
|
2019-10-09 06:01:52 +00:00
|
|
|
}) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
|
|
<Card>
|
2021-12-13 14:43:30 +00:00
|
|
|
<CardTitle title={intl.formatMessage(messages.webhookStatus)} />
|
2019-10-09 20:50:03 +00:00
|
|
|
<CardContent>
|
2021-12-13 14:43:30 +00:00
|
|
|
<Typography variant="body1">
|
|
|
|
{intl.formatMessage(messages.webhookActiveDescription)}
|
2019-10-09 20:50:03 +00:00
|
|
|
</Typography>
|
|
|
|
<ControlledCheckbox
|
2022-12-15 13:51:05 +00:00
|
|
|
name={"isActive" as keyof WebhookFormData}
|
2021-12-13 14:43:30 +00:00
|
|
|
label={intl.formatMessage(messages.webhookActive)}
|
2019-10-14 14:41:41 +00:00
|
|
|
checked={data}
|
2019-10-09 20:50:03 +00:00
|
|
|
onChange={onChange}
|
|
|
|
disabled={disabled}
|
|
|
|
/>
|
|
|
|
</CardContent>
|
2019-10-09 06:01:52 +00:00
|
|
|
</Card>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
WebhookStatus.displayName = "WebhookStatus";
|
|
|
|
export default WebhookStatus;
|