mirror of
https://github.com/drawdb-io/drawdb.git
synced 2026-01-13 07:02:37 +08:00
Allow importing from sql without uploading a file (#700)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { Upload, Checkbox, Banner } from "@douyinfe/semi-ui";
|
import { Upload, Checkbox, Banner, Tabs, TabPane } from "@douyinfe/semi-ui";
|
||||||
import { STATUS } from "../../../data/constants";
|
import { STATUS } from "../../../data/constants";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import CodeEditor from "../../CodeEditor";
|
||||||
|
|
||||||
export default function ImportSource({
|
export default function ImportSource({
|
||||||
importData,
|
importData,
|
||||||
@@ -12,6 +13,21 @@ export default function ImportSource({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<Tabs>
|
||||||
|
<TabPane tab={t("insert_sql")} itemKey="text-import">
|
||||||
|
<CodeEditor
|
||||||
|
className="h-56"
|
||||||
|
language="sql"
|
||||||
|
onChange={(value) => {
|
||||||
|
setImportData((prev) => ({ ...prev, src: value }));
|
||||||
|
setError({
|
||||||
|
type: STATUS.NONE,
|
||||||
|
message: "",
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</TabPane>
|
||||||
|
<TabPane tab={t("upload_file")} itemKey="file-import">
|
||||||
<Upload
|
<Upload
|
||||||
action="#"
|
action="#"
|
||||||
beforeUpload={({ file, fileList }) => {
|
beforeUpload={({ file, fileList }) => {
|
||||||
@@ -51,6 +67,9 @@ export default function ImportSource({
|
|||||||
}
|
}
|
||||||
limit={1}
|
limit={1}
|
||||||
/>
|
/>
|
||||||
|
</TabPane>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
aria-label="overwrite checkbox"
|
aria-label="overwrite checkbox"
|
||||||
|
|||||||
@@ -279,6 +279,8 @@ const en = {
|
|||||||
failed_to_record_version: "Failed to record version",
|
failed_to_record_version: "Failed to record version",
|
||||||
failed_to_load_diagram: "Failed to load diagram",
|
failed_to_load_diagram: "Failed to load diagram",
|
||||||
see_all: "See all",
|
see_all: "See all",
|
||||||
|
insert_sql: "Insert SQL",
|
||||||
|
upload_file: "Upload file",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user