Skip to content

Commit

Permalink
refining.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed May 5, 2018
1 parent 46c9cf8 commit b0f0fce
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
5 changes: 0 additions & 5 deletions lighthouse-core/report/html/renderer/category-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ class CategoryRenderer {
auditsUngrouped.notApplicable.forEach((/** @type {!ReportRenderer.AuditJSON} */ audit, i) =>
notApplicableElements.push(this.renderAudit(audit, i)));

let hasFailedGroups = false;

Object.keys(auditsGroupedByGroup).forEach(groupId => {
const group = groupDefinitions[groupId];
const groups = auditsGroupedByGroup[groupId];
Expand All @@ -314,8 +312,6 @@ class CategoryRenderer {
groups.failed.forEach((item, i) => auditGroupElem.appendChild(this.renderAudit(item, i)));
auditGroupElem.open = true;
failedElements.push(auditGroupElem);

hasFailedGroups = true;
}

if (groups.passed.length) {
Expand All @@ -333,7 +329,6 @@ class CategoryRenderer {
});

if (failedElements.length) {
// if failed audits are grouped skip the 'X Failed Audits' header
failedElements.forEach(elem => element.appendChild(elem));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
metricsColumn2El.appendChild(this._renderMetric(item));
});



metricAuditsEl.open = true;
metricAuditsEl.classList.add('lh-audit-group--adorned', 'lh-audit-group--metrics');
element.appendChild(metricAuditsEl);
Expand All @@ -138,9 +136,13 @@ class PerformanceCategoryRenderer extends CategoryRenderer {
// Opportunities
const opportunityAudits = category.audits
.filter(audit => audit.group === 'load-opportunities' && audit.result.score < 1)
.sort((auditA, auditB) => auditB.result.details.summary.wastedMs - auditA.result.details.summary.wastedMs);
.sort((auditA, auditB) =>
auditB.result.details.summary.wastedMs -
auditA.result.details.summary.wastedMs);

if (opportunityAudits.length) {
const maxWaste = Math.max(...opportunityAudits.map(audit => audit.result.details.summary.wastedMs));
const wastedMsValues = opportunityAudits.map(audit => audit.result.details.summary.wastedMs);
const maxWaste = Math.max(...wastedMsValues);
const scale = Math.ceil(maxWaste / 1000) * 1000;
const groupEl = this.renderAuditGroup(groups['load-opportunities'], {expandable: false});
const tmpl = this.dom.cloneTemplate('#tmpl-lh-opportunity-header', this.templateContext);
Expand Down
26 changes: 22 additions & 4 deletions lighthouse-core/report/html/report-styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b0f0fce

Please sign in to comment.