a8f29caea973a2482924c38c981b59a28e22e8ec
max
Fri Oct 22 05:14:38 2021 -0700
making hgHubConnect more self-explanatory, with more text. The
development tab is revamped to provide a visual indicator of what's
going on while hubCheck is running. (The concept with an IFRAME could well be applied to hgc links
from hgTracks, to avoid a full page reload.), refs #28324
diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index 3b9bd21..b483490 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -19,30 +19,32 @@
#include "dbDb.h"
#include "web.h"
#include "trackHub.h"
#include "hubConnect.h"
#include "dystring.h"
#include "hPrint.h"
#include "jsHelper.h"
#include "obscure.h"
#include "hgConfig.h"
#include "trix.h"
#include "net.h"
#include "hubSearchText.h"
#include "pipeline.h"
#include "hubPublic.h"
+static boolean measureTiming;
+
struct cart *cart; /* The user's ui state. */
struct hash *oldVars = NULL;
static char *pageTitle = "Track Data Hubs";
char *database = NULL;
char *organism = NULL;
struct hubOutputStructure
{
struct hubOutputStructure *next;
struct dyString *metaTags;
struct dyString *descriptionMatch;
struct genomeOutputStructure *genomes;
int genomeCount;
struct hash *genomeOutHash;
@@ -210,32 +212,38 @@
el = slNameNew(genomes->name);
slAddHead(&list, el);
}
slReverse(&list);
printGenomeList(thub->url, list, row, withLink);
}
static void hgHubConnectUnlisted(struct hubConnectStatus *hubList,
struct hash *publicHash)
/* Put up the list of unlisted hubs and other controls for the page. */
/* uses publicHash to distingusih public hubs from unlisted ones */
/* NOTE: Destroys hubList */
{
// put out the top of our page
-printf("
\n"
- "
\n"
+puts("
\n"
+ "
");
+
+printf("
");
+ printf("
");
+ puts(""); // return from within DIV and FROM is probably not a good idea
+ puts("
"); // tabSection and .unlistedHubs
return;
}
// time to output the big table. First the header
-printf(
+puts(
"
"
"
Display
"
"
Hub Name
"
"
Description
"
- "
Assemblies
"
+ "
AssembliesClick to connect and browse directly
"
"
\n"
"\n");
// start first row
printf("");
char id[256];
int count = 0;
for(hub = unlistedHubList; hub; hub = hub->next)
{
char hubName[64];
safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, hub->id);
if (!cartUsualBoolean(cart, hubName, FALSE))
continue;
@@ -337,222 +362,204 @@
ourPrintCell(hub->trackHub->longLabel);
}
else
ourPrintCell("");
if (hub->trackHub != NULL)
printGenomes(hub->trackHub, count, !hubHasError);
else
ourPrintCell("");
puts("");
}
printf("\n");
-printf("");
+puts("");
+printf(""); // .tabSection
+printf(""); // #unlistedHubs
+
}
void doValidateNewHub(char *hubUrl)
/* Run hubCheck on a hub. */
{
udcSetCacheTimeout(1);
printf("");
char *cmd[] = {"loader/hubCheck", "-htmlOut", "-noTracks", hubUrl, NULL};
struct pipeline *pl = pipelineOpen1(cmd, pipelineRead | pipelineNoAbort, NULL, NULL);
struct lineFile *lf = pipelineLineFile(pl);
char *line;
while (lineFileNext(lf, &line, NULL))
jsInlineF("%s", line);
pipelineClose(&pl);
// the 'false' below prevents a few hub-search specific jstree configuration options
jsInline("hubSearchTree.init(false);");
}
void hgHubConnectDeveloperMode()
/* Put up the controls for the "Hub Development" Tab, which includes a button to run the
* hubCheck utility on a hub and load a hub with the udcTimeout and measureTiming
* variables turned on */
{
// put out the top of our page
char *hubUrl = cartOptionalString(cart, "validateHubUrl");
-boolean doHubValidate = cartVarExists(cart, hgHubDoHubCheck);
// the outer div for all the elements in the tab
-printf("\n
\n");
+puts("
");
-// the row to enter in the url and the button and settings to validate/load
-printf("
When debugging a hub, it is sometimes helpful to check it for errors. "
+ "With the button above, you can validate the hub's configuration files, including hub.txt, "
+ "genomes.txt and trackDb.txt. "
+ "A hierarchical tree of tracks is presented with any errors in red. A hub "
+ "with no errors still shows the tree which can be used to explore the track hierarchy. "
+ "Hub error checking will always refresh the files and never use our remote file cache (see below)."
+ "
\n "
+);
+puts("
"); // .tabSection
+
+puts("
");
+puts("
Enable Genome Browser debugging modes
");
+puts("
These apply to all connected hubs. By default, caching is activated and track load times are not shown, but you can change these settings when debugging your hub.
\n");
-// measureTiming first
-printf("", doMeasureTiming ? "checked": "");
-printf("\n");
-
-// and a tooltip explaining this checkbox
-printf("
(?)\n");
-printf(""
- "Checking this box shows the timing measurements at the bottom of the Genome Browser page. "
- "Useful for determining slowdowns to loading or drawing tracks."
- "\n");
-printf("
\n"); // tooltip div
-
-printf("
\n");
-// udcTimeout enable/disable
-printf("", doUdcTimeout ? "checked" : "");
-printf("\n");
-// add a tooltip explaining these checkboxes
-printf("
(?)\n");
-printf(""
- "Checking this box changes the cache expiration time (default of 5 minutes) "
- "and allows the Genome Browser to reload Hub configuration and data files with each refresh."
- "\n");
-printf("
"); // #hubDeveloper
+
+jsOnEventById("click", "hubValidateButton", "makeIframe(event)");
}
void printSearchAndFilterBoxes(int searchEnabled, char *hubSearchTerms, char *dbFilter)
/* Create the text boxes for search and database filtering along with the required
* javscript */
{
-char event[4096];
+printf("");
}
void printSearchTerms(char *hubSearchTerms)
/* Write out a reminder about the current search terms and a note about
* how to navigate detailed search results */
{
printf("Displayed list restricted by search terms: %s\n", hubSearchTerms);
puts("\n");
jsOnEventById("click", "hubDeleteSearchButton",
"document.searchHubForm.elements['hubSearchTerms'].value='';"
"document.searchHubForm.elements['hubDbFilter'].value='';"
"document.searchHubForm.submit();return true;");
puts("
\n");
printf("When exploring the detailed search results for a hub, you may right-click "
"on an assembly or track line to open it in a new window.\n");
puts("
\n");
}
void printHubListHeader()
/* Write out the header for a list of hubs in its own table */
{
-puts("Clicking Connect redirects to the gateway page of the selected hub's default assembly. ");
-printf("
"
+puts("
"
"
"
"
Display
"
"
Hub Name
"
"
Description
"
- "
Assemblies
"
- "
\n");
+ //"
Assemblies
"
+ "
AssembliesClick to connect and browse directly
"
+ "");
}
void outputPublicTableRow(struct hubEntry *hubInfo, int count)
/* Prints out a table row with basic information about a hub and a button
* to connect to that hub */
{
int id = hubInfo->id;
char jsId[256];
struct slName *dbListNames = slNameListFromComma(hubInfo->dbList);
printf("
\n");
if (id != 0)
{
ourCellStart();
char hubName[32];
safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, id);
@@ -1098,36 +1105,39 @@
/* Compare to sort based on shortLabel */
{
const struct hubEntry *a = *((struct hubEntry **)va);
const struct hubEntry *b = *((struct hubEntry **)vb);
return strcasecmp(a->shortLabel, b->shortLabel);
}
void printHubList(struct slName *hubsToPrint, struct hash *hubLookup, struct hash *searchResultHash)
/* Print out a list of hubs, possibly along with search hits to those hubs.
* hubLookup takes hub URLs to struct hubEntry
* searchResultHash takes hub URLs to struct hubSearchText * (list of hits on that hub)
*/
{
+printf("