Skip to content

Commit dfbf6d7

Browse files
author
Anders Breid
authored
Added display of error messages from server when adding subscriptions (#79)
* Fix multiple users may use frontend, request outside web gui. - Funktion to sent backend url as parameter added. - Gui users may now switch backend without affecting each other. - Before saving new instances the code will check if any new instances has been added to not overwrite instances created by other users. - switch-backend delete now recieves the backend to delete and not the backends to not delete. - If file is invalid or non existand it will be recreated. - Default back end properties may be specified in application-properties. - Default parameters may not be removed from gui but must be removed from application-properties first. - Unit tests have been added and updated. * Modified functional tests to work with the new utils changes. * Fixed some functional tests. * fixed code comments * Updated after comments * Fixed minor issues with switching back end * Added unittest for curl commando possibilities. * Extended time out to 11s * fixed some duplicated functions from comments. * updated after comments * updated after comments * Fixed functional tests * Missed to add 2 changes * updated after comments * Improved design for better useability. - Added loading indicator for buttons instead of displaying all then removing few. - Added refresh on change of back end instance. - Added more restfull way of working on front end back end details endpoints. - Better handeling of some error/messages sent to GUI from front end service. - Changed name of "Subscription Handeling" to just "Subscriptions" to be more generic. * Merge * Fix of path variable name * Improved useability and reduced read from disk * Improved useability and reduced read from disk * . * Improved error handeling, added some code comments * Fixed bug with name validation, better validations. * Fixed invalid id on one message * Renamed a class * refactor names of test methods Made name of test methods to start with small letter. Tweaks and fixes to the CSS in EI frontend. (#74) * Tweaks and fixes to the CSS in EI frontend. Update frontend example image (#76) refactor names of test methods Made name of test methods to start with small letter. Tweaks and fixes to the CSS in EI frontend. (#74) * Tweaks and fixes to the CSS in EI frontend. Improved error handeling and added some code comments. (#71) * Fix multiple users may use frontend, request outside web gui. - Funktion to sent backend url as parameter added. - Gui users may now switch backend without affecting each other. - Before saving new instances the code will check if any new instances has been added to not overwrite instances created by other users. - switch-backend delete now recieves the backend to delete and not the backends to not delete. - If file is invalid or non existand it will be recreated. - Default back end properties may be specified in application-properties. - Default parameters may not be removed from gui but must be removed from application-properties first. - Unit tests have been added and updated. * Modified functional tests to work with the new utils changes. * Fixed some functional tests. * fixed code comments * Updated after comments * Fixed minor issues with switching back end * Added unittest for curl commando possibilities. * Extended time out to 11s * fixed some duplicated functions from comments. * updated after comments * updated after comments * Fixed functional tests * Missed to add 2 changes * updated after comments * Improved design for better useability. - Added loading indicator for buttons instead of displaying all then removing few. - Added refresh on change of back end instance. - Added more restfull way of working on front end back end details endpoints. - Better handeling of some error/messages sent to GUI from front end service. - Changed name of "Subscription Handeling" to just "Subscriptions" to be more generic. * Merge * Fix of path variable name * Improved useability and reduced read from disk * Improved useability and reduced read from disk * . * Improved error handeling, added some code comments * Fixed bug with name validation, better validations. * Fixed invalid id on one message * Renamed a class Update frontend example image (#76) * Added error messages from back end when adding subs. * updated after comments * updated after comments
1 parent 2fbef0b commit dfbf6d7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/main/resources/static/js/subscription.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ jQuery(document).ready(function () {
832832
}
833833
// If errors return.
834834
if (error) {
835+
$('#errorExists').text("Required fields not filled or invalid data");
836+
$('#errorExists').show();
835837
return;
836838
}
837839
//END: Check of other subscription fields values
@@ -867,9 +869,13 @@ jQuery(document).ready(function () {
867869
},
868870
error: function (XMLHttpRequest, textStatus, errorThrown) {
869871
var responseJSON = JSON.parse(XMLHttpRequest.responseText);
872+
var errors = "";
870873
for (var i = 0; i < responseJSON.length; i++) {
874+
errors = errors + "\n" + responseJSON[i].reason;
871875
$.jGrowl(responseJSON[i].subscription + " :: " + responseJSON[i].reason, { sticky: true, theme: 'Error' });
872876
}
877+
$('#serverError').text(errors);
878+
$('#serverError').show();
873879
},
874880
complete: function () {
875881
$('#btnSave').text('save'); //change button text

src/main/resources/templates/subscription.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ <h5 style="display:inline">AND</h5>
288288
</div>
289289
<!-- /ko -->
290290

291-
<textarea data-toggle="tooltip" title="Write a Subscription Rule(JmePath)" data-bind="textInput:$data.jmespath()" name="jmespath"
291+
<textarea data-toggle="tooltip" title="Write a Subscription Rule(JmesPath)" data-bind="textInput:$data.jmespath()" name="jmespath"
292292
placeholder="jmespath" class="form-control" type="text"></textarea>
293293
<div class="pt-1 d-flex justify-content-end">
294294

@@ -321,6 +321,8 @@ <h5 style="display:inline">AND</h5>
321321
</form>
322322
</div>
323323
<div class="modal-footer">
324+
<font class="addSubscriptionErrors" id="errorExists" color="red" size="3" />
325+
<font class="addSubscriptionErrors" id="serverError" color="red" size="3" />
324326
<button data-toggle="tooltip" title="Save the changes to EI." type="button" id="btnSave" class="btn btn-primary save_record">
325327
Save
326328
</button>

0 commit comments

Comments
 (0)