Skip to content

Commit

Permalink
report: specify transfer or resource size for columns
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Apr 6, 2020
1 parent 2f3da7d commit ae0f076
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class EfficientAnimatedContent extends ByteEfficiencyAudit {
/** @type {LH.Audit.Details.Opportunity['headings']} */
const headings = [
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnResourceSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/byte-efficiency/offscreen-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class OffscreenImages extends ByteEfficiencyAudit {
const headings = [
{key: 'url', valueType: 'thumbnail', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnResourceSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class RenderBlockingResources extends Audit {
/** @type {LH.Audit.Details.Opportunity['headings']} */
const headings = [
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
{key: 'wastedMs', valueType: 'timespanMs', label: str_(i18n.UIStrings.columnWastedMs)},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TotalByteWeight extends ByteEfficiencyAudit {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', itemType: 'bytes', text: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', itemType: 'bytes', text: str_(i18n.UIStrings.columnTransferSize)},
];

const tableDetails = ByteEfficiencyAudit.makeTableDetails(headings, results);
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/byte-efficiency/unminified-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class UnminifiedCSS extends ByteEfficiencyAudit {
/** @type {LH.Audit.Details.Opportunity['headings']} */
const headings = [
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class UnminifiedJavaScript extends ByteEfficiencyAudit {
/** @type {LH.Audit.Details.Opportunity['headings']} */
const headings = [
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/byte-efficiency/unused-css-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UnusedCSSRules extends ByteEfficiencyAudit {
/** @type {LH.Audit.Details.Opportunity['headings']} */
const headings = [
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class UnusedJavaScript extends ByteEfficiencyAudit {
headings: [
/* eslint-disable max-len */
{key: 'url', valueType: 'url', subRows: {key: 'sources', valueType: 'code'}, label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', subRows: {key: 'sourceBytes'}, label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', subRows: {key: 'sourceBytes'}, label: str_(i18n.UIStrings.columnTransferSize)},
{key: 'wastedBytes', valueType: 'bytes', subRows: {key: 'sourceWastedBytes'}, label: str_(i18n.UIStrings.columnWastedBytes)},
/* eslint-enable max-len */
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class CacheHeaders extends Audit {
// TODO(i18n): pre-compute localized duration
{key: 'cacheLifetimeMs', itemType: 'ms', text: str_(i18n.UIStrings.columnCacheTTL),
displayUnit: 'duration'},
{key: 'totalBytes', itemType: 'bytes', text: str_(i18n.UIStrings.columnSize),
{key: 'totalBytes', itemType: 'bytes', text: str_(i18n.UIStrings.columnTransferSize),
displayUnit: 'kb', granularity: 1},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class UsesOptimizedImages extends ByteEfficiencyAudit {
const headings = [
{key: 'url', valueType: 'thumbnail', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnResourceSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class UsesResponsiveImages extends ByteEfficiencyAudit {
const headings = [
{key: 'url', valueType: 'thumbnail', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnResourceSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ResponsesAreCompressed extends ByteEfficiencyAudit {
/** @type {LH.Audit.Details.Opportunity['headings']} */
const headings = [
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/byte-efficiency/uses-webp-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class UsesWebPImages extends ByteEfficiencyAudit {
const headings = [
{key: 'url', valueType: 'thumbnail', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnSize)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnResourceSize)},
{key: 'wastedBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnWastedBytes)},
];

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/third-party-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class ThirdPartySummary extends Audit {
const headings = [
{key: 'entity', itemType: 'link', text: str_(UIStrings.columnThirdParty)},
{key: 'transferSize', granularity: 1, itemType: 'bytes',
text: str_(i18n.UIStrings.columnSize)},
text: str_(i18n.UIStrings.columnTransferSize)},
{key: 'blockingTime', granularity: 1, itemType: 'ms',
text: str_(UIStrings.columnBlockingTime)},
];
Expand Down
8 changes: 5 additions & 3 deletions lighthouse-core/lib/i18n/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ const UIStrings = {
displayValueMsSavings: 'Potential savings of {wastedMs, number, milliseconds}\xa0ms',
/** Label for a column in a data table; entries will be the URL of a web resource */
columnURL: 'URL',
/** Label for a column in a data table; entries will be the size of a web resource in kilobytes. */
/** Label for a column in a data table; entries will be the size or quantity of some resource, e.g. the width and height dimensions of an image or the number of images in a web page. */
columnSize: 'Size',
/** Label for a column in a data table; entries will be the file size of a web resource in kilobytes. */
columnResourceSize: 'Resource Size',
/** Label for a column in a data table; entries will be the download size of a web resource in kilobytes. */
columnTransferSize: 'Transfer Size',
/** Label for a column in a data table; entries will be the time to live value of the cache header on a web resource. */
columnCacheTTL: 'Cache TTL',
/** Label for a column in a data table; entries will be the number of kilobytes the user could reduce their page by if they implemented the suggestions. */
Expand All @@ -72,8 +76,6 @@ const UIStrings = {
columnResourceType: 'Resource Type',
/** Label for a column in a data table; entries will be the number of network requests done by a webpage. */
columnRequests: 'Requests',
/** Label for a column in a data table; entries will be the number of kilobytes transferred to load a set of files. */
columnTransferSize: 'Transfer Size',
/** Label for a column in a data table; entries will be the names of arbitrary objects, e.g. the name of a Javascript library, or the name of a user defined timing event. */
columnName: 'Name',
/** Label for a column in a data table; entries will be the names of JavaScript code, e.g. the name of a Javascript package or module. */
Expand Down
3 changes: 3 additions & 0 deletions lighthouse-core/lib/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,9 @@
"lighthouse-core/lib/i18n/i18n.js | columnRequests": {
"message": "Requests"
},
"lighthouse-core/lib/i18n/i18n.js | columnResourceSize": {
"message": "Resource Size"
},
"lighthouse-core/lib/i18n/i18n.js | columnResourceType": {
"message": "Resource Type"
},
Expand Down
3 changes: 3 additions & 0 deletions lighthouse-core/lib/i18n/locales/en-XL.json
Original file line number Diff line number Diff line change
Expand Up @@ -1433,6 +1433,9 @@
"lighthouse-core/lib/i18n/i18n.js | columnRequests": {
"message": "R̂éq̂úêśt̂ś"
},
"lighthouse-core/lib/i18n/i18n.js | columnResourceSize": {
"message": "R̂éŝóûŕĉé Ŝíẑé"
},
"lighthouse-core/lib/i18n/i18n.js | columnResourceType": {
"message": "R̂éŝóûŕĉé T̂ýp̂é"
},
Expand Down
38 changes: 20 additions & 18 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@
"key": "transferSize",
"granularity": 1,
"itemType": "bytes",
"text": "Size"
"text": "Transfer Size"
},
{
"key": "blockingTime",
Expand Down Expand Up @@ -2445,7 +2445,7 @@
{
"key": "totalBytes",
"itemType": "bytes",
"text": "Size",
"text": "Transfer Size",
"displayUnit": "kb",
"granularity": 1
}
Expand Down Expand Up @@ -2547,7 +2547,7 @@
{
"key": "totalBytes",
"itemType": "bytes",
"text": "Size"
"text": "Transfer Size"
}
],
"items": [
Expand Down Expand Up @@ -2632,7 +2632,7 @@
{
"key": "totalBytes",
"valueType": "bytes",
"label": "Size"
"label": "Transfer Size"
},
{
"key": "wastedMs",
Expand Down Expand Up @@ -2708,7 +2708,7 @@
{
"key": "totalBytes",
"valueType": "bytes",
"label": "Size"
"label": "Transfer Size"
},
{
"key": "wastedBytes",
Expand Down Expand Up @@ -2788,7 +2788,7 @@
{
"key": "totalBytes",
"valueType": "bytes",
"label": "Size"
"label": "Resource Size"
},
{
"key": "wastedBytes",
Expand Down Expand Up @@ -2847,7 +2847,7 @@
{
"key": "totalBytes",
"valueType": "bytes",
"label": "Size"
"label": "Transfer Size"
},
{
"key": "wastedBytes",
Expand Down Expand Up @@ -6056,7 +6056,13 @@
],
"lighthouse-core/lib/i18n/i18n.js | columnTransferSize": [
"audits[performance-budget].details.headings[2].text",
"audits[resource-summary].details.headings[2].text"
"audits[resource-summary].details.headings[2].text",
"audits[third-party-summary].details.headings[1].text",
"audits[uses-long-cache-ttl].details.headings[2].text",
"audits[total-byte-weight].details.headings[1].text",
"audits[render-blocking-resources].details.headings[1].label",
"audits[unminified-javascript].details.headings[1].label",
"audits[uses-text-compression].details.headings[1].label"
],
"lighthouse-core/lib/i18n/i18n.js | columnOverBudget": [
"audits[performance-budget].details.headings[4].text",
Expand Down Expand Up @@ -6168,16 +6174,6 @@
"lighthouse-core/audits/third-party-summary.js | columnThirdParty": [
"audits[third-party-summary].details.headings[0].text"
],
"lighthouse-core/lib/i18n/i18n.js | columnSize": [
"audits[third-party-summary].details.headings[1].text",
"audits[uses-long-cache-ttl].details.headings[2].text",
"audits[total-byte-weight].details.headings[1].text",
"audits[render-blocking-resources].details.headings[1].label",
"audits[unminified-javascript].details.headings[1].label",
"audits[uses-webp-images].details.headings[2].label",
"audits[uses-text-compression].details.headings[1].label",
"audits[tap-targets].details.headings[1].text"
],
"lighthouse-core/audits/third-party-summary.js | columnBlockingTime": [
"audits[third-party-summary].details.headings[2].text"
],
Expand Down Expand Up @@ -6560,6 +6556,9 @@
"lighthouse-core/audits/byte-efficiency/uses-webp-images.js | description": [
"audits[uses-webp-images].description"
],
"lighthouse-core/lib/i18n/i18n.js | columnResourceSize": [
"audits[uses-webp-images].details.headings[2].label"
],
"lighthouse-core/audits/byte-efficiency/uses-optimized-images.js | title": [
"audits[uses-optimized-images].title"
],
Expand Down Expand Up @@ -6814,6 +6813,9 @@
"lighthouse-core/audits/seo/tap-targets.js | tapTargetHeader": [
"audits[tap-targets].details.headings[0].text"
],
"lighthouse-core/lib/i18n/i18n.js | columnSize": [
"audits[tap-targets].details.headings[1].text"
],
"lighthouse-core/audits/seo/tap-targets.js | overlappingTargetHeader": [
"audits[tap-targets].details.headings[2].text"
],
Expand Down
14 changes: 7 additions & 7 deletions proto/sample_v2_round_trip.json
Original file line number Diff line number Diff line change
Expand Up @@ -2438,7 +2438,7 @@
},
{
"key": "totalBytes",
"label": "Size",
"label": "Transfer Size",
"valueType": "bytes"
},
{
Expand Down Expand Up @@ -2791,7 +2791,7 @@
"granularity": 1.0,
"itemType": "bytes",
"key": "transferSize",
"text": "Size"
"text": "Transfer Size"
},
{
"granularity": 1.0,
Expand Down Expand Up @@ -2921,7 +2921,7 @@
{
"itemType": "bytes",
"key": "totalBytes",
"text": "Size"
"text": "Transfer Size"
}
],
"items": [
Expand Down Expand Up @@ -3003,7 +3003,7 @@
},
{
"key": "totalBytes",
"label": "Size",
"label": "Transfer Size",
"valueType": "bytes"
},
{
Expand Down Expand Up @@ -3189,7 +3189,7 @@
"granularity": 1.0,
"itemType": "bytes",
"key": "totalBytes",
"text": "Size"
"text": "Transfer Size"
}
],
"items": [
Expand Down Expand Up @@ -3389,7 +3389,7 @@
},
{
"key": "totalBytes",
"label": "Size",
"label": "Transfer Size",
"valueType": "bytes"
},
{
Expand Down Expand Up @@ -3437,7 +3437,7 @@
},
{
"key": "totalBytes",
"label": "Size",
"label": "Resource Size",
"valueType": "bytes"
},
{
Expand Down

0 comments on commit ae0f076

Please sign in to comment.