-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated report styles #2297
Merged
Merged
Updated report styles #2297
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
323349c
Updated report styles
chowse 868454f
Removed an extra indent and adjusted trailing padding after category …
chowse b336091
Moved DevTools styling behind the .lh-devtools class
chowse f1f577e
Review fixes
chowse 07c42df
Removed unneeded description parameter
chowse 3256d86
Merge branch 'master' of github.com:GoogleChrome/lighthouse into whit…
chowse bdec2c9
Fixed eslint errors
chowse 9d40d68
Fixed failing tests
chowse 1041cee
Merge remote-tracking branch 'upstream/master' into whitespace
chowse f0991b7
Fixed failing tests
chowse c725c69
Merge branch 'master' of github.com:GoogleChrome/lighthouse into whit…
chowse cbe08f4
Merge branch 'master' into chowse-whitespace
paulirish 369b152
fix bugs. lol useful commit message
paulirish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,28 @@ class CategoryRenderer { | |
* @return {!Element} | ||
*/ | ||
_renderTimelineMetricAudit(audit, scale) { | ||
const tmpl = this._dom.cloneTemplate('#tmpl-lh-timeline-metric', this._templateContext); | ||
const element = this._dom.find('.lh-timeline-metric', tmpl); | ||
element.classList.add(`lh-timeline-metric--${Util.calculateRating(audit.score)}`); | ||
|
||
const titleEl = this._dom.find('.lh-timeline-metric__title', tmpl); | ||
titleEl.textContent = audit.result.description; | ||
|
||
const valueEl = this._dom.find('.lh-timeline-metric__value', tmpl); | ||
valueEl.textContent = audit.result.displayValue; | ||
|
||
const descriptionEl = this._dom.find('.lh-timeline-metric__description', tmpl); | ||
descriptionEl.appendChild(this._dom.convertMarkdownLinkSnippets(audit.result.helpText)); | ||
|
||
if (typeof audit.result.rawValue !== 'number') { | ||
const debugStrEl = this._dom.createChildOf(element, 'div', 'lh-debug'); | ||
debugStrEl.textContent = audit.result.debugString || 'Report error: no metric information'; | ||
return tmpl; | ||
} | ||
|
||
const sparklineBarEl = this._dom.find('.lh-sparkline__bar', tmpl); | ||
sparklineBarEl.style.width = `${audit.result.rawValue / scale * 100}%`; | ||
/* | ||
const element = this._dom.createElement('div', | ||
`lh-timeline-metric lh-timeline-metric--${Util.calculateRating(audit.score)}`); | ||
|
||
|
@@ -152,8 +174,8 @@ class CategoryRenderer { | |
const descriptionEl = this._dom.createChildOf(element, 'div', | ||
'lh-timeline-metric__description'); | ||
descriptionEl.appendChild(this._dom.convertMarkdownLinkSnippets(audit.result.helpText)); | ||
|
||
return element; | ||
*/ | ||
return tmpl; | ||
} | ||
|
||
/** | ||
|
@@ -223,19 +245,21 @@ class CategoryRenderer { | |
'lh-audit-group__header lh-expandable-details__header'); | ||
auditGroupHeader.textContent = group.title; | ||
|
||
const auditGroupDescription = this._dom.createElement('div', 'lh-audit-group__description'); | ||
auditGroupDescription.appendChild(this._dom.convertMarkdownLinkSnippets(group.description)); | ||
|
||
const auditGroupSummary = this._dom.createElement('summary', | ||
'lh-audit-group__summary lh-expandable-details__summary'); | ||
const auditGroupArrow = this._dom.createElement('div', 'lh-toggle-arrow', { | ||
title: 'See audits', | ||
}); | ||
auditGroupSummary.appendChild(auditGroupHeader); | ||
auditGroupSummary.appendChild(auditGroupArrow); | ||
|
||
auditGroupElem.appendChild(auditGroupSummary); | ||
auditGroupElem.appendChild(auditGroupDescription); | ||
|
||
if (group.description) { | ||
const auditGroupDescription = this._dom.createElement('div', 'lh-audit-group__description'); | ||
auditGroupDescription.appendChild(this._dom.convertMarkdownLinkSnippets(group.description)); | ||
auditGroupElem.appendChild(auditGroupDescription); | ||
} | ||
|
||
return auditGroupElem; | ||
} | ||
|
||
|
@@ -244,10 +268,10 @@ class CategoryRenderer { | |
* @return {!Element} | ||
*/ | ||
_renderPassedAuditsSection(elements) { | ||
const passedElem = this._dom.createElement('details', 'lh-passed-audits'); | ||
const passedSummary = this._dom.createElement('summary', 'lh-passed-audits-summary'); | ||
passedElem.appendChild(passedSummary); | ||
passedSummary.textContent = `View ${elements.length} passed items`; | ||
const passedElem = this._renderAuditGroup({ | ||
title: `${elements.length} Passed Audits`, | ||
description: '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can probably just not set this now that we've made it optional |
||
}); | ||
elements.forEach(elem => passedElem.appendChild(elem)); | ||
return passedElem; | ||
} | ||
|
@@ -269,7 +293,6 @@ class CategoryRenderer { | |
Object.keys(auditsGroupedByGroup).forEach(groupId => { | ||
const group = groupDefinitions[groupId]; | ||
const auditGroupElem = this._renderAuditGroup(group); | ||
auditGroupElem.classList.add('lh-audit-group--manual'); | ||
|
||
auditsGroupedByGroup[groupId].forEach(audit => { | ||
auditGroupElem.appendChild(this._renderAudit(audit)); | ||
|
@@ -347,14 +370,21 @@ class CategoryRenderer { | |
const passedAudits = nonManualAudits.filter(audit => audit.score === 100); | ||
const nonPassedAudits = nonManualAudits.filter(audit => !passedAudits.includes(audit)); | ||
|
||
for (const audit of nonPassedAudits) { | ||
element.appendChild(this._renderAudit(audit)); | ||
} | ||
const nonPassedElem = this._renderAuditGroup({ | ||
title: `${nonPassedAudits.length} failed audits`, | ||
description: '', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
}); | ||
nonPassedElem.open = true; | ||
nonPassedAudits.forEach(audit => nonPassedElem.appendChild(this._renderAudit(audit))); | ||
element.appendChild(nonPassedElem); | ||
|
||
// Create a passed section if there are passing audits. | ||
if (passedAudits.length) { | ||
const passedElements = passedAudits.map(audit => this._renderAudit(audit)); | ||
const passedElem = this._renderPassedAuditsSection(passedElements); | ||
const passedElem = this._renderAuditGroup({ | ||
title: `${passedAudits.length} passed audits`, | ||
description: '', | ||
}); | ||
passedAudits.forEach(audit => passedElem.appendChild(this._renderAudit(audit))); | ||
element.appendChild(passedElem); | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover comment?