9dea574cbee73dd37366cbb33a993569647184c1 hiram Tue Apr 9 15:16:06 2019 -0700 adding trackLeavesOnly option and returning all containers on list tracks refs #18869 diff --git src/hg/hubApi/list.c src/hg/hubApi/list.c index 6ead98c..d863891 100644 --- src/hg/hubApi/list.c +++ src/hg/hubApi/list.c @@ -341,33 +341,39 @@ { jsonWriteNumber(jw, el->chrom, (long long)el->size); } jsonWriteObjectEnd(jw); /* chromosomes */ jsonWriteObjectEnd(jw); /* top level */ fputs(jw->dy->string,stdout); } hFreeConn(&conn); } static void recursiveTrackList(struct jsonWrite *jw, struct trackDb *tdb) /* output trackDb tags only for real tracks, not containers, * recursive when subtracks exist */ { -if (! ( tdbIsComposite(tdb) || tdbIsCompositeView(tdb) ) ) +boolean isContainer = tdbIsComposite(tdb) || tdbIsCompositeView(tdb); + +if (! (trackLeavesOnly && isContainer) ) { jsonWriteObjectStart(jw, tdb->track); + if (tdbIsComposite(tdb)) + jsonWriteString(jw, "compositeContainer", "TRUE"); + if (tdbIsCompositeView(tdb)) + jsonWriteString(jw, "compositeViewContainer", "TRUE"); jsonWriteString(jw, "shortLabel", tdb->shortLabel); jsonWriteString(jw, "type", tdb->type); jsonWriteString(jw, "longLabel", tdb->longLabel); if (tdb->parent) jsonWriteString(jw, "parent", tdb->parent->track); if (tdb->settingsHash) { struct hashEl *hel; struct hashCookie hc = hashFirst(tdb->settingsHash); while ((hel = hashNext(&hc)) != NULL) { if (sameWord("track", hel->name)) continue; // already output in header if (isEmpty((char *)hel->val)) jsonWriteString(jw, hel->name, "empty");