6973440613177762ca6434fa91d3d276b4190c01 chmalee Fri Feb 17 13:38:00 2023 -0800 Woops need to build the list of downloadable tracks each time the button is clicked, not just the first time. Also ignore tracks with vis 0, refs #30024 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index d0ecf9b..df034c5 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -5237,57 +5237,30 @@ // wait for the request to complete before making the download file downloadCurrentTrackData.intervalId = setInterval(downloadCurrentTrackData.makeDownloadFile, 200, apiUrl); }, showDownloadUi: function() { // Populate the dialog with the current list of tracks // and allow the user to select which ones to download // Grey out tracks that are currently unsupported by the api // or are protected data var downloadDialog = $("#downloadDialog")[0]; if (!downloadDialog) { downloadDialog = document.createElement("div"); downloadDialog.id = "downloadDialog"; downloadDialog.style = "display: none"; - htmlStr = "<p>Use this selection window to download track data" + - " for the current region (" + genomePos.get() + "). Please note that large regions" + - " may be slow to download.</p>"; - htmlStr += "<div><button id='checkAllDownloadTracks'>Check All</button>" + - " " + - "<button id='uncheckAllDownloadTracks'>Clear All</button>" + - "</div>"; - _.each(hgTracks.trackDb, function(track, trackName) { - if (trackName !== "ruler") { - htmlStr += "<input type=checkbox checked class='downloadTrackName' id='" + trackName + "'>"; - htmlStr += "<label>" + track.shortLabel + "</label>"; - htmlStr += "</input>"; - htmlStr += "<br>"; - } - }); - htmlStr += "<div ><label style='padding-right: 10px' for='downloadFileName'>Enter an output file name</label>"; - htmlStr += "<input type=text size=30 class='downloadFileName' id='downloadFileName'" + - " value='" + getDb() + ".tracks'</input>"; - htmlStr += "<br>"; - htmlStr += "<label style='padding-right: 10px' for='outputFormat'>Choose an output format</label>"; - htmlStr += "<select name='outputFormat' id='outputFormat'>"; - htmlStr += "<option selected value='json'>JSON</option>"; - htmlStr += "<option value='csv'>CSV</option>"; - htmlStr += "<option value='tsv'>TSV</option>"; - htmlStr += "</select>"; - htmlStr += "</div>"; - downloadDialog.innerHTML = htmlStr; document.body.append(downloadDialog); $("#checkAllDownloadTracks").click( function() { $(".downloadTrackName").each(function(i, elem) { elem.checked = true; }); }); $("#uncheckAllDownloadTracks").click( function() { $(".downloadTrackName").each(function(i, elem) { elem.checked = false; }); }); var popMaxHeight = ($(window).height() - 40); var popMaxWidth = ($(window).width() - 40); var popWidth = 700; if (popWidth > popMaxWidth) @@ -5300,30 +5273,57 @@ $(downloadDialog).dialog({ title: "Download track data in view", resizable: true, // Let scroll vertically height: 'auto', width: popWidth, minHeight: 200, minWidth: 400, maxHeight: popMaxHeight, maxWidth: popMaxWidth, modal: true, closeOnEscape: true, autoOpen: false, buttons: downloadTrackDataButtons }); } + htmlStr = "<p>Use this selection window to download track data" + + " for the current region (" + genomePos.get() + "). Please note that large regions" + + " may be slow to download.</p>"; + htmlStr += "<div><button id='checkAllDownloadTracks'>Check All</button>" + + " " + + "<button id='uncheckAllDownloadTracks'>Clear All</button>" + + "</div>"; + _.each(hgTracks.trackDb, function(track, trackName) { + if (trackName !== "ruler" && track.visibility > 0) { + htmlStr += "<input type=checkbox checked class='downloadTrackName' id='" + trackName + "'>"; + htmlStr += "<label>" + track.shortLabel + "</label>"; + htmlStr += "</input>"; + htmlStr += "<br>"; + } + }); + htmlStr += "<div ><label style='padding-right: 10px' for='downloadFileName'>Enter an output file name</label>"; + htmlStr += "<input type=text size=30 class='downloadFileName' id='downloadFileName'" + + " value='" + getDb() + ".tracks'</input>"; + htmlStr += "<br>"; + htmlStr += "<label style='padding-right: 10px' for='outputFormat'>Choose an output format</label>"; + htmlStr += "<select name='outputFormat' id='outputFormat'>"; + htmlStr += "<option selected value='json'>JSON</option>"; + htmlStr += "<option value='csv'>CSV</option>"; + htmlStr += "<option value='tsv'>TSV</option>"; + htmlStr += "</select>"; + htmlStr += "</div>"; + downloadDialog.innerHTML = htmlStr; $(downloadDialog).dialog('open'); } }; /////////////// //// READY //// /////////////// $(document).ready(function() { imageV2.moveTiming(); // hg.conf will turn this on 2020-10 - Hiram if (window.mouseOverEnabled) { mouseOver.addListener(); }