Skip to content

Commit 0517e7f

Browse files
authored
FFWEB-3262: Add more information for test connection button
Add more validation information for test connection button
1 parent e920aff commit 0517e7f

7 files changed

Lines changed: 36 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
2+
## Unreleased
3+
### Change
4+
- Add more validation informations for test connection btn
5+
26
## [v6.4.1] - 2025.06.26
37
### Fix
48
- Support tab navigation for `ff-asn` (EAA)

src/Api/TestConnectionController.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ public function testApiConnection(): JsonResponse
4646
return new JsonResponse(['message' => 'Connection successfully established'], 200);
4747
} catch (\Exception $e) {
4848
$this->factfinderLogger->error($e->getMessage());
49+
$errorDescription = $this->getErrorDescription($e->getMessage());
4950

50-
return new JsonResponse(['message' => 'Connection could not be established'], 400);
51+
return new JsonResponse(['message' => $errorDescription], 400);
5152
}
5253
}
5354

@@ -94,8 +95,9 @@ public function testPushImportApiConnection(): JsonResponse
9495
return new JsonResponse(['message' => 'Connection successfully established'], 200);
9596
} catch (\Exception $e) {
9697
$this->factfinderLogger->error($e->getMessage());
98+
$errorDescription = $this->getErrorDescription($e->getMessage());
9799

98-
return new JsonResponse(['message' => 'Connection could not be established'], 400);
100+
return new JsonResponse(['message' => $errorDescription], 400);
99101
}
100102
}
101103

@@ -106,4 +108,17 @@ private function createTestEndpoint(): string
106108

107109
return "rest/{$apiVersion}/records/{$channel}/compare";
108110
}
111+
112+
private function getErrorDescription(string $errorMessage): string
113+
{
114+
preg_match('/\{.*?\}/', $errorMessage, $matches);
115+
116+
if (!empty($matches[0])) {
117+
$json = json_decode($matches[0], true);
118+
119+
return $json['errorDescription'] ?? 'Check logs for more information.';
120+
}
121+
122+
return 'Check logs for more information.';
123+
}
109124
}

src/Resources/app/administration/src/module/configuration/component/test-api-connection/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ Component.register('test-api-connection', {
4242
});
4343
}
4444
})
45-
.catch(() => {
45+
.catch((error) => {
46+
const errorMessage = error.response?.data?.message ||
47+
Shopware.Snippet.tc('configuration.testConnection.helpText');
48+
4649
this.createNotificationError({
4750
title: Shopware.Snippet.tc('configuration.testConnection.fail'),
48-
message: Shopware.Snippet.tc('configuration.testConnection.helpText')
49-
});
51+
message: errorMessage
52+
});
5053
})
5154
.finally(() => {
5255
this.isSaveSuccessful = true;

src/Resources/app/administration/src/module/configuration/component/test-push-import-connection/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ Component.register('test-push-import-connection', {
4141
});
4242
}
4343
})
44-
.catch(() => {
44+
.catch((error) => {
45+
const errorMessage = error.response?.data?.message ||
46+
Shopware.Snippet.tc('configuration.testConnection.helpText');
47+
4548
this.createNotificationError({
4649
title: Shopware.Snippet.tc('configuration.testConnection.fail'),
47-
message: Shopware.Snippet.tc('configuration.testConnection.helpText')
48-
});
50+
message: errorMessage
51+
});
4952
})
5053
.finally(() => {
5154
this.isSaveSuccessful = true;

src/Resources/app/administration/src/module/configuration/snippet/de-DE.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"testConnection": {
88
"success": "Verbindung erfolgreich hergestellt.",
99
"fail": "Die Verbindung konnte nicht hergestellt werden.",
10-
"helpText": "Bitte speichern Sie Ihre aktuelle Konfiguration, bevor Sie die Verbindung testen"
10+
"helpText": "Bitte speichern Sie Ihre aktuelle Konfiguration, bevor Sie die Verbindung testen und überprüfen Sie die Fehlerprotokolle für weitere Informationen"
1111
},
1212
"testApiConnection": {
1313
"testConnection": "Testverbindung"

src/Resources/app/administration/src/module/configuration/snippet/en-GB.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"testConnection": {
88
"success": "Connection successfully established.",
99
"fail": "Connection could not be established.",
10-
"helpText": "Please save you current configuration before test connection"
10+
"helpText": "Please save you current configuration before test connection and check the error logs for more information"
1111
},
1212
"testApiConnection": {
1313
"testConnection": "Test Connection"

src/Resources/public/administration/js/omikron-fact-finder.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)