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 ( -
-
-

- MySQL → MySQL Migration -

-

- Migrate complete MySQL databases . -

-
- -
- {/* Source Database */} -
-

- Source Database -

-
-
- - setSrcHost(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
-
- - setSrcUser(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
-
- - setSrcPass(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
- - {schemas.length > 0 && ( -
- - -
- )} -
-
- - {/* Target Database */} -
-

- Target Database -

-
-
- - setDestHost(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
-
- - setDestUser(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
-
- - setDestPass(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent" - /> -
-
-
-
- - {/* Migration Button */} -
- -
- - {/* Progress */} -
-

Progress

-
-
-
-
-          {JSON.stringify(progress, null, 2)}
-        
-
-
- ); -} \ No newline at end of file