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: consolidate table headers #14315

Merged
merged 13 commits into from
Oct 21, 2022
Merged

report: consolidate table headers #14315

merged 13 commits into from
Oct 21, 2022

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Aug 24, 2022

Fixes #13803

Shouldn't be any surprises here. I pretty much took what @brendankenny did here. Also add some comapt code in prepareReportResult.

@connorjclark connorjclark requested a review from a team as a code owner August 24, 2022 20:20
@connorjclark connorjclark requested review from brendankenny and removed request for a team August 24, 2022 20:20
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.

One request for a prepareReportResult test, but otherwise LGTM. Yay very slow but eventual progress! :)

/**
* The data format of the column of values being described. Usually
* those values will be primitives rendered as this type, but the values
* could also be objects with their own type to override this field.
*/
itemType: ItemValueType;
valueType: ItemValueType;
Copy link
Member

Choose a reason for hiding this comment

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

complete tangent to this change, but I feel like there was a good reason table rows are called items but I really don't remember it

*/
subItemsHeading?: {key: string, valueType?: ItemValueType, displayUnit?: string, granularity?: number};

// NOTE: not used by opportunity details, but used in the renderer until table/opportunity unification.
Copy link
Member

Choose a reason for hiding this comment

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

What happens with these now? Do opportunities get a default granularity that matches their old ones now that they're tables?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looks like nothing changes here.

I don't understand the comment though. comes from #7177 . Is it just saying that no audit that makes an opportunity tables bothers to set granularity/displayUnit? Probably true when written, but now there's at least one (first byte efficiency audit I looked at uses them, duplicated-javascript).

Regardless, same things happens as before with opportunity tables–if granularity/displayUnit is not defined, details-renderer.js various defaults are used instead.

report/renderer/util.js Outdated Show resolved Hide resolved
report/renderer/util.js Show resolved Hide resolved
/**
* @param {Exclude<LH.Audit.Details.TableColumnHeading['subItemsHeading'], undefined>} subItemsHeading
* @param {LH.Audit.Details.TableColumnHeading} parentHeading
* @return {LH.Audit.Details.OpportunityColumnHeading['subItemsHeading']}
* @return {LH.Audit.Details.TableColumnHeading['subItemsHeading']}
*/
_getCanonicalizedsubItemsHeading(subItemsHeading, parentHeading) {
Copy link
Member

Choose a reason for hiding this comment

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

this can go too (how important is the falsy key check?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ehhh I think only I wanted that line added, and today I don't really see the point. A new audit would surely notice a bad key being referenced during development. so just drop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

replace TableColumnHeading with OpportunityColumnHeading
3 participants