28b9aa965d7f2e912fcad511f85e46b122e42261 chmalee Wed Feb 10 16:46:09 2021 -0800 Surface up any warnings or errors that came about from an ajax update, refs #26847 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index e89f7fc..74b9cec 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -3960,60 +3960,63 @@ updateImgAndMap: function (response, status) { // Handle ajax response with an updated trackMap image, map and optional ideogram. // and maybe the redLines background too. // this.cmd can be used to figure out which menu item triggered this. // this.id === appropriate track if we are retrieving just a single track. // update local hgTracks.trackDb to reflect possible side-effects of ajax request. var newJson = scrapeVariable(response, "hgTracks"); //alert(JSON.stringify(newJson)); // DEBUG Example var oldJson = hgTracks; var valid = false; - if (!newJson) { var stripped = {}; + if (!newJson) { stripJsEmbedded(response, true, stripped); if ( ! stripped.warnMsg ) warn("hgTracks object is missing from the response"); } else { if (this.id) { if (newJson.trackDb[this.id]) { var visibility = vis.enumOrder[newJson.trackDb[this.id].visibility]; var limitedVis; if (newJson.trackDb[this.id].limitedVis) limitedVis = vis.enumOrder[newJson.trackDb[this.id].limitedVis]; if (this.newVisibility && limitedVis && this.newVisibility !== limitedVis) // see redmine 1333#note-9 alert("There are too many items to display the track in " + this.newVisibility + " mode."); var rec = oldJson.trackDb[this.id]; rec.limitedVis = newJson.trackDb[this.id].limitedVis; vis.update(this.id, visibility); if (visibility === "hide") cart.updateSessionPanel(); // notify when vis change to hide track valid = true; } else { // what got returned from the AJAX request was a different // set of tracks. Let's do a reload and hope for the best imageV2.fullReload(); } } else { valid = true; } + // the ajax request may have generated an error or warning in the warnbox + // so make sure those warnings still get to the user + stripJsEmbedded(response, false, stripped); } if (valid) { if (imageV2.enabled && this.id && this.cmd && this.cmd !== 'wholeImage' && this.cmd !== 'selectWholeGene' && !newJson.virtChromChanged) { // Extract <TR id='tr_ID'>...</TR> and update appropriate row in imgTbl; // this updates src in img_left_ID, img_center_ID and img_data_ID // and map in map_data_ID var id = this.id; if (imageV2.updateImgForId(response, id, false)) { imageV2.afterReload(id); imageV2.updateBackground(response); // Added by galt to update window separators