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 CardTitle from "@saleor/components/CardTitle";
|
|
|
|
import ControlledCheckbox from "@saleor/components/ControlledCheckbox";
|
2019-10-14 14:41:41 +00:00
|
|
|
import { ChangeEvent } from "@saleor/hooks/useForm";
|
2019-10-09 06:01:52 +00:00
|
|
|
import React from "react";
|
|
|
|
import { useIntl } from "react-intl";
|
|
|
|
|
|
|
|
import { FormData } from "../WebhooksDetailsPage";
|
|
|
|
|
|
|
|
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,
|
2019-10-09 20:50:03 +00:00
|
|
|
onChange
|
2019-10-09 06:01:52 +00:00
|
|
|
}) => {
|
|
|
|
const intl = useIntl();
|
|
|
|
return (
|
|
|
|
<Card>
|
|
|
|
<CardTitle
|
|
|
|
title={intl.formatMessage({
|
|
|
|
defaultMessage: "Webhook Status",
|
|
|
|
description: "section header"
|
|
|
|
})}
|
|
|
|
/>
|
2019-10-09 20:50:03 +00:00
|
|
|
<CardContent>
|
|
|
|
<Typography>
|
|
|
|
{intl.formatMessage({
|
|
|
|
defaultMessage:
|
|
|
|
"If you want to disable this webhook please uncheck the box below.",
|
|
|
|
description: "webhook active"
|
|
|
|
})}
|
|
|
|
</Typography>
|
|
|
|
<ControlledCheckbox
|
|
|
|
name={"isActive" as keyof FormData}
|
|
|
|
label={intl.formatMessage({
|
|
|
|
defaultMessage: "Webhook is active",
|
|
|
|
description: "webhooks active"
|
|
|
|
})}
|
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;
|