|
87 | 87 | </div> |
88 | 88 |
|
89 | 89 | <span id="fom-loading">Loading...<i class="fa fa-spinner fa-pulse"></i></span> |
| 90 | +<span id="fom-error" class='labkey-error'></span> |
90 | 91 | <div id="table-container" class="table-container"> |
91 | 92 |
|
92 | 93 | </div> |
|
119 | 120 | } |
120 | 121 |
|
121 | 122 | function getMinMaxDate() { |
| 123 | + $('#fom-error').hide(); |
122 | 124 | LABKEY.Query.executeSql({ |
123 | 125 | schemaName: 'targetedms', |
124 | 126 | sql: 'SELECT MIN(AcquiredTime) AS MinAcquiredTime, MAX(AcquiredTime) AS MaxAcquiredTime, count(*) AS runs FROM SampleFile', |
125 | 127 | success: function(data) { |
126 | 128 | 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."); |
128 | 130 | } |
129 | 131 | else { |
130 | 132 | if (startDate === null || endDate === null) { |
|
141 | 143 | } |
142 | 144 | }, |
143 | 145 | failure: function(response) { |
144 | | - Ext4.get(plotPanelId).update("<span class='labkey-error'>Error: " + LABKEY.Utils.encodeHtml(response.exception) + "</span>"); |
| 146 | + showErrorMessage("Error: " + response.exception); |
145 | 147 | } |
146 | 148 | }); |
147 | 149 | } |
148 | 150 |
|
| 151 | + function showErrorMessage(message) { |
| 152 | + $('#fom-loading').hide(); |
| 153 | + document.getElementById('fom-error').innerText = message; |
| 154 | + $('#fom-error').show(); |
| 155 | + } |
| 156 | + |
149 | 157 | function calculateStartDateByOffset(offset) { |
150 | 158 | if (offset > 0) { |
151 | 159 | var startDateByOffset = maxDate ? new Date(maxDate) : new Date(); |
|
242 | 250 |
|
243 | 251 | function getData() { |
244 | 252 | $('#fom-loading').show(); |
| 253 | + $('#fom-error').hide(); |
245 | 254 | LABKEY.Ajax.request({ |
246 | 255 | url: LABKEY.ActionURL.buildURL('targetedms', 'GetPeptideOutliers.api'), |
247 | 256 | params: { |
|
252 | 261 | const parsed = JSON.parse(response.responseText); |
253 | 262 | document.getElementById('total-replicates').innerHTML = ' ' + LABKEY.Utils.encodeHtml(parsed.replicatesCount); |
254 | 263 | generateTable(parsed); |
255 | | - } |
| 264 | + }, |
| 265 | + failure: LABKEY.Utils.getCallbackWrapper(function(response) { |
| 266 | + showErrorMessage("Error: " + response.exception); |
| 267 | + }, this, false) |
256 | 268 | }); |
257 | 269 | } |
258 | 270 |
|
|
311 | 323 |
|
312 | 324 | function customDateRange() { |
313 | 325 | $('#fom-loading').show(); |
| 326 | + $('#fom-error').hide(); |
314 | 327 | const startDateVal = document.getElementById('ps-start-date').value; |
315 | 328 | const endDateVal = document.getElementById('ps-end-date').value; |
316 | 329 |
|
|
376 | 389 | document.getElementById('date-range').value = dateRangeOffset; |
377 | 390 | } |
378 | 391 | getMinMaxDate(); |
| 392 | + }, this, false), |
| 393 | + failure: LABKEY.Utils.getCallbackWrapper(function(response) { |
| 394 | + showErrorMessage("Error:" + response.exception); |
379 | 395 | }, this, false) |
380 | 396 | }); |
381 | 397 | } |
|
0 commit comments