From 4ce62a08b3a2b06ba11ae6932388f33aa72ff547 Mon Sep 17 00:00:00 2001 From: mustafa_98 Date: Fri, 16 Jan 2026 23:06:33 +0000 Subject: [PATCH] =?UTF-8?q?=D8=AD=D8=B0=D9=81=20PostgreSQLS3Migrator.jsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PostgreSQLS3Migrator.jsx | 180 --------------------------------------- 1 file changed, 180 deletions(-) delete mode 100644 PostgreSQLS3Migrator.jsx diff --git a/PostgreSQLS3Migrator.jsx b/PostgreSQLS3Migrator.jsx deleted file mode 100644 index 50ee824..0000000 --- a/PostgreSQLS3Migrator.jsx +++ /dev/null @@ -1,180 +0,0 @@ -import { useState } from "react"; -import { startMigration, getProgress } from "../api"; - -export default function PostgreSQLS3Migrator() { - const [srcHost, setSrcHost] = useState(""); - const [srcUser, setSrcUser] = useState(""); - const [srcPass, setSrcPass] = useState(""); - const [dbName, setDbName] = useState(""); - const [destBucket, setDestBucket] = useState(""); - const [awsAccess, setAwsAccess] = useState(""); - const [awsSecret, setAwsSecret] = useState(""); - const [progress, setProgress] = useState({ percent: 0, message: "Waiting to start..." }); - - const handleMigration = async () => { - const payload = { - DB_HOST: srcHost, - DB_USER: srcUser, - DB_PASS: srcPass, - DB_NAME: dbName, - DEST_BUCKET: destBucket, - DEST_ENDPOINT: "https://s3.amazonaws.com", - DEST_ACCESS: awsAccess, - DEST_SECRET: awsSecret - }; - try { - const data = await startMigration("psql_s3", 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("psql_s3"); - 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 ( -
-
-

- PostgreSQL → S3 Migration -

-

- Export PostgreSQL database to a compressed file in S3. -

-
- -
- {/* PostgreSQL Database */} -
-

- PostgreSQL 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" - /> -
-
- - setDbName(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" - /> -
-
-
- - {/* S3 Target */} -
-

- S3 Target -

-
-
- - setDestBucket(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" - /> -
-
- - setAwsAccess(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" - /> -
-
- - setAwsSecret(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