dec6f042b7ff330fbdbabb312a91fee93e7ea135 braney Tue Jul 8 10:50:36 2014 -0700 put "retry hub" button with error message so folks can disconnect frompublic hubs with errors diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 999108f..52c0822 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -186,93 +186,93 @@ printf("</thead></table></div>"); return; } // time to output the big table. First the header printf( "<tr> " "<th>Display</th> " "<th>Hub Name</th> " "<th>Description</th> " "<th>Assemblies</th> " "</tr>\n" "</thead>\n"); // start first row -printf("<tbody><tr>"); +printf("<tbody>"); int count = 0; for(hub = unlistedHubList; hub; hub = hub->next) { if (count) webPrintLinkTableNewRow(); // ends last row and starts a new one count++; - // if there's an error message, we don't let people select it - if (isEmpty(hub->errorMessage)) - { + puts("<tr>"); + ourCellStart(); char hubName[32]; safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, hub->id); if (cartUsualBoolean(cart, hubName, FALSE)) printf("<input name=\"hubDisconnectButton\"" "onClick=" "\" document.disconnectHubForm.elements['hubId'].value= '%d';" "document.disconnectHubForm.submit();return true;\" " "class=\"hubDisconnectButton\" type=\"button\" value=\"Disconnect\">\n", hub->id); ourCellEnd(); - } - else - { - // give people a chance to clear the error - ourCellStart(); - printf( - "<input name=\"hubClearButton\"" - "onClick=\"document.resetHubForm.elements['hubCheckUrl'].value='%s';" - "document.resetHubForm.submit();return true;\" " - "class=\"hubButton\" type=\"button\" value=\"Check Hub\">\n" - , hub->hubUrl); - ourCellEnd(); - } + if (hub->trackHub != NULL) { ourPrintCellLink(hub->trackHub->shortLabel, hub->hubUrl); } else ourPrintCell(""); if (!isEmpty(hub->errorMessage)) - printf("<TD><span class=\"hubError\">ERROR: %s </span>" - "<a href=\"../goldenPath/help/hgTrackHubHelp.html#Debug\">Debug</a></TD>\n", + { + ourCellStart(); + printf("<span class=\"hubError\">ERROR: %s </span>" + "<a TARGET=_BLANK href=\"../goldenPath/help/hgTrackHubHelp.html#Debug\">Debug Help</a>\n", hub->errorMessage); + + // give people a chance to clear the error + printf("<input name=\"hubClearButton\"" + "onClick=\"document.resetHubForm.elements['hubCheckUrl'].value='%s';" + "document.resetHubForm.submit();return true;\" " + "class=\"hubButton\" type=\"button\" value=\"Retry Hub\">" + , hub->hubUrl); + ourCellEnd(); + } else if (hub->trackHub != NULL) { if (hub->trackHub->descriptionUrl != NULL) ourPrintCellLink(hub->trackHub->longLabel, hub->trackHub->descriptionUrl); else ourPrintCell(hub->trackHub->longLabel); } else ourPrintCell(""); if (hub->trackHub != NULL) printGenomes(hub->trackHub, count); else ourPrintCell(""); + + puts("</tr>"); } -printf("</TR></tbody></TABLE>\n"); +printf("</tbody></TABLE>\n"); printf("</div>"); } static void addPublicHubsToHubStatus(struct sqlConnection *conn, char *publicTable, char *statusTable) /* add url's in the hubPublic table to the hubStatus table if they aren't there already */ { char query[1024]; sqlSafef(query, sizeof(query), "select hubUrl from %s where hubUrl not in (select hubUrl from %s)\n", publicTable, statusTable); struct sqlResult *sr = sqlGetResult(conn, query); char **row; while ((row = sqlNextRow(sr)) != NULL) { char *errorMessage = NULL; char *url = row[0]; @@ -313,31 +313,31 @@ { puts("Enter search terms to find in public track hub description pages:<BR>" "<input name=\"hubSearchTerms\" id=\"hubSearchTerms\" class=\"hubField\"" "type=\"text\" size=\"65\"> \n" "<input name=\"hubSearchButton\"" "onClick=" "\" document.searchHubForm.elements['hubSearchTerms'].value=hubSearchTerms.value;" "document.searchHubForm.submit();return true;\" " "class=\"hubField\" type=\"button\" value=\"Search Public Hubs\">\n"); puts("<BR><BR>\n"); } // if we have search terms, put out the line telling the user so if (haveTrixFile && !isEmpty(hubSearchTerms)) { - printf("Displayed list restricted by search terms: %s\n", hubSearchTerms); + printf("Displayed list <B>restricted by search terms:</B> %s\n", hubSearchTerms); puts("<input name=\"hubDeleteSearchButton\"" "onClick=" "\" document.searchHubForm.elements['hubSearchTerms'].value=\'\';" "document.searchHubForm.submit();return true;\" " "class=\"hubField\" type=\"button\" value=\"Show All Hubs\">\n"); puts("<BR><BR>\n"); strLower(cleanSearchTerms); urlSearchHash = getUrlSearchHash(trixFile, cleanSearchTerms); } // make sure all the public hubs are in the hubStatus table. addPublicHubsToHubStatus(conn, publicTable, statusTable); struct hash *publicHash = newHash(5); @@ -375,31 +375,31 @@ puts("<I>Clicking Connect redirects to the gateway page of the selected hub's default assembly.</I><BR>"); printf("<table id=\"publicHubsTable\"> " "<thead><tr> " "<th>Display</th> " "<th>Hub Name</th> " "<th>Description</th> " "<th>Assemblies</th> " "</tr></thead>\n"); // start first row printf("<tbody> <tr>"); gotAnyRows = TRUE; } - if ((id != 0) && isEmpty(errorMessage)) + if (id != 0) { ourCellStart(); char hubName[32]; safef(hubName, sizeof(hubName), "%s%u", hgHubConnectHubVarPrefix, id); if (cartUsualBoolean(cart, hubName, FALSE)) printf("<input name=\"hubDisconnectButton\"" "onClick=" "\" document.disconnectHubForm.elements['hubId'].value= '%d';" "document.disconnectHubForm.submit();return true;\" " "class=\"hubDisconnectButton\" type=\"button\" value=\"Disconnect\">\n", id); else { // get first name off of list of supported databases char * name = dbListNames->name; @@ -410,58 +410,56 @@ safef(buffer, sizeof buffer, "hub_%d_%s", id, name); name = cloneString(buffer); } printf("<input name=\"hubConnectButton\"" "onClick=" "\" document.connectHubForm.elements['hubUrl'].value= '%s';" "document.connectHubForm.elements['db'].value= '%s';" "document.connectHubForm.submit();return true;\" " "class=\"hubButton\" type=\"button\" value=\"Connect\">\n", url,name); } ourCellEnd(); } - else if (!isEmpty(errorMessage)) - { - // give user a chance to clear the error - ourCellStart(); - printf( - "<input name=\"hubClearButton\"" - "onClick=\"document.resetHubForm.elements['hubCheckUrl'].value='%s';" - "document.resetHubForm.submit();return true;\" " - "class=\"hubButton\" type=\"button\" value=\"Check Hub\">" - , url); - ourCellEnd(); - } else errAbort("cannot get id for hub with url %s\n", url); ourPrintCellLink(shortLabel, url); if (isEmpty(errorMessage)) { if (hasDescription && !isEmpty(descriptionUrl)) ourPrintCellLink(longLabel, descriptionUrl); else ourPrintCell(longLabel); } else - printf("<TD><span class=\"hubError\">ERROR: %s </span>" - "<a href=\"../goldenPath/help/hgTrackHubHelp.html#Debug\">Debug</a></TD>", + { + ourCellStart(); + printf("<span class=\"hubError\">ERROR: %s </span>" + "<a href=\"../goldenPath/help/hgTrackHubHelp.html#Debug\">Debug Help</a>", errorMessage); + printf( + "<input name=\"hubClearButton\"" + "onClick=\"document.resetHubForm.elements['hubCheckUrl'].value='%s';" + "document.resetHubForm.submit();return true;\" " + "class=\"hubButton\" type=\"button\" value=\"Retry Hub\">" + , url); + ourCellEnd(); + } printGenomeList(dbListNames, count); } sqlFreeResult(&sr); if (gotAnyRows) printf("</TR></tbody></TABLE>\n"); printf("</div>"); *pHash = publicHash; return gotAnyRows; } struct hash *hgHubConnectPublic()