Skip to content

Commit 66abf45

Browse files
authored
Fix notification issues (#67)
* Fix notification issues - Error messages from "Find Aggregated Object" produced 2 errors, 1 which were empty if there was no backend running. Now there is only one message and it will tell if the backend is not running. - Error messages from upload buttons on subscription page and test rules page produced an alert besides the normal error message field. They are now removed. - Eiffel intelligence info menu link showed no text. The message is now removed as the page already says that the server cannot be contacted. - Other minor message errors.
1 parent b283396 commit 66abf45

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/main/resources/static/js/eiInfo.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ jQuery(document).ready(function() {
143143
contentType : 'application/json;charset=UTF-8',
144144
type: 'GET',
145145
error : function (XMLHttpRequest, textStatus, errorThrown) {
146-
window.logMessages(XMLHttpRequest.responseText);
147146
if (XMLHttpRequest.responseText == "") {
148147
document.getElementById("eiPageFrame").innerHTML = "<h3 style=\"text-align: center;\">There is no response from backend</h3>";
149148
} else {

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ jQuery(document).ready(function () {
448448

449449
// Check if no Subscription has been marked to be deleted.
450450
if (subscriptionsToDelete.length < 1) {
451-
$.alert("No subscriptions has been marked to be deleted.");
451+
window.logMessages("No subscriptions has been marked to be deleted.");
452452
return;
453453
}
454454

@@ -505,8 +505,12 @@ jQuery(document).ready(function () {
505505
req.open("GET", frontendServiceUrl + '/download/subscriptionsTemplate', true);
506506
req.responseType = "application/json;charset=utf-8";
507507
req.onload = function (event) {
508-
var jsonData = JSON.stringify(JSON.parse(req.response), null, 2);
509-
downloadFile(jsonData, "application/json;charset=utf-8", "subscriptionsTemplate.json");
508+
if (this.responseText == ""){
509+
window.logMessages("Failed to download template, Error: Could not contact the backend server.");
510+
} else {
511+
var jsonData = JSON.stringify(JSON.parse(req.response), null, 2);
512+
downloadFile(jsonData, "application/json;charset=utf-8", "subscriptionsTemplate.json");
513+
}
510514
};
511515
req.send();
512516
}
@@ -530,7 +534,6 @@ jQuery(document).ready(function () {
530534
jsonLintResult = jsonlint.parse(fileContent);
531535
} catch (e) {
532536
window.logMessages("JSON Format Check Failed:\n" + e.name + "\n" + e.message);
533-
$.alert("JSON Format Check Failed:\n" + e.name + "\n" + e.message);
534537
return false;
535538
}
536539
$.jGrowl('JSON Format Check Succeeded', {

src/main/resources/static/js/testrules.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jQuery(document).ready(
4141
callback.beforeSend();
4242
},
4343
error : function(XMLHttpRequest, textStatus, errorThrown) {
44-
window.logMessages(XMLHttpRequest.responseText);
4544
callback.error(XMLHttpRequest, textStatus, errorThrown);
4645
},
4746
success : function(data, textStatus) {
@@ -140,7 +139,11 @@ jQuery(document).ready(
140139
}
141140
},
142141
error : function(XMLHttpRequest, textStatus, errorThrown) {
143-
window.logMessages("Failed to generate the aggregated object" + " Error: " + XMLHttpRequest.responseText);
142+
if (XMLHttpRequest.responseText == ""){
143+
window.logMessages("Failed to generate the aggregated object, Error: Could not contact the backend server.");
144+
} else {
145+
window.logMessages("Failed to generate the aggregated object, Error: " + XMLHttpRequest.responseText);
146+
}
144147
},
145148
complete : function() {
146149
}
@@ -179,7 +182,6 @@ jQuery(document).ready(
179182
jsonLintResult = jsonlint.parse(fileContent);
180183
} catch (e) {
181184
window.logMessages("JSON Format Check Failed:\n" + e.name + "\n" + e.message);
182-
$.alert("JSON Format Check Failed:\n" + e.name + "\n" + e.message);
183185
return false;
184186
}
185187
$.jGrowl('JSON Format Check Succeeded', {
@@ -209,7 +211,6 @@ jQuery(document).ready(
209211
jsonLintResult = jsonlint.parse(fileContent);
210212
} catch (e) {
211213
window.logMessages("JSON events Format Check Failed:\n" + e.name + "\n" + e.message);
212-
$.alert("JSON events Format Check Failed:\n" + e.name + "\n" + e.message);
213214
return false;
214215
}
215216
$.jGrowl('JSON events Format Check Succeeded', {
@@ -326,8 +327,12 @@ jQuery(document).ready(
326327
request.open("GET", frontendServiceUrl + '/download/' + name, true);
327328
request.responseType = "application/json;charset=utf-8";
328329
request.onload = function (event) {
329-
var jsonData = JSON.stringify(JSON.parse(request.response), null, 2);
330-
downloadFile(jsonData, "application/json;charset=utf-8", name + ".json");
330+
if (this.responseText == ""){
331+
window.logMessages("Failed to download template, Error: Could not contact the backend server.");
332+
} else {
333+
var jsonData = JSON.stringify(JSON.parse(request.response), null, 2);
334+
downloadFile(jsonData, "application/json;charset=utf-8", name + ".json");
335+
}
331336
};
332337
request.send();
333338
}

0 commit comments

Comments
 (0)