77a1a4c6ee6c882e187f1fc80b531c0e61f957cd
chmalee
  Tue Nov 19 15:23:59 2024 -0800
Be more intelligent about producing default hub names, don't die when a hub exists already and we are adding another file to it

diff --git src/hg/hgHubConnect/trackHubWizard.c src/hg/hgHubConnect/trackHubWizard.c
index c4dada1..3b366d4 100644
--- src/hg/hgHubConnect/trackHubWizard.c
+++ src/hg/hgHubConnect/trackHubWizard.c
@@ -139,48 +139,35 @@
     struct hubSpace *file, *fileList = listFilesForUser(userName);
     for (file = fileList; file != NULL; file = file->next)
         {
         jsonWriteObjectStart(jw, NULL);
         cgiDecodeFull(file->fileName, file->fileName, strlen(file->fileName));
         jsonWriteString(jw, "fileName", file->fileName);
         jsonWriteNumber(jw, "fileSize", file->fileSize);
         jsonWriteString(jw, "fileType", file->fileType);
         jsonWriteString(jw, "parentDir", file->parentDir);
         jsonWriteString(jw, "genome", file->db);
         jsonWriteString(jw, "lastModified", file->lastModified);
         jsonWriteString(jw, "uploadTime", file->creationTime);
         jsonWriteObjectEnd(jw);
         }
     jsonWriteListEnd(jw);
-    /*
-    jsonWriteListStart(jw, "hubList");
-    struct userHubs *hub, *hubList = listHubsForUser(userName);
-    for (hub = hubList; hub != NULL; hub = hub->next)
-        {
-        jsonWriteObjectStart(jw, NULL);
-        cgiDecodeFull(hub->hubName, hub->hubName, strlen(hub->hubName));
-        jsonWriteString(jw, "hubName", hub->hubName);
-        jsonWriteString(jw, "genome", hub->genome);
-        jsonWriteNumber(jw, "lastModified", getHubLatestTime(hub));
-        jsonWriteObjectEnd(jw);
-        }
-    jsonWriteListEnd(jw);
-    */
     }
 jsonWriteObjectEnd(jw);
 jsInlineF("var isLoggedIn = %s\n", getUserName() ? "true" : "false");
 jsInlineF("var userFiles = %s;\n", dyStringCannibalize(&jw->dy));
+jsInlineF("var hubNameDefault = \"%s\";\n", defaultHubNameForUser(getUserName()));
 // if the user is not logged, the 0 for the quota is ignored
 jsInlineF("var userQuota = %llu\n", getUserName() ? checkUserQuota(getUserName()) : 0);
 jsInlineF("var maxQuota = %llu\n", getUserName() ? getMaxUserQuota(getUserName()) : HUB_SPACE_DEFAULT_QUOTA);
 jsonWriteFree(&jw);
 }
 
 void doTrackHubWizard(char *database)
 /* Offer an upload form so users can upload all their hub files */
 {
 jsIncludeFile("utils.js", NULL);
 jsIncludeFile("ajax.js", NULL);
 jsIncludeFile("lodash.3.10.0.compat.min.js", NULL);
 jsIncludeFile("cart.js", NULL);
 jsIncludeFile("tus.js", NULL);
 // this file must be included as a module for now as it needs to import:
@@ -193,19 +180,18 @@
 puts("<link rel=\"stylesheet\" type=\"text/css\" "
     "href=\"https://cdn.datatables.net/buttons/3.1.1/css/buttons.dataTables.min.css\">\n");
 puts("<script type=\"text/javascript\" "
     "src=\"https://cdn.datatables.net/buttons/3.1.1/js/dataTables.buttons.min.js\"></script>");
 puts("<link href=\"https://releases.transloadit.com/uppy/v4.5.0/uppy.min.css\" rel=\"stylesheet\">");
 puts("<script type=\"text/javascript\" src=\"https://releases.transloadit.com/uppy/v4.5.0/uppy.min.js\"></script>");
 jsIncludeFile("hgMyData.js", NULL);
 
 // the skeleton HTML:
 webIncludeFile("inc/hgMyData.html");
 webIncludeResourceFile("hgMyData.css");
 
 // get the current files stored for this user
 outFilesForUser();
 jsInlineF("\nvar cartDb=\"%s %s\";\n", trackHubSkipHubName(hGenome(database)), database);
-//jsInlineF("\nimport {hubCreate} from \"../js/hgMyData.js;\n");
 jsInline("$(document).ready(function() {\nhubCreate.init();\n})");
 puts("</div>");
 }