Skip to content

Commit 09bbcd6

Browse files
committed
Update error messaging for peptide summary
1 parent 75cd6cf commit 09bbcd6

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

resources/views/peptideSummary.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
</div>
8888

8989
<span id="fom-loading">Loading...<i class="fa fa-spinner fa-pulse"></i></span>
90+
<span id="fom-error" class='labkey-error'></span>
9091
<div id="table-container" class="table-container">
9192

9293
</div>
@@ -119,12 +120,13 @@
119120
}
120121

121122
function getMinMaxDate() {
123+
$('#fom-error').hide();
122124
LABKEY.Query.executeSql({
123125
schemaName: 'targetedms',
124126
sql: 'SELECT MIN(AcquiredTime) AS MinAcquiredTime, MAX(AcquiredTime) AS MaxAcquiredTime, count(*) AS runs FROM SampleFile',
125127
success: function(data) {
126128
if (data.rows.length === 0 || !data.rows[0]['MinAcquiredTime']) {
127-
Ext4.get(plotPanelId).update("No data found. Please upload runs using the Data Pipeline or directly from Skyline.");
129+
showErrorMessage("No data found. Please upload runs using the Data Pipeline or directly from Skyline.");
128130
}
129131
else {
130132
if (startDate === null || endDate === null) {
@@ -141,11 +143,17 @@
141143
}
142144
},
143145
failure: function(response) {
144-
Ext4.get(plotPanelId).update("<span class='labkey-error'>Error: " + LABKEY.Utils.encodeHtml(response.exception) + "</span>");
146+
showErrorMessage("Error: " + response.exception);
145147
}
146148
});
147149
}
148150

151+
function showErrorMessage(message) {
152+
$('#fom-loading').hide();
153+
document.getElementById('fom-error').innerText = message;
154+
$('#fom-error').show();
155+
}
156+
149157
function calculateStartDateByOffset(offset) {
150158
if (offset > 0) {
151159
var startDateByOffset = maxDate ? new Date(maxDate) : new Date();
@@ -242,6 +250,7 @@
242250

243251
function getData() {
244252
$('#fom-loading').show();
253+
$('#fom-error').hide();
245254
LABKEY.Ajax.request({
246255
url: LABKEY.ActionURL.buildURL('targetedms', 'GetPeptideOutliers.api'),
247256
params: {
@@ -252,7 +261,10 @@
252261
const parsed = JSON.parse(response.responseText);
253262
document.getElementById('total-replicates').innerHTML = '&nbsp;' + LABKEY.Utils.encodeHtml(parsed.replicatesCount);
254263
generateTable(parsed);
255-
}
264+
},
265+
failure: LABKEY.Utils.getCallbackWrapper(function(response) {
266+
showErrorMessage("Error: " + response.exception);
267+
}, this, false)
256268
});
257269
}
258270

@@ -311,6 +323,7 @@
311323

312324
function customDateRange() {
313325
$('#fom-loading').show();
326+
$('#fom-error').hide();
314327
const startDateVal = document.getElementById('ps-start-date').value;
315328
const endDateVal = document.getElementById('ps-end-date').value;
316329

@@ -376,6 +389,9 @@
376389
document.getElementById('date-range').value = dateRangeOffset;
377390
}
378391
getMinMaxDate();
392+
}, this, false),
393+
failure: LABKEY.Utils.getCallbackWrapper(function(response) {
394+
showErrorMessage("Error:" + response.exception);
379395
}, this, false)
380396
});
381397
}

0 commit comments

Comments
 (0)