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
--- 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"));
}