2021-11-29 23:29:41 +00:00
|
|
|
/* This component is used for creating and editing both global and team scheduled queries */
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { syntaxHighlight } from "fleet/helpers";
|
|
|
|
|
|
|
|
|
|
import Modal from "components/Modal";
|
|
|
|
|
import Button from "components/buttons/Button";
|
2022-02-28 21:25:06 +00:00
|
|
|
import TooltipWrapper from "components/TooltipWrapper";
|
2021-11-29 23:29:41 +00:00
|
|
|
|
|
|
|
|
const baseClass = "preview-data-modal";
|
|
|
|
|
|
|
|
|
|
interface IPreviewDataModalProps {
|
|
|
|
|
onCancel: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const PreviewDataModal = ({
|
|
|
|
|
onCancel,
|
|
|
|
|
}: IPreviewDataModalProps): JSX.Element => {
|
|
|
|
|
const json = {
|
|
|
|
|
action: "snapshot",
|
|
|
|
|
snapshot: [
|
|
|
|
|
{
|
|
|
|
|
remote_address: "0.0.0.0",
|
|
|
|
|
remote_port: "0",
|
|
|
|
|
cmdline: "/usr/sbin/syslogd",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
name: "xxxxxxx",
|
|
|
|
|
hostIdentifier: "xxxxxxx",
|
|
|
|
|
calendarTime: "xxx xxx x xx:xx:xx xxxx UTC",
|
|
|
|
|
unixTime: "xxxxxxxxx",
|
|
|
|
|
epoch: "xxxxxxxxx",
|
|
|
|
|
counter: "x",
|
|
|
|
|
numerics: "x",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Modal title={"Example data"} onExit={onCancel} className={baseClass}>
|
|
|
|
|
<div className={`${baseClass}__preview-modal`}>
|
|
|
|
|
<p>
|
2022-02-28 21:25:06 +00:00
|
|
|
<TooltipWrapper
|
|
|
|
|
tipContent={`The "snapshot" key includes the query's results. These will be unique to your query.`}
|
2021-11-29 23:29:41 +00:00
|
|
|
>
|
2022-02-28 21:25:06 +00:00
|
|
|
The data sent to your configured log destination will look similar
|
|
|
|
|
to the following JSON:
|
|
|
|
|
</TooltipWrapper>
|
2021-11-29 23:29:41 +00:00
|
|
|
</p>
|
|
|
|
|
<div className={`${baseClass}__host-status-webhook-preview`}>
|
|
|
|
|
<pre dangerouslySetInnerHTML={{ __html: syntaxHighlight(json) }} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className={`${baseClass}__btn-wrap`}>
|
|
|
|
|
<Button
|
|
|
|
|
className={`${baseClass}__btn`}
|
|
|
|
|
onClick={onCancel}
|
|
|
|
|
variant="brand"
|
|
|
|
|
>
|
|
|
|
|
Done
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default PreviewDataModal;
|