Bug 1389030 - Go to home when section has no data in about:telemetry r?gfritzsche draft
authorflyingrub <flyinggrub@gmail.com>
Thu, 10 Aug 2017 18:45:19 +0200
changeset 644189 a2d8c549c6e21de0cb3cfd08b45a54600b7e72f9
parent 642885 be392d4638052977f11e3fdd7fe6aac78057351c
child 725525 81042459bd81dfaf6393a0f9110e0a5c2456eecb
push id73345
push userbmo:flyinggrub@gmail.com
push dateThu, 10 Aug 2017 16:49:01 +0000
reviewersgfritzsche
bugs1389030
milestone57.0a1
Bug 1389030 - Go to home when section has no data in about:telemetry r?gfritzsche When switching to a ping that hasn't data for the current section go to home section. MozReview-Commit-ID: 2zTZUiyHe0M
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -1868,16 +1868,23 @@ function adjustSearchState() {
   let search = document.getElementById("search");
   search.hidden = blacklist.includes(selectedSection);
   // Filter element on section change.
   if (!blacklist.includes(selectedSection)) {
     Search.search(search.value);
   }
 }
 
+function adjustSection() {
+  let selectedCategory = document.querySelector(".category.selected");
+  if (!selectedCategory.classList.contains("has-data")) {
+    PingPicker._showStructuredPingData();
+  }
+}
+
 /**
  * Change the url according to the current section displayed
  * e.g about:telemetry#general-data
  */
 function changeUrlPath(selectedSection, subSection) {
   if (subSection) {
     let hash = window.location.hash.split("_")[0] + "_" + selectedSection;
     window.location.hash = hash;
@@ -2306,21 +2313,22 @@ function togglePingSections(isMainPing) 
 function displayPingData(ping, updatePayloadList = false) {
   gPingData = ping;
   // Render raw ping data.
   RawPayload.render(ping);
 
   try {
     PingPicker.render();
     displayRichPingData(ping, updatePayloadList);
+    adjustSearchState();
+    adjustSection();
   } catch (err) {
     console.log(err);
     PingPicker._showRawPingData();
   }
-  adjustSearchState();
 }
 
 function displayRichPingData(ping, updatePayloadList) {
   // Update the payload list and process lists
   if (updatePayloadList) {
     renderPayloadList(ping);
     renderProcessList(ping, document.getElementById("processes"));
   }