diff --git a/MySQLMySQLMigrator.jsx b/MySQLMySQLMigrator.jsx deleted file mode 100644 index 3b3c1bb..0000000 --- a/MySQLMySQLMigrator.jsx +++ /dev/null @@ -1,206 +0,0 @@ -import { useState } from "react"; -import { getSchemas, getTables, startMigration, getProgress } from "../api"; - -export default function MySQLMySQLMigrator() { - const [srcHost, setSrcHost] = useState(""); - const [srcUser, setSrcUser] = useState(""); - const [srcPass, setSrcPass] = useState(""); - const [schemas, setSchemas] = useState([]); - const [selectedSchemas, setSelectedSchemas] = useState([]); - const [destHost, setDestHost] = useState(""); - const [destUser, setDestUser] = useState(""); - const [destPass, setDestPass] = useState(""); - const [progress, setProgress] = useState({ percent: 0, message: "Waiting to start..." }); - const [loading, setLoading] = useState(false); - - const loadSchemas = async () => { - setLoading(true); - try { - const data = await getSchemas("mysql_mysql", { host: srcHost, user: srcUser, pass: srcPass }); - setSchemas(data.schemas || []); - if (data.error) { - alert("Error loading databases: " + data.error); - } - } catch { - setSchemas([]); - } finally { - setLoading(false); - } - }; - - const handleMigration = async () => { - const payload = { - SRC_HOST: srcHost, - SRC_USER: srcUser, - SRC_PASS: srcPass, - DEST_HOST: destHost, - DEST_USER: destUser, - DEST_PASS: destPass, - DATABASES: selectedSchemas - }; - try { - const data = await startMigration("mysql_mysql", payload); - if (data.success) { - pollProgress(); - } else { - alert("Migration failed: " + (data.error || "Unknown error")); - } - } catch (error) { - console.error("Error starting migration:", error); - alert("Connection error: " + error.message); - } - }; - - const pollProgress = async () => { - try { - const data = await getProgress("mysql_mysql"); - setProgress(data); - if (data.status === "error") { - alert("Migration error: " + (data.message || "Unknown error")); - } else if (data.percent < 100 && data.status !== "completed") { - setTimeout(pollProgress, 2000); - } - } catch (error) { - console.error("Error polling progress:", error); - setTimeout(pollProgress, 2000); - } - }; - - return ( -
- Migrate complete MySQL databases . -
-
- {JSON.stringify(progress, null, 2)}
-
-