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/hgIntegrator/hgIntegrator.c src/hg/hgIntegrator/hgIntegrator.c index 2276bfd5cb6..6eee46f4754 100644 --- src/hg/hgIntegrator/hgIntegrator.c +++ src/hg/hgIntegrator/hgIntegrator.c @@ -25,30 +25,31 @@ #include "hdb.h" #include "hgColors.h" #include "hui.h" #include "joiner.h" #include "jsHelper.h" #include "jsonParse.h" #include "knetUdc.h" #include "textOut.h" #include "trackHub.h" #include "userRegions.h" #include "web.h" #include "annoFormatTab.h" #include "annoGratorQuery.h" #include "windowsToAscii.h" #include "chromAlias.h" +#include "hgConfig.h" /* Global Variables */ struct cart *cart = NULL; /* CGI and other variables */ struct hash *oldVars = NULL; /* Old contents of cart before it was updated by CGI */ #define QUERY_SPEC "hgi_querySpec" #define UI_CHOICES "hgi_uiChoices" #define DO_QUERY "hgi_doQuery" #define hgiRegionType "hgi_range" #define hgiRegionTypePosition "position" #define hgiRegionTypeDefault hgiRegionTypePosition static void writeCartVar(struct cartJson *cj, char *varName) { @@ -920,48 +921,74 @@ void doMainPage() /* Send HTML with javascript to bootstrap the user interface. */ { char *db = NULL, *genome = NULL, *clade = NULL; getDbGenomeClade(cart, &db, &genome, &clade, oldVars); chromAliasSetup(db); char *position = windowsToAscii(cartUsualString(cart, "position", hDefaultPos(db))); cartSetLastPosition(cart, position, oldVars); initGenbankTableNames(db); webStartWrapperDetailedNoArgs(cart, trackHubSkipHubName(db), "", "Data Integrator", TRUE, FALSE, TRUE, TRUE); // Ideally these would go in the <HEAD> -puts("<link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css\">"); +webIncludeResourceFile("jquery-ui.css"); puts("<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css\">"); puts("<div id=\"appContainer\">Loading...</div>"); // Set a global JS variable hgsid. // Plain old "var ..." doesn't work (other scripts can't see it), it has to belong to window. char javascript[1024]; safef(javascript, sizeof javascript, "window.%s='%s';\n", cartSessionVarName(), cartSessionId(cart)); // jsInline(javascript); // GALT TODO would prefer inline, but lack of global early causes issues. printf("<script type='text/javascript' nonce='%s'>\n%s</script>\n", getNonce(), javascript); jsIncludeReactLibs(); jsIncludeFile("reactHgIntegrator.js", NULL); jsIncludeFile("hgIntegratorModel.js", NULL); jsIncludeFile("autocompleteCat.js", NULL); +// Embed popular assemblies JSON for the autocomplete dropdown +{ +char *popularStr = cfgOptionDefault("browser.popularGenomes", + "hg38,hg19,mm39,mm10,rn7,danRer11,dm6,ce11,sacCer3"); +struct slName *dbNames = slNameListFromComma(popularStr); +struct dyString *json = dyStringNew(512); +dyStringAppendC(json, '['); +boolean first = TRUE; +struct slName *dbIter; +for (dbIter = dbNames; dbIter != NULL; dbIter = dbIter->next) + { + struct dbDb *info = hDbDb(dbIter->name); + if (info == NULL || !info->active) + continue; + if (!first) + dyStringAppendC(json, ','); + first = FALSE; + dyStringPrintf(json, "{\"db\":\"%s\",\"label\":\"%s - %s (%s)\",\"commonName\":\"%s\"}", + info->name, info->organism, info->description, info->name, info->organism); + } +dyStringAppendC(json, ']'); +printf("<script type='application/json' id='speciesSearchInputPopularData'>%s</script>\n", dyStringContents(json)); +dyStringFree(&json); +slFreeList(&dbNames); +} + // Invisible form for submitting a query printf("\n<form action=\"%s\" method=%s id='queryForm'>\n", hgIntegratorName(), cartUsualString(cart, "formMethod", "POST")); cartSaveSession(cart); cgiMakeHiddenVar(QUERY_SPEC, cartUsualString(cart, QUERY_SPEC, "")); cgiMakeHiddenVar(DO_QUERY, "go"); puts("</form>"); // Invisible form for jumping to another CGI printf("\n<form method=%s id='jumpForm'>\n", cartUsualString(cart, "formMethod", "GET")); cartSaveSession(cart); puts("</form>"); webEnd(); }