Skip to content

Commit 96a174f

Browse files
antgonzaElDeveloper
authored andcommitted
redbiom nice display of 504 (#2311)
* nice display of 504 * addressing @ElDeveloper comment
1 parent 5b14656 commit 96a174f

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

qiita_pet/templates/redbiom.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@
121121
$("#submitForm").submit(function(event){
122122
event.preventDefault();
123123

124-
show_loading("redbiom-info");
124+
show_loading("redbiom-info", true);
125125

126126
var search = $("#search").val();
127127
var search_on = $("#search_on").val();
128+
var redbiom_info = $('#redbiom-info');
128129

129130
$.post("{% raw qiita_config.portal_dir %}/redbiom/", {'search': search, 'search_on': search_on})
130131
.done(function ( data ){
131132
var redbiom_table = $('#redbiom-table').DataTable();
132-
var redbiom_info = $('#redbiom-info');
133133
// the next 4 lines reset the column filtering
134134
var placer = $(".ps");
135135
redbiom_table.column(3).search("").draw();
@@ -148,7 +148,17 @@
148148
redbiom_info.html('');
149149
}
150150
}
151-
});
151+
})
152+
.fail(function(response, status, error) {
153+
var text = 'The query response is larger than is currently allowed, please try another. <a href="https://github.com/biocore/qiita/issues/2312" target="_blank">Track progress on this issue.</a>';
154+
if (response.status != 504) {
155+
text = 'Status code: "' + response.status + '" - ' + error + '.<br/>Please send a screenshot to <a href="[email protected]">[email protected]</a>.';
156+
}
157+
redbiom_info.html(
158+
`<div class="alert alert-danger alert-dismissible" role="alert">
159+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
160+
<strong>Error!</strong> ` + text + `</div><br/>`)
161+
})
152162
});
153163
});
154164
</script>

qiita_pet/templates/sitebase.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@
7171
* gif to show that the section of page is loading
7272
*
7373
*/
74-
function show_loading(div_name) {
75-
$("#" + div_name).html("<img src='{% raw qiita_config.portal_dir %}/static/img/waiting.gif' style='display:block;margin-left: auto;margin-right: auto'/>");
74+
function show_loading(div_name, show_text = false) {
75+
var text = "<img src='{% raw qiita_config.portal_dir %}/static/img/waiting.gif' style='display:block;margin-left: auto;margin-right: auto'/>";
76+
if (show_text) {
77+
text += '<br/><center><b>This task might take a long time (up to 5 minutes), please do not close this page.</center></b>';
78+
}
79+
$("#" + div_name).html(text);
7680
}
7781

7882
function overlay_check() {

0 commit comments

Comments
 (0)