Skip to content

Commit

Permalink
Add some extra styling to the test connection message
Browse files Browse the repository at this point in the history
* Colour makes the message easier to understand at a glance.
  • Loading branch information
Jack-Dane committed Aug 25, 2024
1 parent 2a5de35 commit 2617226
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
8 changes: 8 additions & 0 deletions admin/pages/connections/test_connection_result.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
border: 1px solid #c3c4c7;
padding: 8px 10px;
}

.test-result-ok {
background: #ddffdd;
}

.test-result-failure {
background: #ffdddd;
}
20 changes: 11 additions & 9 deletions admin/pages/connections/test_connection_result.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<div class="wrap odoo-conn-message-notification-box">
<?php $test_result = $test_result ?? null ?>
<?php
$test_result = $test_result ?? null;
if (!is_null($test_result)) {
$connection_result_class = $test_result['success'] ? 'test-result-ok' : 'test-result-failure'
?>
<div class="wrap odoo-conn-message-notification-box <?= $connection_result_class ?>">
<h1>Test Result: <?= $test_result['success'] ? 'Success' : 'Failure' ?> </h1>

<?php if (!is_null($test_result)) { ?>
<h1>Test Result: <?= $test_result['success'] ? "Success" : "Failure" ?> </h1>

<?php if (!$test_result['success']) { ?>
<?php if (!$test_result['success']) { ?>
<!-- Display error details on failure -->
<div>
<b>Error Message: </b>
Expand All @@ -15,6 +17,6 @@
<b>Error Code: </b>
<span><?= esc_html__($test_result['error_code']) ?></span>
</div>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
<?php } ?>

0 comments on commit 2617226

Please sign in to comment.