6aba66d1a3b3e28e00e2f3d89491a4927e92bd30
hiram
  Tue Mar 8 10:17:54 2022 -0800
reset hideAll to be showAll refs #28930

diff --git src/hg/js/gar.js src/hg/js/gar.js
index 20ec45b..42f7f00 100644
--- src/hg/js/gar.js
+++ src/hg/js/gar.js
@@ -191,100 +191,99 @@
           var ucscDb = comName.includes("cgi-bin/hgTracks");
           var iucnStatus = rowId.cells[iucnRow].innerHTML;
           var hasIucn = false;
           if (iucnStatus) {
              hasIucn = ! iucnStatus.includes(" ");
           }
           if ( rowId.style.display !== "none") {
             gar.countVisHidden(thisClade, categoryVisible, isGCA, isGCF, canBeRequested, ucscDb, hasIucn);
             ++visRows;
           } else {
             gar.countVisHidden(thisClade, categoryHidden, isGCA, isGCF, canBeRequested, ucscDb, hasIucn);
           }
         }
       }
       var notVis = totalRows - visRows;
-      /* fixup the hideAll checkbox status, if there are any rows visible,
-       * those hideAll checkboxes should indicate off so they are
-       * thereby ready to do the function of 'hideAll'.  Or if all rows
-       * are not visible, they should be on to indicate 'hideAll' is in effect
+      /* fixup the showAll checkbox status, fully on == checked box
+       * partially on == indeterminate/minus sign in box, fully off == empty box
        */
       /* reset the checked status on all the other show/hide check boxes */
       gar.checkBoxNames.forEach(function(checkBox, name) {
          // add the counts (visible/hidden) to the checkBox label text
          var visibleCount = 0;
          if (categoryVisible.get(name)) {
            checkBox.checked = true;
            visibleCount = categoryVisible.get(name);
          } else {
            checkBox.checked = false;
          }
          var hiddenCount = 0;
          if ( categoryHidden.get(name) ) {
            hiddenCount = categoryHidden.get(name);
          }
          if (hiddenCount > 0 && visibleCount > 0) {
            checkBox.indeterminate = true;
          } else {
            checkBox.indeterminate = false;
          }
          var labelId = name + "Label";
          var labelEl = document.getElementById(labelId);
          var labelText = gar.checkBoxLabels.get(name);
          if (labelEl) {
             labelEl.innerText = labelText + " (" + visibleCount.toLocaleString() + "/" + hiddenCount.toLocaleString() + ")";
          } else {
 alert("no element for label '" + labelId + "'");
          }
       });
