Skip to content

Commit a956dcc

Browse files
FIX (whitelist): Show hint about Postgresus whitelist in case of connection failure
1 parent ce9fa18 commit a956dcc

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

frontend/src/features/databases/ui/edit/EditDatabaseSpecificDataComponent.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ export const EditDatabaseSpecificDataComponent = ({
4848

4949
const [isConnectionTested, setIsConnectionTested] = useState(false);
5050
const [isTestingConnection, setIsTestingConnection] = useState(false);
51+
const [isConnectionFailed, setIsConnectionFailed] = useState(false);
5152

5253
const testConnection = async () => {
5354
if (!editingDatabase) return;
5455
setIsTestingConnection(true);
56+
setIsConnectionFailed(false);
5557

5658
try {
5759
await databaseApi.testDatabaseConnectionDirect(editingDatabase);
@@ -61,6 +63,7 @@ export const EditDatabaseSpecificDataComponent = ({
6163
description: 'You can continue with the next step',
6264
});
6365
} catch (e) {
66+
setIsConnectionFailed(true);
6467
alert((e as Error).message);
6568
}
6669

@@ -89,6 +92,7 @@ export const EditDatabaseSpecificDataComponent = ({
8992
setIsSaving(false);
9093
setIsConnectionTested(false);
9194
setIsTestingConnection(false);
95+
setIsConnectionFailed(false);
9296

9397
setEditingDatabase({ ...database });
9498
}, [database]);
@@ -327,6 +331,13 @@ export const EditDatabaseSpecificDataComponent = ({
327331
</Button>
328332
)}
329333
</div>
334+
335+
{isConnectionFailed && (
336+
<div className="mt-3 text-sm text-gray-500 dark:text-gray-400">
337+
If your database uses IP whitelist, make sure Postgresus server IP is added to the allowed
338+
list.
339+
</div>
340+
)}
330341
</div>
331342
);
332343
};

frontend/src/features/notifiers/ui/edit/notifiers/EditWebhookNotifierComponent.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export function EditWebhookNotifierComponent({ notifier, setNotifier, setUnsaved
217217
)}
218218

219219
{notifier?.webhookNotifier?.webhookMethod === WebhookMethod.POST && (
220-
<div className="rounded bg-gray-100 p-2 px-3 font-mono text-sm break-all whitespace-pre-line dark:bg-gray-800">
220+
<div className="rounded bg-gray-100 p-2 px-3 font-mono text-sm break-words whitespace-pre-wrap dark:bg-gray-800">
221221
<div className="font-semibold text-blue-600 dark:text-blue-400">
222222
POST {notifier?.webhookNotifier?.webhookUrl}
223223
</div>
@@ -230,7 +230,7 @@ export function EditWebhookNotifierComponent({ notifier, setNotifier, setUnsaved
230230
.map((h) => `\n${h.key}: ${h.value}`)
231231
.join('')}
232232
</div>
233-
<div className="mt-2 whitespace-pre">
233+
<div className="mt-2 break-words whitespace-pre-wrap">
234234
{notifier?.webhookNotifier?.bodyTemplate
235235
? notifier.webhookNotifier.bodyTemplate
236236
.replace(
@@ -242,8 +242,8 @@ export function EditWebhookNotifierComponent({ notifier, setNotifier, setUnsaved
242242
'Backup completed successfully in 1m 23s.\\nCompressed backup size: 256.00 MB',
243243
)
244244
: `{
245-
"heading": "✅ Backup completed for database \\"my-database\\" (workspace \\"My workspace\\")",
246-
"message": "Backup completed successfully in 1m 23s.\\nCompressed backup size: 256.00 MB"
245+
"heading": "✅ Backup completed for database "my-database" (workspace "My workspace")",
246+
"message": "Backup completed successfully in 1m 23s. Compressed backup size: 256.00 MB"
247247
}`}
248248
</div>
249249
</div>

0 commit comments

Comments
 (0)