mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-10-18 16:53:58 +00:00
Set up multiple imports for generic diagrams
This commit is contained in:
@@ -740,7 +740,30 @@ export default function ControlPanel({
|
||||
shortcut: "Ctrl+I",
|
||||
},
|
||||
import_from_source: {
|
||||
function: () => setModal(MODAL.IMPORT_SRC),
|
||||
...(database === DB.GENERIC && {
|
||||
children: [
|
||||
{
|
||||
MySQL: () => setModal(MODAL.IMPORT_SRC),
|
||||
},
|
||||
// {
|
||||
// PostgreSQL: () => setModal(MODAL.IMPORT_SRC),
|
||||
// },
|
||||
{
|
||||
SQLite: () => setModal(MODAL.IMPORT_SRC),
|
||||
},
|
||||
// {
|
||||
// MariaDB: () => setModal(MODAL.IMPORT_SRC),
|
||||
// },
|
||||
// {
|
||||
// MSSQL: () => setModal(MODAL.IMPORT_SRC),
|
||||
// },
|
||||
],
|
||||
}),
|
||||
function: () => {
|
||||
if (database === DB.GENERIC) return;
|
||||
|
||||
setModal(MODAL.IMPORT_SRC)
|
||||
},
|
||||
},
|
||||
export_as: {
|
||||
children: [
|
||||
|
@@ -19,7 +19,6 @@ import {
|
||||
} from "../../../hooks";
|
||||
import { saveAs } from "file-saver";
|
||||
import { Parser } from "node-sql-parser";
|
||||
import { astToDiagram } from "../../../utils/astToDiagram";
|
||||
import { getModalTitle, getOkText } from "../../../utils/modalTitles";
|
||||
import Rename from "./Rename";
|
||||
import Open from "./Open";
|
||||
@@ -34,6 +33,7 @@ import { vscodeDark } from "@uiw/codemirror-theme-vscode";
|
||||
import { json } from "@codemirror/lang-json";
|
||||
import { githubLight } from "@uiw/codemirror-theme-github";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { importSQL } from "../../../utils/importSQL";
|
||||
|
||||
const languageExtension = {
|
||||
sql: [sql()],
|
||||
@@ -136,7 +136,7 @@ export default function Modal({
|
||||
return;
|
||||
}
|
||||
|
||||
const d = astToDiagram(ast);
|
||||
const d = importSQL(ast);
|
||||
if (importSource.overwrite) {
|
||||
setTables(d.tables);
|
||||
setRelationships(d.relationships);
|
||||
|
Reference in New Issue
Block a user