-      var hideAllList = document.getElementsByClassName('hideAll');
+      var showAllList = document.getElementsByClassName('showAll');
 //      var thisEt = gar.millis() - t0;
       var thisEt = et;
       if (visRows > 0) {
 //        var pageEt = gar.garEndTime.getTime() - window.garStartTime.getTime();
 //        perfDisplay.innerHTML = "countRows  " + gar.garEndTime.getTime() + " - " + window.garStartTime.getTime() + " = page load time " + pageEt + " millis : DOMContentLoaded: " + gar.onLoadTime.getTime();
         if (gar.measureTiming) {
           counterDisplay.innerHTML = "showing " + visRows.toLocaleString() + " assemblies, " + notVis.toLocaleString() + " hidden : process time: " + thisEt + " millis";
         } else {
           counterDisplay.innerHTML = "showing " + visRows.toLocaleString() + " assemblies, " + notVis.toLocaleString() + " hidden";
         }
-        for (i = 0; i < hideAllList.length; i++) {
-          hideAllList[i].checked = false;
-          if (visRows > 0 && notVis > 0) {
-            hideAllList[i].indeterminate = true;
+        for (i = 0; i < showAllList.length; i++) {
+          if (notVis > 0) {
+            showAllList[i].checked = false;	// they are not all on
+            showAllList[i].indeterminate = true;
           } else {
-            hideAllList[i].indeterminate = false;
+            showAllList[i].indeterminate = false;
+            showAllList[i].checked = true;	// all rows are on
           }
         }
-        hideAllLabelList = document.getElementsByClassName('hideAllLabel');
-        for (i = 0; i < hideAllLabelList.length; i++) {
-          hideAllLabelList[i].innerHTML = "hide all (" + visRows.toLocaleString() + "/" + notVis.toLocaleString() + ")"; 
+        showAllLabelList = document.getElementsByClassName('showAllLabel');
+        for (i = 0; i < showAllLabelList.length; i++) {
+          showAllLabelList[i].innerHTML = " show all (" + visRows.toLocaleString() + "/" + notVis.toLocaleString() + ")";
         }
 
-      } else {
+      } else {	// visRows == 0
         if (gar.measureTiming) {
           counterDisplay.innerHTML = totalRows.toLocaleString() + " total ssemblies : use the selection menus to select subsets : process time: " + thisEt + " millis";
         } else {
           counterDisplay.innerHTML = totalRows.toLocaleString() + " total ssemblies : use the selection menus to select subsets";
         }
-        for (i = 0; i < hideAllList.length; i++) {
-          hideAllList[i].checked = true;
-          hideAllList[i].indeterminate = false;
+        for (i = 0; i < showAllList.length; i++) {
+          showAllList[i].checked = false;
+          showAllList[i].indeterminate = false;
         }
-        hideAllLabelList = document.getElementsByClassName('hideAllLabel');
-        for (i = 0; i < hideAllLabelList.length; i++) {
-          hideAllLabelList[i].innerHTML = "hide all (" + visRows.toLocaleString() + "/" + notVis.toLocaleString() + ")"; 
+        showAllLabelList = document.getElementsByClassName('showAllLabel');
+        for (i = 0; i < showAllLabelList.length; i++) {
+          showAllLabelList[i].innerHTML = " show all (" + visRows.toLocaleString() + "/" + notVis.toLocaleString() + ")";
         }
       }
     },
 
     // given a column number n, and true/false in tf
     // set that column visibility
     setColumnNvis: function(n, tf) {
       for (var i = 0; i < gar.cladeTableList.length; i++) {
         for (var j = 0; j < gar.cladeTableList[i].rows.length; j++) {
           var c = gar.cladeTableList[i].rows[j].cells[n];
           if (c) {
             gar.setCellVis(c, tf);
           }
         }
       }
@@ -303,100 +302,95 @@
     },
 
     hideTable: function(tableName) {
       tId = document.getElementById(tableName);
       var buttonName = tableName + "HideShow";
       bId = document.getElementById(buttonName);
       if ( tId.style.display === "none") {
         tId.style.display = "block";
         bId.innerHTML = "[hide]";
       } else {
         tId.style.display = "none";
         bId.innerHTML = "[show]";
       }
     },
 
-    // foreach table, for each row in the table, hide row
-    hideAll: function(offOn) {
+    // foreach table, for each row in the table, show row
+    showAll: function(offOn) {
       var t0 = gar.millis();
       for (var i = 0; i < gar.cladeTableList.length; i++) {
         for (var j = 0; j < gar.cladeTableList[i].rows.length; j++) {
           var rowId = gar.cladeTableList[i].rows[j];
           var tagN = rowId.parentNode.tagName.toLowerCase();
           if (tagN === 'thead' || tagN === 'tfoot') {
             continue;
           }
-          if (offOn) {   // true, turn *off* the row == this is 'hideAll'
-            rowId.style.display = "none";
-          } else {	// false, turn *on* the row == this is ! 'hideAll'
+          if (offOn) {   // true, turn *on* the row == this is 'showAll'
             rowId.style.display = "table-row";
+          } else {	// false, turn *off* the row == this is ! 'showAll'
+            rowId.style.display = "none";
           }
         }
       }
-      /* reset the checked status on all the other show/hide check boxes */
-//      var checkBoxList = document.getElementsByClassName('hideShow');
-//      for (var i = 0; i < checkBoxList.length; i++) {
-//        checkBoxList[i].checked = ! offOn;
-//      }
-      /* the countVisibleRows will take care of the status on all 'hideAll'
+      /* the countVisibleRows will take care of the status on all 'showAll'
        * checkboxes - AND the checkBox 'hideShow' check boxes depending upon
        * the counts for that category.
        */
       var et = gar.millis() - t0;
       gar.countVisibleRows(et);
     },
 
     // given one of: garList gakList gcaList gcfList, work through
     //   all the elements to change vis
     // list can be any of the class lists for rows in the tables
     // offOn - false turn off, true turn on
     resetListVis: function(list, offOn) {
       var t0 = gar.millis();
       for (var i = 0; i < list.length; i++) {
          var rowId = list[i];
          if (offOn) {   // true, turn on the row
            rowId.style.display = "table-row";
          } else {	// false, turn off the row
            rowId.style.display = "none";
          }
       }
       var et = gar.millis() - t0;
       gar.countVisibleRows(et);
     },
 
     // a check box function is working, do not allow any of
     // them to be available for a second click while in progress
     //  tf is 'true' or 'false' to disable (true), or reenable (false)
     disableCheckBoxes: function(tf) {
-      var hideAllList = document.getElementsByClassName('hideAll');
+      var showAllList = document.getElementsByClassName('showAll');
       var i = 0;
-      for (i = 0; i < hideAllList.length; i++) {
-        hideAllList[i].disabled = tf;
+      for (i = 0; i < showAllList.length; i++) {
+        showAllList[i].disabled = tf;
       }
       var hideShowList = document.getElementsByClassName('hideShow');
       for (i = 0; i < hideShowList.length; i++) {
         hideShowList[i].disabled = tf;
       }
     },
 
     // checked is false when off, true when on
     // value comes from the value='string' in the <input value='string'> element
     visCheckBox: function(e) {
       var offOn = e.checked;    // false to turn off, true to turn on
       gar.disableCheckBoxes(true);  // disable while processing
       if (e.value === "all") {
-        gar.hideAll(offOn);
+        gar.showAll(offOn);
       } else {
         var thisList = document.getElementsByClassName(e.value);
         gar.resetListVis(thisList, offOn);
         if (e.value === "gak") {	// implies also ucscDb list
           thisList = document.getElementsByClassName("ucscDb");
           gar.resetListVis(thisList, offOn);
         }
       }
       gar.disableCheckBoxes(false);  // re-enable as processing done
     },
 
     columnPullDownClick: function(e) {
       if (gar.columnCheckBoxItems.classList.contains('visible')) {
         gar.columnCheckBoxItems.classList.remove('visible');
         gar.columnCheckBoxItems.style.display = "none";