Allow importing from sql without uploading a file (#700)

This commit is contained in:
1ilit
2025-11-15 22:42:08 +04:00
committed by GitHub
parent c4e57596c4
commit ee542bd8eb
2 changed files with 60 additions and 39 deletions

View File

@@ -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"

View File

@@ -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",
}, },
}; };