f5bc6b413957f25f24799f15e836757e4f82a668 chmalee Tue Aug 22 13:27:51 2023 -0700 Make warnings show up in search results, refs #31965 diff --git src/hg/hgSearch/hgSearch.c src/hg/hgSearch/hgSearch.c index e2ec583c..5e5a35d 100644 --- src/hg/hgSearch/hgSearch.c +++ src/hg/hgSearch/hgSearch.c @@ -607,31 +607,31 @@ initGenbankTableNames(db); hashTracksAndGroups(cart, db); struct searchCategory *allCategories = getAllCategories(cart, db, hgFindGroupHash); struct jsonElement *categsJsonElement = jsonElementFromSearchCategory(allCategories, db); struct cartJson *cj = cartJsonNew(cart); // since we are coming directly from hgTracks/hgGateway (or a URL manipulation), // if the search would normally be a singlePos, like a chromosome name or HGVS search, // we can just go directly there. But if we aren't a singlePos, we need to show // the results page boolean doRedirect = TRUE; measureTiming = cartUsualBoolean(cart, "measureTiming", FALSE); struct hgPositions *hgp = doQuery(cj->jw, db, allCategories, doRedirect, userSearch, measureTiming); // Since we are coming from another CGI or a URL manip, go directly to hgTracks // if we resolve to a single position -if (hgp && hgp->singlePos) +if (cartJsonIsNoWarns() && hgp && hgp->singlePos) { char newPosBuf[128]; safef(newPosBuf, sizeof(newPosBuf), "%s:%d-%d", hgp->singlePos->chrom, hgp->singlePos->chromStart+1, hgp->singlePos->chromEnd); cartSetString(cj->cart, "position", newPosBuf); if (hgp->singlePos->highlight) cartSetString(cj->cart, "addHighlight", hgp->singlePos->highlight); char *trackName = cloneString(hgp->tableList->name); trackHubFixName(trackName); struct trackDb *track = NULL; if (!sameString(trackName, "chromInfo")) { track = tdbForTrack(db, trackName, &hgFindTdbList); if (!track && startsWith("all_", trackName)) track = tdbForTrack(db, trackName+strlen("all_"), &hgFindTdbList); if (!track) @@ -659,30 +659,31 @@ puts("</HEAD>\n</HTML>"); } else { dyStringPrintf(cj->jw->dy, ", \"db\": '%s'", db); dyStringPrintf(cj->jw->dy, ", \"categs\": "); jsonDyStringPrint(cj->jw->dy, categsJsonElement, NULL,-1); dyStringPrintf(cj->jw->dy, ", \"trackGroups\": "); jsonDyStringPrint(cj->jw->dy, makeTrackGroupsJson(db), NULL, -1); dyStringPrintf(cj->jw->dy, ", \"genomes\": "); jsonDyStringPrint(cj->jw->dy, getGenomes(), NULL, -1); // Now we need to actually spit out the page + json webStartGbNoBanner(cart, db, "Search Disambiguation"); printMainPageIncludes(); + cartJsonPrintWarnings(cj->jw); jsInlineF("var hgsid='%s';\n", cartSessionId(cart)); jsInline("var cartJson = {"); jsInline(cj->jw->dy->string); jsInline("};\n"); jsInline("hgSearch.init();\n"); webEndGb(); } cartJsonPopErrHandlers(); } /* End do commands */ void doMiddle(struct cart *theCart) /* Set up globals and make web page */ { cart = theCart;