Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

1.1 KB
Raw Blame
import { useTranslation } from "react-i18next";
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
import {
  getSQLEditorEditorState,
  useSQLEditorEditorState,
} from "@/modules/sql-editor/store/editor";
import { ExecuteHint } from "./ExecuteHint";

/**
 * Shows the ExecuteHint body inside a Dialog when the user attempts a DDL/DML
 * against a database that requires a change plan.
 */
export function ExecutingHintModal() {
  const { t } = useTranslation();
  const show = useSQLEditorEditorState((s) => s.isShowExecutingHint);
  const database = useSQLEditorEditorState((s) => s.executingHintDatabase);

  const handleClose = () => {
    getSQLEditorEditorState().setShowExecutingHint(false);
  };

  return (
    <Dialog open={show} onOpenChange={(next) => !next && handleClose()}>
      <DialogContent className="w-auto max-w-none p-6">
        <DialogTitle>{t("common.action-required")}</DialogTitle>
        <div className="mt-3">
          <ExecuteHint database={database} onClose={handleClose} />
        </div>
      </DialogContent>
    </Dialog>
  );
}