Skip to content

Commit

Permalink
Added the error modal for Internal Server Error
Browse files Browse the repository at this point in the history
  • Loading branch information
NoorMuhammad1 committed Jul 4, 2024
1 parent 9ec0cb4 commit 17b1d4e
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 4 deletions.
68 changes: 64 additions & 4 deletions app/js/backbone-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,13 @@ var NeighborhoodQueryView = Backbone.View.extend({
new PromptEmptyQueryResultView({
el: "#prompt-emptyQueryResult-table",
}).render();
} else {
}
else if (!data.error && data.response.statusCode == 500){
new InternalServerError({
el: "#prompt-internal-server-table",
}).render();
}
else {
new PromptInvalidQueryView({
el: "#prompt-invalidQuery-table",
}).render();
Expand Down Expand Up @@ -2443,7 +2449,13 @@ var PathsBetweenQueryView = Backbone.View.extend({
el: "#prompt-requestTimedOut-table",
}).render();
}
} else {
}
else if (!data.error && data.response.statusCode == 500){
new InternalServerError({
el: "#prompt-internal-server-table",
}).render();
}
else {
new PromptInvalidQueryView({
el: "#prompt-invalidQuery-table",
}).render();
Expand Down Expand Up @@ -2741,6 +2753,11 @@ var PathsFromToQueryView = Backbone.View.extend({
el: "#prompt-requestTimedOut-table",
}).render();
}
}
else if (!data.error && data.response.statusCode == 500){
new InternalServerError({
el: "#prompt-internal-server-table",
}).render();
}
else {
new PromptInvalidQueryView({
Expand Down Expand Up @@ -2930,6 +2947,7 @@ var CommonStreamQueryView = Backbone.View.extend({
url: "/utilities/testURL",
data: { url: queryURL },
success: function (data) {
console.log('recieved data:',data);
if (!data.error && data.response.statusCode == 200) {
if (data.response.body !== "") {
var xml = $.parseXML(data.response.body);
Expand Down Expand Up @@ -2962,14 +2980,21 @@ var CommonStreamQueryView = Backbone.View.extend({
el: "#prompt-requestTimedOut-table",
}).render();
}
} else {
}
else if (!data.error && data.response.statusCode == 500){
new InternalServerError({
el: "#prompt-internal-server-table",
}).render();
}
else {
new PromptInvalidQueryView({
el: "#prompt-invalidQuery-table",
}).render();
}
chiseInstance.endSpinner("common-stream-spinner");
},
error: function (xhr, options, err) {
console.log(xhr,options,err);
new PromptInvalidQueryView({
el: "#prompt-invalidQuery-table",
}).render();
Expand Down Expand Up @@ -3124,7 +3149,13 @@ var PathsByURIQueryView = Backbone.View.extend({
el: "#prompt-requestTimedOut-table",
}).render();
}
} else {
}
else if (!data.error && data.response.statusCode == 500){
new InternalServerError({
el: "#prompt-internal-server-table",
}).render();
}
else {
new PromptInvalidURIView({
el: "#prompt-invalidURI-table",
}).render();
Expand Down Expand Up @@ -4095,6 +4126,35 @@ var PromptMapTypeView = Backbone.View.extend({
},
});

var InternalServerError = Backbone.View.extend({
initialize: function () {
var self = this;
self.template = _.template($("#prompt-internal-server-template").html());
},
render: function () {
var self = this;
self.template = _.template($("#prompt-internal-server-template").html());

$(self.el).html(self.template);
$(self.el).modal("show");

$(document)
.off("click", "#prompt-internal-server-confirm")
.on("click", "#prompt-internal-server-confirm", function (evt) {
$(self.el).modal("toggle");
if (PCdialog == "Neighborhood")
appUtilities.neighborhoodQueryView.render();
else if (PCdialog == "PathsBetween")
appUtilities.pathsBetweenQueryView.render();
else if (PCdialog == "PathsFromTo")
appUtilities.pathsFromToQueryView.render();
else if (PCdialog == "CommonStream")
appUtilities.commonStreamQueryView.render();
});

return this;
},
});
var PromptInvalidQueryView = Backbone.View.extend({
initialize: function () {
var self = this;
Expand Down
40 changes: 40 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,15 @@
<!-- map type change confirmation dialog will be shown here-->
</div>

<div
id="prompt-internal-server-table"
tabindex="-1"
class="modal fade"
role="dialog"
>
<!-- map type change confirmation dialog will be shown here-->
</div>

<div
id="prompt-invalidQuery-table"
tabindex="-1"
Expand Down Expand Up @@ -4172,6 +4181,37 @@ <h4 class="modal-title">Warning</h4>
</div>
</script>

<!-- Internal server error -->
<script type="text/template" id="prompt-internal-server-template">
<div class="modal-dialog sbgn-modal-dialog" style="width: 300px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Error</h4>
</div>
<div class="modal-body">
<table class="table-condensed layout-table dialog-table" style="margin: auto;">
<tbody>
<tr>
<th style="padding-left: 0px;" align="left">
<span class="add-on layout-text">Internal Server Error!</span>
</th>
</tr>

<tr id="prompt-internal-server-buttons" style="padding-bottom: 0px; margin-bottom: 0px;">
<td>
</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer" style="text-align: center">
<button id="prompt-internal-server-confirm" class="btn btn-default">OK</button>
</div>
</div>
</div>
</script>

<!-- Invalid query error -->
<script type="text/template" id="prompt-invalidQuery-template">
<div class="modal-dialog sbgn-modal-dialog" style="width: 300px;">
Expand Down

0 comments on commit 17b1d4e

Please sign in to comment.