Remove select dbms from import source modal

This commit is contained in:
1ilit 2024-04-02 00:38:53 +03:00
parent 6fda5356b0
commit 5347f75529

View File

@ -28,7 +28,6 @@ import {
Toast, Toast,
SideSheet, SideSheet,
List, List,
Select,
Checkbox, Checkbox,
} from "@douyinfe/semi-ui"; } from "@douyinfe/semi-ui";
import timeLine from "../../assets/process.png"; import timeLine from "../../assets/process.png";
@ -44,7 +43,13 @@ import {
jsonToSQLServer, jsonToSQLServer,
} from "../../utils/toSQL"; } from "../../utils/toSQL";
import { IconAddTable, IconAddArea, IconAddNote } from "../CustomIcons"; import { IconAddTable, IconAddArea, IconAddNote } from "../CustomIcons";
import { ObjectType, Action, Tab, State, Cardinality } from "../../data/constants"; import {
ObjectType,
Action,
Tab,
State,
Cardinality,
} from "../../data/constants";
import jsPDF from "jspdf"; import jsPDF from "jspdf";
import { useHotkeys } from "react-hotkeys-hook"; import { useHotkeys } from "react-hotkeys-hook";
import { Validator } from "jsonschema"; import { Validator } from "jsonschema";
@ -62,7 +67,10 @@ import useTables from "../../hooks/useTables";
import useUndoRedo from "../../hooks/useUndoRedo"; import useUndoRedo from "../../hooks/useUndoRedo";
import useSelect from "../../hooks/useSelect"; import useSelect from "../../hooks/useSelect";
import { enterFullscreen, exitFullscreen } from "../../utils/fullscreen"; import { enterFullscreen, exitFullscreen } from "../../utils/fullscreen";
import { ddbDiagramIsValid, jsonDiagramIsValid } from "../../utils/validateSchema"; import {
ddbDiagramIsValid,
jsonDiagramIsValid,
} from "../../utils/validateSchema";
import { dataURItoBlob } from "../../utils/utils"; import { dataURItoBlob } from "../../utils/utils";
import useAreas from "../../hooks/useAreas"; import useAreas from "../../hooks/useAreas";
import useNotes from "../../hooks/useNotes"; import useNotes from "../../hooks/useNotes";
@ -1297,13 +1305,11 @@ export default function ControlPanel({
const parser = new Parser(); const parser = new Parser();
let ast = null; let ast = null;
try { try {
console.log(data.dbms); ast = parser.astify(data.src, { database: "MySQL" });
ast = parser.astify(data.src, { database: data.dbms });
} catch (err) { } catch (err) {
Toast.error( Toast.error(
"Could not parse the sql file. Make sure there are no syntax errors." "Could not parse the sql file. Make sure there are no syntax errors."
); );
console.log(err);
return; return;
} }
@ -1793,17 +1799,10 @@ export default function ControlPanel({
} }
limit={1} limit={1}
></Upload> ></Upload>
<div className="my-2"> <div>
<div className="text-sm font-semibold mb-1">Select DBMS</div> <div className="text-xs mb-3 mt-1 opacity-80">
<Select * For the time being loading only MySQL scripts is supported.
defaultValue="MySQL" </div>
optionList={[
{ value: "MySQL", label: "MySQL" },
{ value: "Postgresql", label: "PostgreSQL" },
]}
onChange={(e) => setData((prev) => ({ ...prev, dbms: e }))}
className="w-full"
/>
<Checkbox <Checkbox
aria-label="overwrite checkbox" aria-label="overwrite checkbox"
checked={data.overwrite} checked={data.overwrite}
@ -1811,7 +1810,6 @@ export default function ControlPanel({
onChange={(e) => onChange={(e) =>
setData((prev) => ({ ...prev, overwrite: e.target.checked })) setData((prev) => ({ ...prev, overwrite: e.target.checked }))
} }
className="my-2"
> >
Overwrite existing diagram Overwrite existing diagram
</Checkbox> </Checkbox>