Bug 1393478 - Clear the search filter when switching section r=chutten

MozReview-Commit-ID: 3Rtr8eLsc77

--HG--
extra : rebase_source : 00220ac6283db92eef1e65f5c4304ead7313f044
This commit is contained in:
flyingrub 2017-08-25 16:48:58 +02:00
Родитель c9deae8e08
Коммит d82f3cb000
1 изменённых файлов: 15 добавлений и 9 удалений

Просмотреть файл

@ -1313,6 +1313,10 @@ var Histogram = {
var Search = { var Search = {
blacklist: [
"raw-payload-section"
],
// Pass if: all non-empty array items match (case-sensitive) // Pass if: all non-empty array items match (case-sensitive)
isPassText(subject, filter) { isPassText(subject, filter) {
for (let item of filter) { for (let item of filter) {
@ -1841,19 +1845,21 @@ function displayProcessesSelector(selectedSection) {
processes.hidden = !whitelist.includes(selectedSection); processes.hidden = !whitelist.includes(selectedSection);
} }
function adjustSearchState() { function refreshSearch() {
let selectedSection = document.querySelector(".category.selected").getAttribute("value"); let selectedSection = document.querySelector(".category.selected").getAttribute("value");
let blacklist = [
"raw-payload-section"
];
let search = document.getElementById("search"); let search = document.getElementById("search");
search.hidden = blacklist.includes(selectedSection); if (!Search.blacklist.includes(selectedSection)) {
// Filter element on section change.
if (!blacklist.includes(selectedSection)) {
Search.search(search.value); Search.search(search.value);
} }
} }
function adjustSearchState() {
let selectedSection = document.querySelector(".category.selected").getAttribute("value");
let search = document.getElementById("search");
search.hidden = Search.blacklist.includes(selectedSection);
Search.search(""); // reinitialize search state.
}
function adjustSection() { function adjustSection() {
let selectedCategory = document.querySelector(".category.selected"); let selectedCategory = document.querySelector(".category.selected");
if (!selectedCategory.classList.contains("has-data")) { if (!selectedCategory.classList.contains("has-data")) {
@ -2084,8 +2090,8 @@ function onLoad() {
// Update ping data when async Telemetry init is finished. // Update ping data when async Telemetry init is finished.
Telemetry.asyncFetchTelemetryData(async () => { Telemetry.asyncFetchTelemetryData(async () => {
await PingPicker.update();
urlStateRestore(); urlStateRestore();
await PingPicker.update();
}); });
} }
@ -2339,8 +2345,8 @@ function displayPingData(ping, updatePayloadList = false) {
try { try {
PingPicker.render(); PingPicker.render();
displayRichPingData(ping, updatePayloadList); displayRichPingData(ping, updatePayloadList);
adjustSearchState();
adjustSection(); adjustSection();
refreshSearch();
} catch (err) { } catch (err) {
console.log(err); console.log(err);
PingPicker._showRawPingData(); PingPicker._showRawPingData();