2022-08-29 19:11:30 +00:00
|
|
|
import React from "react";
|
|
|
|
|
|
2025-01-31 18:37:56 +00:00
|
|
|
import SQLEditor from "components/SQLEditor";
|
2022-08-29 19:11:30 +00:00
|
|
|
import Modal from "components/Modal";
|
|
|
|
|
import Button from "components/buttons/Button";
|
2023-12-14 19:49:56 +00:00
|
|
|
import PerformanceImpactCell from "components/TableContainer/DataTable/PerformanceImpactCell";
|
2026-01-02 13:06:12 +00:00
|
|
|
import { PerformanceImpactIndicator } from "interfaces/schedulable_query";
|
2022-08-29 19:11:30 +00:00
|
|
|
|
|
|
|
|
const baseClass = "show-query-modal";
|
|
|
|
|
|
|
|
|
|
interface IShowQueryModalProps {
|
|
|
|
|
onCancel: () => void;
|
|
|
|
|
query?: string;
|
2026-01-02 13:06:12 +00:00
|
|
|
impact?: PerformanceImpactIndicator;
|
2022-08-29 19:11:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ShowQueryModal = ({
|
|
|
|
|
query,
|
2023-12-14 19:49:56 +00:00
|
|
|
impact,
|
2022-08-29 19:11:30 +00:00
|
|
|
onCancel,
|
|
|
|
|
}: IShowQueryModalProps): JSX.Element => {
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
2024-02-23 14:57:18 +00:00
|
|
|
title="Query"
|
2022-08-29 19:11:30 +00:00
|
|
|
onExit={onCancel}
|
|
|
|
|
onEnter={onCancel}
|
|
|
|
|
className={baseClass}
|
|
|
|
|
>
|
|
|
|
|
<div className={baseClass}>
|
2025-01-31 18:37:56 +00:00
|
|
|
<SQLEditor
|
2022-08-29 19:11:30 +00:00
|
|
|
value={query}
|
2023-02-28 17:55:56 +00:00
|
|
|
name="Query"
|
2022-08-29 19:11:30 +00:00
|
|
|
wrapperClassName={`${baseClass}__text-editor-wrapper`}
|
|
|
|
|
wrapEnabled
|
|
|
|
|
readOnly
|
|
|
|
|
/>
|
2023-12-14 19:49:56 +00:00
|
|
|
{impact && (
|
|
|
|
|
<div className={`${baseClass}__performance-impact`}>
|
|
|
|
|
Performance impact:{" "}
|
|
|
|
|
<PerformanceImpactCell value={{ indicator: impact }} />
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2022-08-29 19:11:30 +00:00
|
|
|
<div className="modal-cta-wrap">
|
2025-04-16 13:56:09 +00:00
|
|
|
<Button onClick={onCancel}>Done</Button>
|
2022-08-29 19:11:30 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default ShowQueryModal;
|