Skip to content
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

Merged
merged 10 commits into from
May 24, 2018
Merged

report: updates for devtools roll #5326

merged 10 commits into from
May 24, 2018

Conversation

paulirish
Copy link
Member

No description provided.

Copy link
Member Author

@paulirish paulirish left a 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.

Copy link
Collaborator

@patrickhulce patrickhulce left a 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;
Copy link
Collaborator

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?

Copy link
Member Author

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;
Copy link
Collaborator

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?

Copy link
Member Author

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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?

Copy link
Member Author

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);
Copy link
Collaborator

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?

Copy link
Member Author

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;
Copy link
Collaborator

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">
Copy link
Collaborator

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 :)

Copy link
Member

@brendankenny brendankenny left a 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`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the 'were'?

Copy link
Member Author

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

Copy link
Member

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);
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg. replaceChild ftw

@paulirish
Copy link
Member Author

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?

That's a good idea. I can look into that after this guy.

@paulirish paulirish added the 3.0 label May 24, 2018
@brendankenny
Copy link
Member

That's a good idea. I can look into that after this guy.

SG

/**
* @return {boolean}
*/
isDevTools() {
Copy link
Member

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?

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voodoo 🎩 🐰

@paulirish paulirish merged commit 754093b into master May 24, 2018
@paulirish paulirish deleted the devtoolsstylez branch May 24, 2018 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants