16eee40c920d259c10ee345472708d0cc0cc3393 chmalee Tue Mar 3 11:25:23 2026 -0800 Adds an hg.conf defined 'popular' species list to the new search bar as a 'default' list of results upon focus of the search bar. Combines with 'recents' list. Add a chevron next to the search bar so users know the autocomplete has some default options, refs #36232 diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js index ece52e1c10a..080e2578916 100644 --- src/hg/js/hgGateway.js +++ src/hg/js/hgGateway.js @@ -1625,32 +1625,34 @@ // It might be a taxId and/or db from dbDb, or it might be a hub db, // or a taxon-only result (like "Human") that shows an assembly dropdown. var taxId = item.taxId || -1; var db = item.db; var org = item.org || item.value || item.label; var cmd; var genome = item.genome || ''; // Check if db is a valid assembly name (not an organism name). // If db is the same as org, it's likely a taxon-only result, not an assembly. var isValidDb = db && db !== org; // Detect GenArk: must have hubUrl, and either "UCSC Curated" category (GenArk hubs // under /gbdb) or a GCA_/GCF_ genome pattern. The hubUrl check distinguishes GenArk // from native databases which also use "UCSC Curated" category. + // Recent genome items store the original category in originalCategory. + var cat = item.originalCategory || item.category; var isGenArk = item.hubUrl && - ((typeof item.category !== "undefined" && item.category.startsWith("UCSC Curated")) || + ((typeof cat !== "undefined" && cat.startsWith("UCSC Curated")) || (genome.startsWith('GCA_') || genome.startsWith('GCF_'))); if (isGenArk) { // For items from localStorage recents, db is the accession; for fresh autocomplete, genome is db = item.db || item.genome; setHubDb(item.hubUrl, taxId, db, "GenArk", item.scientificName || org, true); } else if (item.hubUrl && item.hubName) { // Public hub - the autocomplete sends the hub database from hubPublic.dbList, // without the hub prefix -- restore the prefix here. db = item.hubName + '_' + item.db; setHubDb(item.hubUrl, taxId, db, item.hubName, org, true); } else if (item.hubUrl) { // Connected hub from localStorage recents without hubName. // db is already the bare assembly name; server resolves via hubUrl. setHubDb(item.hubUrl, taxId, db, null, org, true); @@ -1851,31 +1853,32 @@ // Render each item as a card (vertical layout) items.forEach(function(item) { var $card = $('
'); var label = item.label || item.shortLabel || item.value || item.genome || item.commonName; var genome = trackHubSkipHubName(item.genome || item.db || ''); $card.append('
' + escapeHtml(label) + '
'); if (genome && label.indexOf(genome) < 0) { $card.append('
' + escapeHtml(genome) + '
'); } // Add category label: "External" for assembly hubs, "UCSC Curated" for everything else. // The indexOf check handles both the new "Assembly Hub" category from handleSetDb // and legacy localStorage entries from addHubsToList or older code. var shortCategory; - if (item.category && item.category.indexOf('Assembly Hub') >= 0) { + var catForDisplay = item.originalCategory || item.category; + if (catForDisplay && catForDisplay.indexOf('Assembly Hub') >= 0) { shortCategory = 'External'; } else { shortCategory = 'UCSC Curated'; } $card.append('
' + escapeHtml(shortCategory) + '
'); // Store item data for click handler $card.data('item', item); $card.on('click', function() { var clickedItem = $(this).data('item'); clickHandler(clickedItem); // Highlight selected card in this panel $panel.find('.recentGenomeCard').removeClass('selected'); $(this).addClass('selected'); });