mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1308415 - Update about:telemetry to show keyed scalars. r=gfritzsche
This commit is contained in:
parent
44dd1f666b
commit
b945a720fc
@ -1580,6 +1580,40 @@ var Scalars = {
|
||||
}
|
||||
};
|
||||
|
||||
var KeyedScalars = {
|
||||
/**
|
||||
* Render the keyed scalar data - if present - from the payload in a simple key-value table.
|
||||
* @param aPayload A payload object to render the data from.
|
||||
*/
|
||||
render: function(aPayload) {
|
||||
let scalarsSection = document.getElementById("keyed-scalars");
|
||||
removeAllChildNodes(scalarsSection);
|
||||
|
||||
if (!aPayload.processes || !aPayload.processes.parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
let keyedScalars = aPayload.processes.parent.keyedScalars;
|
||||
const hasData = keyedScalars && Object.keys(keyedScalars).length > 0;
|
||||
setHasData("keyed-scalars-section", hasData);
|
||||
if (!hasData) {
|
||||
return;
|
||||
}
|
||||
|
||||
const headingName = bundle.GetStringFromName("namesHeader");
|
||||
const headingValue = bundle.GetStringFromName("valuesHeader");
|
||||
for (let scalar in keyedScalars) {
|
||||
// Add the name of the scalar.
|
||||
let scalarNameSection = document.createElement("h2");
|
||||
scalarNameSection.appendChild(document.createTextNode(scalar));
|
||||
scalarsSection.appendChild(scalarNameSection);
|
||||
// Populate the section with the key-value pairs from the scalar.
|
||||
const table = KeyValueTable.render(keyedScalars[scalar], headingName, headingValue);
|
||||
scalarsSection.appendChild(table);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for showing either the toggle element or "No data collected" message for a section
|
||||
*
|
||||
@ -1956,6 +1990,7 @@ function displayPingData(ping, updatePayloadList = false) {
|
||||
|
||||
// Show scalar data.
|
||||
Scalars.render(payload);
|
||||
KeyedScalars.render(payload);
|
||||
|
||||
// Show histogram data
|
||||
let hgramDiv = document.getElementById("histograms");
|
||||
|
@ -144,6 +144,15 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="keyed-scalars-section" class="data-section">
|
||||
<input type="checkbox" class="statebox"/>
|
||||
<h1 class="section-name">&aboutTelemetry.keyedScalarsSection;</h1>
|
||||
<span class="toggle-caption">&aboutTelemetry.toggle;</span>
|
||||
<span class="empty-caption">&aboutTelemetry.emptySection;</span>
|
||||
<div id="keyed-scalars" class="data">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="histograms-section" class="data-section">
|
||||
<input type="checkbox" class="statebox"/>
|
||||
<h1 class="section-name">&aboutTelemetry.histogramsSection;</h1>
|
||||
|
@ -104,6 +104,10 @@ Ping
|
||||
Scalars
|
||||
">
|
||||
|
||||
<!ENTITY aboutTelemetry.keyedScalarsSection "
|
||||
Keyed Scalars
|
||||
">
|
||||
|
||||
<!ENTITY aboutTelemetry.histogramsSection "
|
||||
Histograms
|
||||
">
|
||||
|
Loading…
Reference in New Issue
Block a user