- {editingDatabase.type === DatabaseType.POSTGRES && (
- <>
-
-
-
-
- Parse from clipboard
-
-
-
-
-
Host
-
{
- if (!editingDatabase.postgresql) return;
-
- const updatedDatabase = {
- ...editingDatabase,
- postgresql: {
- ...editingDatabase.postgresql,
- host: e.target.value.trim().replace('https://', '').replace('http://', ''),
- },
- };
- setEditingDatabase(autoAddPublicSchemaForSupabase(updatedDatabase));
- setIsConnectionTested(false);
- }}
- size="small"
- className="max-w-[200px] grow"
- placeholder="Enter PG host"
- />
-
-
- {isLocalhostDb && (
-
- )}
-
- {isSupabaseDb && (
-
- )}
-
-
-
Port
-
{
- if (!editingDatabase.postgresql || e === null) return;
-
- setEditingDatabase({
- ...editingDatabase,
- postgresql: { ...editingDatabase.postgresql, port: e },
- });
- setIsConnectionTested(false);
- }}
- size="small"
- className="max-w-[200px] grow"
- placeholder="Enter PG port"
- />
-
-
-
-
Username
-
{
- if (!editingDatabase.postgresql) return;
-
- const updatedDatabase = {
- ...editingDatabase,
- postgresql: { ...editingDatabase.postgresql, username: e.target.value.trim() },
- };
- setEditingDatabase(autoAddPublicSchemaForSupabase(updatedDatabase));
- setIsConnectionTested(false);
- }}
- size="small"
- className="max-w-[200px] grow"
- placeholder="Enter PG username"
- />
-
-
-
-
Password
-
{
- if (!editingDatabase.postgresql) return;
-
- setEditingDatabase({
- ...editingDatabase,
- postgresql: { ...editingDatabase.postgresql, password: e.target.value.trim() },
- });
- setIsConnectionTested(false);
- }}
- size="small"
- className="max-w-[200px] grow"
- placeholder="Enter PG password"
- />
-
-
- {isShowDbName && (
-
-
DB name
-
{
- if (!editingDatabase.postgresql) return;
-
- setEditingDatabase({
- ...editingDatabase,
- postgresql: { ...editingDatabase.postgresql, database: e.target.value.trim() },
- });
- setIsConnectionTested(false);
- }}
- size="small"
- className="max-w-[200px] grow"
- placeholder="Enter PG database name"
- />
-
- )}
-
-
-
Use HTTPS
-
{
- if (!editingDatabase.postgresql) return;
-
- setEditingDatabase({
- ...editingDatabase,
- postgresql: { ...editingDatabase.postgresql, isHttps: checked },
- });
- setIsConnectionTested(false);
- }}
- size="small"
- />
-
-
-
-
setShowAdvanced(!isShowAdvanced)}
- >
- Advanced settings
-
- {isShowAdvanced ? (
-
- ) : (
-
- )}
-
-
-
- {isShowAdvanced && (
- <>
- {!isRestoreMode && (
-
-
Include schemas
-
{
- if (!editingDatabase.postgresql) return;
-
- setEditingDatabase({
- ...editingDatabase,
- postgresql: { ...editingDatabase.postgresql, includeSchemas: values },
- });
- }}
- size="small"
- className="max-w-[200px] grow"
- placeholder="All schemas (default)"
- tokenSeparators={[',']}
- />
-
- )}
-
- {isRestoreMode && (
-
-
Exclude extensions
-
- {
- if (!editingDatabase.postgresql) return;
-
- setEditingDatabase({
- ...editingDatabase,
- postgresql: {
- ...editingDatabase.postgresql,
- isExcludeExtensions: e.target.checked,
- },
- });
- }}
- >
- Skip extensions
-
-
-
-
-
-
-
- )}
- >
- )}
- >
- )}
-
-
- {isShowCancelButton && (
- onCancel()}>
- Cancel
-
- )}
-
- {isShowBackButton && (
- onBack()}>
- Back
-
- )}
-
- {!isConnectionTested && (
- testConnection()}
- loading={isTestingConnection}
- disabled={!isAllFieldsFilled}
- className="mr-5"
- >
- Test connection
-
- )}
-
- {isConnectionTested && (
- saveDatabase()}
- loading={isSaving}
- disabled={!isAllFieldsFilled}
- className="mr-5"
- >
- {saveButtonText || 'Save'}
-
- )}
-
-
- {isConnectionFailed && (
-
- If your database uses IP whitelist, make sure Postgresus server IP is added to the allowed
- list.
-
- )}
-
- );
+ return null;
};
diff --git a/frontend/src/features/databases/ui/edit/EditMySqlSpecificDataComponent.tsx b/frontend/src/features/databases/ui/edit/EditMySqlSpecificDataComponent.tsx
new file mode 100644
index 0000000..07988df
--- /dev/null
+++ b/frontend/src/features/databases/ui/edit/EditMySqlSpecificDataComponent.tsx
@@ -0,0 +1,344 @@
+import { CopyOutlined } from '@ant-design/icons';
+import { App, Button, Input, InputNumber, Switch } from 'antd';
+import { useEffect, useState } from 'react';
+
+import { type Database, databaseApi } from '../../../../entity/databases';
+import { MySqlConnectionStringParser } from '../../../../entity/databases/model/mysql/MySqlConnectionStringParser';
+import { ToastHelper } from '../../../../shared/toast';
+
+interface Props {
+ database: Database;
+
+ isShowCancelButton?: boolean;
+ onCancel: () => void;
+
+ isShowBackButton: boolean;
+ onBack: () => void;
+
+ saveButtonText?: string;
+ isSaveToApi: boolean;
+ onSaved: (database: Database) => void;
+
+ isShowDbName?: boolean;
+}
+
+export const EditMySqlSpecificDataComponent = ({
+ database,
+
+ isShowCancelButton,
+ onCancel,
+
+ isShowBackButton,
+ onBack,
+
+ saveButtonText,
+ isSaveToApi,
+ onSaved,
+ isShowDbName = true,
+}: Props) => {
+ const { message } = App.useApp();
+
+ const [editingDatabase, setEditingDatabase] = useState