-
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
report: updates for devtools roll #5326
Conversation
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.
Most notable change: scores-header was extracted from header so that devtools can reuse it in its very short header.
the if (this._dom.document().querySelector('.lh-devtools'))
checks could instead be done with the subclassing we do on the devtools side, but it makes it a lot easier to see a devtools-like report without bringing in those files. https://gist.github.com/paulirish/3d813ed5867412ab55517ba77eb5f93a#file-generate_report-js-L22-L26
i can begrudingly remove it and move to subclassing instead.
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.
thanks for workin' on these! few comments
@@ -124,10 +139,18 @@ class ReportRenderer { | |||
* @return {DocumentFragment} | |||
*/ | |||
_renderReport(report) { | |||
const headerStickyContainer = this._dom.createElement('div', 'lh-header-sticky'); | |||
headerStickyContainer.appendChild(this._renderReportHeader(report)); | |||
let headerStickyContainer; |
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.
should we rename this now that it's not really the sticky container?
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.
done
@@ -71,6 +71,9 @@ class ReportUIFeatures { | |||
* @param {ReportJSON} report | |||
*/ | |||
initFeatures(report) { | |||
// Quit if it's a devtools report. | |||
if (this._dom.document().querySelector('.lh-devtools')) return; |
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.
WDYT about a universal isDevTools
or something at the beginning rather than check this in multiple places?
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.
done
@@ -66,6 +66,7 @@ | |||
--lh-audit-group-vpadding: 8px; | |||
--lh-section-vpadding: 12px; | |||
--chevron-size: 12px; | |||
--bytes-col-width: 3px; |
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.
this is super confusing to look at on it's own, 0px didn't do the trick right? maybe comment to explain :)
--audit-group-indent: 16px; | ||
--audit-indent: 16px; | ||
--expandable-indent: 16px; | ||
--bytes-col-width: 3px; |
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.
also dupe :)
width: var(--bytes-col-width); | ||
} | ||
th.lh-table-column--bytes { | ||
white-space: normal!important; |
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.
are we overwriting anything anymore? do we still need to do this?
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.
good call thx
/* Keep bytes columns narrow if they follow urls */ | ||
.lh-table-column--url + th.lh-table-column--bytes, | ||
.lh-table-column--url + .lh-table-column--bytes + th.lh-table-column--bytes { | ||
min-width: var(--bytes-col-width); |
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.
didn't we conclude we could get away with just width
?
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.
yes i forgot the incantation.
@media screen and (max-width: 535px) { | ||
.tooltip { | ||
min-width: 45vw; | ||
padding: 3vw; |
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.
feels a bit weird to scale the padding as well, looks pretty good though so 👍
@@ -99,6 +99,39 @@ | |||
</div> | |||
</template> | |||
|
|||
|
|||
<!-- Lighthouse score container --> | |||
<template id="tmpl-lh-score-container"> |
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.
scores-container? score-container made me think it was for a single score :)
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.
re: devtools overriding. It definitely sucks having both overriding and inline conditionals for devtools to customize the report. My preference is overriding just cause that's how we designed, but would it be possible to bring in the overriding classes into the LH repo so the could all be here at once?
@@ -61,9 +61,9 @@ class UsesHTTP2Audit extends Audit { | |||
let displayValue = ''; | |||
if (resources.length > 1) { | |||
displayValue = | |||
`${Util.formatNumber(resources.length)} requests were not handled over HTTP/2`; | |||
`${Util.formatNumber(resources.length)} requests not served via HTTP/2`; |
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.
keep the 'were'?
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.
I deliberately omitted it for brevity. If it were a sentence i'd keep 'were' but it's just a lil string on the end of the line. wdyt
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.
I don't care much, but it is a little weird since the audit touched above keeps the verb :)
@@ -61,18 +61,33 @@ class ReportRenderer { | |||
*/ | |||
_renderReportHeader(report) { | |||
const header = this._dom.cloneTemplate('#tmpl-lh-heading', this._templateContext); | |||
const scoreContainer = this._dom.cloneTemplate('#tmpl-lh-score-container', this._templateContext); | |||
const toolbarEl = this._dom.find('.lh-toolbar', header); | |||
/** @type {HTMLDivElement} */ (toolbarEl.parentNode).insertBefore(scoreContainer, toolbarEl); |
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.
can the template just have a slot for the score container?
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.
sg. replaceChild ftw
That's a good idea. I can look into that after this guy. |
SG |
/** | ||
* @return {boolean} | ||
*/ | ||
isDevTools() { |
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.
add a TODO (maybe here?) for the future DT override cleanup?
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.
LGTM
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.
voodoo 🎩 🐰
No description provided.