9f3887a28c44e1170456a5e782da504a49ac3b88 hiram Mon Aug 19 15:26:08 2024 -0700 rearrangements following input suggestions refs #32596 diff --git src/hg/js/assemblySearch.js src/hg/js/assemblySearch.js index f8832b0..f555584 100644 --- src/hg/js/assemblySearch.js +++ src/hg/js/assemblySearch.js @@ -1,30 +1,37 @@ document.addEventListener('DOMContentLoaded', function() { var searchForm = document.getElementById('searchForm'); var searchInput = document.getElementById('searchBox'); var clearButton = document.getElementById('clearSearch'); clearButton.addEventListener('click', function() { searchInput.value = ''; // Clear the search input field }); searchForm.addEventListener('submit', function(event) { event.preventDefault(); // Prevent form submission var searchTerm = document.getElementById('searchBox').value; var resultCountLimit = document.getElementById('limitResultCount'); - var browserExist = document.querySelector('input[name="browserExist"]:checked').value; + var browserExist = "mustExist"; + var mustExist = document.getElementById('mustExist').checked; + var notExist = document.getElementById('notExist').checked; + if (mustExist && notExist) { + browserExist = "mayExist"; + } else if (notExist) { + browserExist = "notExist"; + } var wordMatch = document.querySelector('input[name="wordMatch"]:checked').value; makeRequest(searchTerm, browserExist, resultCountLimit.value, wordMatch); }); }); // Function to generate the table and extra information function populateTableAndInfo(jsonData) { var tableHeader = document.getElementById('tableHeader'); var tableBody = document.getElementById('tableBody'); var metaData = document.getElementById('metaData'); document.getElementById('searchString').innerHTML = ""; document.getElementById('matchCounts').innerHTML = "0"; document.getElementById('availableAssemblies').innerHTML = "0"; document.getElementById('elapsedTime').innerHTML = "0"; @@ -37,54 +44,58 @@ const genomicEntries = {}; const extraInfo = {}; for (const key in jsonData) { if (jsonData[key].scientificName) { genomicEntries[key] = jsonData[key]; } else { extraInfo[key] = jsonData[key]; } } // re-populate header row - the sortable system added a class to // the last sorted column, need to rebuild the headerRow to get the // header back to pristine condition for the next sort var headerRow = '<tr>'; - headerRow += '<th>count</th>'; - headerRow += '<th>name</th>'; - headerRow += '<th>scientificName</th>'; - headerRow += '<th>commonName</th>'; + headerRow += '<th>view/<br>request</th>'; + headerRow += '<th>English common name</th>'; + headerRow += '<th>scientific name</th>'; + headerRow += '<th>assembly</th>'; headerRow += '<th>clade</th>'; headerRow += '<th>description</th>'; headerRow += '</tr>'; tableHeader.innerHTML = headerRow; var count = 0; for (const id in genomicEntries) { var dataRow = '<tr>'; - dataRow += "<th>" + ++count + "</th>"; - var urlReference = id; + var browserUrl = id; + var ncbiUrl = id; if (genomicEntries[id].browserExists) { if (id.startsWith("GC")) { - urlReference = "<a href='/h/" + id + "?position=lastDbPos' target=_blank>" + id + "</a>"; + browserUrl = "<a href='/h/" + id + "?position=lastDbPos' target=_blank>view</a>"; + ncbiUrl = "<a href='https://www.ncbi.nlm.nih.gov/assembly/" + id + "' target=_blank>" + id + "</a>" } else { - urlReference = "<a href='/cgi-bin/hgTracks?db=" + id + "' target=_blank>" + id + "</a>"; + browserUrl = "<a href='/cgi-bin/hgTracks?db=" + id + "' target=_blank>view</a>"; } + dataRow += "<th>" + browserUrl + "</th>"; + } else { + dataRow += "<th>request</th>"; } - dataRow += "<th>" + urlReference + "</th>"; dataRow += "<td>" + genomicEntries[id].scientificName + "</td>"; dataRow += "<td>" + genomicEntries[id].commonName + "</td>"; + dataRow += "<th>" + ncbiUrl + "</th>"; dataRow += "<td>" + genomicEntries[id].clade + "</td>"; dataRow += "<td>" + genomicEntries[id].description + "</td>"; dataRow += '</tr>'; tableBody.innerHTML += dataRow; } var dataTable = document.getElementById('dataTable'); sorttable.makeSortable(dataTable); document.getElementById('searchString').innerHTML = extraInfo['genomeSearch']; document.getElementById('matchCounts').innerHTML = extraInfo['totalMatchCount'].toLocaleString(); document.getElementById('availableAssemblies').innerHTML = extraInfo['availableAssemblies'].toLocaleString(); var etMs = extraInfo['elapsedTimeMs']; var elapsedTime = etMs.toLocaleString() + " milliseconds"; if ( etMs > 1000 ) { var etSec = etMs/1000;