1e50fb3d3ab1219c45a6519d07b7b89fabc96ae8 max Fri May 23 08:25:38 2025 -0700 only sorting at top level, brittney diff --git src/cbPyLib/cellbrowser/cellbrowser.py src/cbPyLib/cellbrowser/cellbrowser.py index 3c77bf4..b7b994d 100755 --- src/cbPyLib/cellbrowser/cellbrowser.py +++ src/cbPyLib/cellbrowser/cellbrowser.py @@ -5582,30 +5582,35 @@ relCollDir = relpath(collFname, dataRoot) collOutFname = join(webCollDir, "dataset.json") collInfo = loadConfig(collFname, ignoreName=True) if dirname(collFname)!=dataRoot: fullPath = findParentConfigs(collFname, dataRoot, collInfo["name"])[1] else: fullPath = "" collInfo["name"] = fullPath logging.debug("Rebuilding collection %s from %s and subdirs of %s" % (collOutFname, collFname, webCollDir)) # the collections summary comes from the JSON files datasets = subdirDatasetJsonData(webCollDir) collSumm = summarizeDatasets(datasets) + + # sort the top level datasets alphabetically + if collInfo["name"]=="": + collSumm = list(sorted(collSumm, key=operator.itemgetter('shortLabel'))) + collInfo["datasets"] = collSumm parentFnames, fullPath, parentInfos = findParentConfigs(collFname, dataRoot, collInfo["name"]) if len(parentInfos)!=0: collInfo["parents"] = parentInfos collInfo["md5"] = md5ForList([json.dumps(collInfo)])[:MD5LEN] writeDatasetDesc(dirname(collFname), collInfo, webCollDir, coordFiles=None) writeJson(collInfo, collOutFname) def findRoot(inDir=None): """ return directory dataRoot defined in config file or CBDATAROOT environment variable. @@ -6295,31 +6300,30 @@ collCount = 0 dsCount = 0 for child in children: if "datasets" in child or "isCollection" in child: collCount += 1 else: dsCount +=1 if dsCount!=0: summDs["datasetCount"] = dsCount if collCount!=0: summDs["collectionCount"] = collCount dsList.append(summDs) - dsList = list(sorted(dsList, key=operator.itemgetter('shortLabel'))) return dsList def mergeJsFiles(extJsFnames, baseDir, libFname): # we are starting to have way too many .js files. Reduce all external ones to a single file jsOfh = open(libFname, "w") for fn in extJsFnames: jsOfh.write(open(join(baseDir, fn)).read()) jsOfh.write(";\n/* ---------- FILE END ------------ */\n") jsOfh.close() def makeIndexHtml(baseDir, outDir, devMode=False): " make the index.html, copy over all .js and related files and add their md5s " newFname = join(outDir, "index.html") tmpFname = newFname+".tmp" ofh = open(tmpFname, "w")