8548a5903f6181e2912ce0e584a0f56240de1858 hiram Thu Oct 10 10:58:23 2019 -0700 extend supported types for schema display to bigBarChart bigInteract and bigLolly and correct indicate not supported VCF types refs #23589 diff --git src/hg/hubApi/list.c src/hg/hubApi/list.c index 2a43517..2b7142c 100644 --- src/hg/hubApi/list.c +++ src/hg/hubApi/list.c @@ -419,30 +419,32 @@ static void schemaJsonOutput(FILE *f, char *db, char *track) /* for given db and track, output the schema for the associated table */ { struct sqlConnection *conn = hAllocConnMaybe(db); if (NULL == conn) apiErrAbort(err400, err400Msg, "can not find 'genome=%s' for endpoint '/list/schema", db); struct trackDb *tdb = obtainTdb(NULL, db); struct trackDb *thisTrack = findTrackDb(track, tdb); if (NULL == thisTrack) /* OK to work with tables without trackDb definitions */ { if (! sqlTableExists(conn, track)) apiErrAbort(err400, err400Msg, "failed to find specified track=%s in genome=%s for endpoint '/list/schema'", track, db); } +else if ( ! isSupportedType(thisTrack->type)) + apiErrAbort(err415, err415Msg, "track type '%s' for track=%s not supported at this time", thisTrack->type, track); if (trackHasNoData(thisTrack)) apiErrAbort(err400, err400Msg, "container track '%s' does not contain data, use the children of this container for data access", track); /* might be a table that points to a big* file * or is just a bigDataUrl without any table */ char *bigDataUrl = trackDbSetting(thisTrack, "bigDataUrl"); char *sqlTableName = cloneString(track); /* the trackDb might have a specific table defined instead */ char *tableName = trackDbSetting(thisTrack, "table"); if (isNotEmpty(tableName)) { freeMem(sqlTableName); @@ -465,43 +467,54 @@ splitTableName = cloneString(fullTableName); } else { splitTableName = sqlTableName; } struct bbiFile *bbi = NULL; if (thisTrack && startsWith("big", thisTrack->type)) { if (isEmpty(bigDataUrl)) bigDataUrl = bigDataUrlFromTable(conn, splitTableName); if (bigDataUrl) bbi = bigFileOpen(thisTrack->type, bigDataUrl); if (NULL == bbi) - apiErrAbort(err400, err400Msg, "failed to find bigDataUrl=%s for track=%s in database=%s for endpoint '/list/schema'", bigDataUrl, track, db); + apiErrAbort(err400, err400Msg, "failed to find bigDataUrl=%s for track=%s type=%s in database=%s for endpoint '/list/schema'", bigDataUrl, track, thisTrack->type, db); } -char *dataTime = sqlTableUpdate(conn, splitTableName); - -time_t dataTimeStamp = sqlDateToUnixTime(dataTime); -replaceChar(dataTime, ' ', 'T'); /* ISO 8601 */ struct jsonWrite *jw = apiStartOutput(); jsonWriteString(jw, "genome", db); jsonWriteString(jw, "track", track); + +time_t dataTimeStamp = 0; +char *dataTime = NULL; + +if (bbi) + { + dataTimeStamp = bbiUpdateTime(bbi); + dataTime = sqlUnixTimeToDate(&dataTimeStamp, FALSE); + } +else + { + dataTime = sqlTableUpdate(conn, splitTableName); + dataTimeStamp = sqlDateToUnixTime(dataTime); + } + +replaceChar(dataTime, ' ', 'T'); /* ISO 8601 */ jsonWriteString(jw, "dataTime", dataTime); jsonWriteNumber(jw, "dataTimeStamp", (long long)dataTimeStamp); -freeMem(dataTime); char **columnNames = NULL; char **columnTypes = NULL; int *jsonTypes = NULL; int columnCount = 0; struct asObject *as = NULL; struct asColumn *columnEl = NULL; int asColumnCount = 0; long long itemCount = 0; if (bbi) { /* do not show itemCount for protected data */ if (! protectedTrack(thisTrack, track)) { @@ -737,31 +750,31 @@ } } hFreeConn(&conn); } } } return itemCount; } /* static long long dataItemCount(char *db, struct trackDb *tdb) */ static void recursiveTrackList(struct jsonWrite *jw, struct trackDb *tdb, char *db) /* output trackDb tags only for real tracks, not containers, * recursive when subtracks exist */ { -boolean isContainer = tdbIsComposite(tdb) || tdbIsCompositeView(tdb); +boolean isContainer = trackHasNoData(tdb); /* do *NOT* print containers when 'trackLeavesOnly' requested */ if (! (trackLeavesOnly && isContainer) ) { long long itemCount = 0; /* do not show counts for protected data or continers (== no items)*/ if (! (isContainer || protectedTrack(tdb, tdb->track))) itemCount = dataItemCount(db, tdb); jsonWriteObjectStart(jw, tdb->track); if (tdbIsComposite(tdb)) jsonWriteString(jw, "compositeContainer", "TRUE"); if (tdbIsCompositeView(tdb)) jsonWriteString(jw, "compositeViewContainer", "TRUE"); outputTrackDbVars(jw, tdb, itemCount);