Skip to content

report: consolidate table headers #14315

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

Merged
merged 13 commits into from
Oct 21, 2022
Merged
2 changes: 1 addition & 1 deletion core/audits/accessibility/axe-audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class AxeAudit extends Audit {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
/* eslint-disable max-len */
{key: 'node', itemType: 'node', subItemsHeading: {key: 'relatedNode', itemType: 'node'}, text: str_(UIStrings.failingElementsHeader)},
{key: 'node', valueType: 'node', subItemsHeading: {key: 'relatedNode', valueType: 'node'}, label: str_(UIStrings.failingElementsHeader)},
/* eslint-enable max-len */
];

Expand Down
6 changes: 3 additions & 3 deletions core/audits/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ class AutocompleteAudit extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: str_(i18n.UIStrings.columnFailingElem)},
{key: 'current', itemType: 'text', text: str_(UIStrings.columnCurrent)},
{key: 'suggestion', itemType: 'text', text: str_(UIStrings.columnSuggestions)},
{key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnFailingElem)},
{key: 'current', valueType: 'text', label: str_(UIStrings.columnCurrent)},
{key: 'suggestion', valueType: 'text', label: str_(UIStrings.columnSuggestions)},
];
const details = Audit.makeTableDetails(headings, failingFormsData);
let displayValue;
Expand Down
10 changes: 5 additions & 5 deletions core/audits/bootup-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ class BootupTime extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'total', granularity: 1, itemType: 'ms', text: str_(UIStrings.columnTotal)},
{key: 'scripting', granularity: 1, itemType: 'ms', text: str_(UIStrings.columnScriptEval)},
{key: 'scriptParseCompile', granularity: 1, itemType: 'ms',
text: str_(UIStrings.columnScriptParse)},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'total', granularity: 1, valueType: 'ms', label: str_(UIStrings.columnTotal)},
{key: 'scripting', granularity: 1, valueType: 'ms', label: str_(UIStrings.columnScriptEval)},
{key: 'scriptParseCompile', granularity: 1, valueType: 'ms',
label: str_(UIStrings.columnScriptParse)},
];

const details = BootupTime.makeTableDetails(headings, results, summary);
Expand Down
2 changes: 1 addition & 1 deletion core/audits/byte-efficiency/duplicated-javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class DuplicatedJavascript extends ByteEfficiencyAudit {
});
}

/** @type {LH.Audit.Details.OpportunityColumnHeading[]} */
/** @type {LH.Audit.Details.TableColumnHeading[]} */
const headings = [
/* eslint-disable max-len */
{key: 'source', valueType: 'code', subItemsHeading: {key: 'url', valueType: 'url'}, label: str_(i18n.UIStrings.columnSource)},
Expand Down
2 changes: 1 addition & 1 deletion core/audits/byte-efficiency/legacy-javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ class LegacyJavascript extends ByteEfficiencyAudit {
}
}

/** @type {LH.Audit.Details.OpportunityColumnHeading[]} */
/** @type {LH.Audit.Details.TableColumnHeading[]} */
const headings = [
/* eslint-disable max-len */
{key: 'url', valueType: 'url', subItemsHeading: {key: 'location', valueType: 'source-location'}, label: str_(i18n.UIStrings.columnURL)},
Expand Down
4 changes: 2 additions & 2 deletions core/audits/byte-efficiency/total-byte-weight.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class TotalByteWeight extends Audit {

/** @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.columnTransferSize)},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize)},
];

const tableDetails = Audit.makeTableDetails(headings, results);
Expand Down
6 changes: 3 additions & 3 deletions core/audits/byte-efficiency/uses-long-cache-ttl.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ class CacheHeaders extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
// TODO(i18n): pre-compute localized duration
{key: 'cacheLifetimeMs', itemType: 'ms', text: str_(i18n.UIStrings.columnCacheTTL),
{key: 'cacheLifetimeMs', valueType: 'ms', label: str_(i18n.UIStrings.columnCacheTTL),
displayUnit: 'duration'},
{key: 'totalBytes', itemType: 'bytes', text: str_(i18n.UIStrings.columnTransferSize),
{key: 'totalBytes', valueType: 'bytes', label: str_(i18n.UIStrings.columnTransferSize),
displayUnit: 'kb', granularity: 1},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class UsesResponsiveImagesSnapshot extends Audit {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
/* eslint-disable max-len */
{key: 'node', itemType: 'node', text: ''},
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'displayedDimensions', itemType: 'text', text: str_(UIStrings.columnDisplayedDimensions)},
{key: 'actualDimensions', itemType: 'text', text: str_(UIStrings.columnActualDimensions)},
{key: 'node', valueType: 'node', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'displayedDimensions', valueType: 'text', label: str_(UIStrings.columnDisplayedDimensions)},
{key: 'actualDimensions', valueType: 'text', label: str_(UIStrings.columnActualDimensions)},
/* eslint-enable max-len */
];

Expand Down
6 changes: 3 additions & 3 deletions core/audits/csp-xss.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ class CspXss extends Audit {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
/* eslint-disable max-len */
{key: 'description', itemType: 'text', subItemsHeading: {key: 'description'}, text: str_(i18n.UIStrings.columnDescription)},
{key: 'directive', itemType: 'code', subItemsHeading: {key: 'directive'}, text: str_(UIStrings.columnDirective)},
{key: 'severity', itemType: 'text', subItemsHeading: {key: 'severity'}, text: str_(UIStrings.columnSeverity)},
{key: 'description', valueType: 'text', subItemsHeading: {key: 'description'}, label: str_(i18n.UIStrings.columnDescription)},
{key: 'directive', valueType: 'code', subItemsHeading: {key: 'directive'}, label: str_(UIStrings.columnDirective)},
{key: 'severity', valueType: 'text', subItemsHeading: {key: 'severity'}, label: str_(UIStrings.columnSeverity)},
/* eslint-enable max-len */
];
const details = Audit.makeTableDetails(headings, results);
Expand Down
4 changes: 2 additions & 2 deletions core/audits/deprecations.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class Deprecations extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'value', itemType: 'text', text: str_(UIStrings.columnDeprecate)},
{key: 'source', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)},
{key: 'value', valueType: 'text', label: str_(UIStrings.columnDeprecate)},
{key: 'source', valueType: 'source-location', label: str_(i18n.UIStrings.columnSource)},
];
const details = Audit.makeTableDetails(headings, deprecations);

Expand Down
6 changes: 3 additions & 3 deletions core/audits/dobetterweb/dom-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ class DOMSize extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'statistic', itemType: 'text', text: str_(UIStrings.columnStatistic)},
{key: 'node', itemType: 'node', text: str_(i18n.UIStrings.columnElement)},
{key: 'value', itemType: 'numeric', text: str_(UIStrings.columnValue)},
{key: 'statistic', valueType: 'text', label: str_(UIStrings.columnStatistic)},
{key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnElement)},
{key: 'value', valueType: 'numeric', label: str_(UIStrings.columnValue)},
];

/** @type {LH.Audit.Details.Table['items']} */
Expand Down
2 changes: 1 addition & 1 deletion core/audits/dobetterweb/geolocation-on-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GeolocationOnStart extends ViolationAudit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'source', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)},
{key: 'source', valueType: 'source-location', label: str_(i18n.UIStrings.columnSource)},
];
// TODO(bckenny): there should actually be a ts error here. results[0].stackTrace
// should violate the results type. Shouldn't be removed from details items regardless.
Expand Down
2 changes: 1 addition & 1 deletion core/audits/dobetterweb/inspector-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class IssuesPanelEntries extends Audit {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
/* eslint-disable max-len */
{key: 'issueType', itemType: 'text', subItemsHeading: {key: 'url', itemType: 'url'}, text: str_(UIStrings.columnIssueType)},
{key: 'issueType', valueType: 'text', subItemsHeading: {key: 'url', valueType: 'url'}, label: str_(UIStrings.columnIssueType)},
/* eslint-enable max-len */
];

Expand Down
4 changes: 2 additions & 2 deletions core/audits/dobetterweb/js-libraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class JsLibrariesAudit extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'name', itemType: 'text', text: str_(i18n.UIStrings.columnName)},
{key: 'version', itemType: 'text', text: str_(UIStrings.columnVersion)},
{key: 'name', valueType: 'text', label: str_(i18n.UIStrings.columnName)},
{key: 'version', valueType: 'text', label: str_(UIStrings.columnVersion)},
];
const details = Audit.makeTableDetails(headings, libDetails, {});

Expand Down
2 changes: 1 addition & 1 deletion core/audits/dobetterweb/no-document-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class NoDocWriteAudit extends ViolationAudit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'source', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)},
{key: 'source', valueType: 'source-location', label: str_(i18n.UIStrings.columnSource)},
];
// TODO(bckenny): see TODO in geolocation-on-start
const details = ViolationAudit.makeTableDetails(headings, results);
Expand Down
2 changes: 1 addition & 1 deletion core/audits/dobetterweb/notification-on-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NotificationOnStart extends ViolationAudit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'source', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)},
{key: 'source', valueType: 'source-location', label: str_(i18n.UIStrings.columnSource)},
];
// TODO(bckenny): see TODO in geolocation-on-start
const details = ViolationAudit.makeTableDetails(headings, results);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PasswordInputsCanBePastedIntoAudit extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: str_(i18n.UIStrings.columnFailingElem)},
{key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnFailingElem)},
];

return {
Expand Down
4 changes: 2 additions & 2 deletions core/audits/dobetterweb/uses-http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ class UsesHTTP2Audit extends Audit {
if (artifacts.GatherContext.gatherMode === 'timespan') {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'protocol', itemType: 'text', text: str_(UIStrings.columnProtocol)},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'protocol', valueType: 'text', label: str_(UIStrings.columnProtocol)},
];

const details = Audit.makeTableDetails(headings, resources);
Expand Down
2 changes: 1 addition & 1 deletion core/audits/dobetterweb/uses-passive-event-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PassiveEventsAudit extends ViolationAudit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'source', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)},
{key: 'source', valueType: 'source-location', label: str_(i18n.UIStrings.columnSource)},
];
// TODO(bckenny): see TODO in geolocation-on-start
const details = ViolationAudit.makeTableDetails(headings, results);
Expand Down
6 changes: 4 additions & 2 deletions core/audits/errors-in-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ class ErrorLogs extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'sourceLocation', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)},
{key: 'description', itemType: 'code', text: str_(i18n.UIStrings.columnDescription)},
/* eslint-disable max-len */
{key: 'sourceLocation', valueType: 'source-location', label: str_(i18n.UIStrings.columnSource)},
{key: 'description', valueType: 'code', label: str_(i18n.UIStrings.columnDescription)},
/* eslint-enable max-len */
];

const details = Audit.makeTableDetails(headings, tableRows);
Expand Down
4 changes: 2 additions & 2 deletions core/audits/font-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ class FontDisplay extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'wastedMs', itemType: 'ms', text: str_(i18n.UIStrings.columnWastedMs)},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'wastedMs', valueType: 'ms', label: str_(i18n.UIStrings.columnWastedMs)},
];

const details = Audit.makeTableDetails(headings, results);
Expand Down
8 changes: 4 additions & 4 deletions core/audits/image-aspect-ratio.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ class ImageAspectRatio extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: ''},
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'displayedAspectRatio', itemType: 'text', text: str_(UIStrings.columnDisplayed)},
{key: 'actualAspectRatio', itemType: 'text', text: str_(UIStrings.columnActual)},
{key: 'node', valueType: 'node', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'displayedAspectRatio', valueType: 'text', label: str_(UIStrings.columnDisplayed)},
{key: 'actualAspectRatio', valueType: 'text', label: str_(UIStrings.columnActual)},
];

return {
Expand Down
10 changes: 5 additions & 5 deletions core/audits/image-size-responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,11 @@ class ImageSizeResponsive extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: ''},
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'displayedSize', itemType: 'text', text: str_(UIStrings.columnDisplayed)},
{key: 'actualSize', itemType: 'text', text: str_(UIStrings.columnActual)},
{key: 'expectedSize', itemType: 'text', text: str_(UIStrings.columnExpected)},
{key: 'node', valueType: 'node', label: ''},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'displayedSize', valueType: 'text', label: str_(UIStrings.columnDisplayed)},
{key: 'actualSize', valueType: 'text', label: str_(UIStrings.columnActual)},
{key: 'expectedSize', valueType: 'text', label: str_(UIStrings.columnExpected)},
];

const finalResults = sortResultsBySizeDelta(deduplicateResultsByUrl(results));
Expand Down
2 changes: 1 addition & 1 deletion core/audits/installable-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class InstallableManifest extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'reason', itemType: 'text', text: str_(UIStrings.columnValue)},
{key: 'reason', valueType: 'text', label: str_(UIStrings.columnValue)},
];

// Errors for report table.
Expand Down
4 changes: 2 additions & 2 deletions core/audits/is-on-https.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class HTTPS extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'url', itemType: 'url', text: str_(UIStrings.columnInsecureURL)},
{key: 'resolution', itemType: 'text', text: str_(UIStrings.columnResolution)},
{key: 'url', valueType: 'url', label: str_(UIStrings.columnInsecureURL)},
{key: 'resolution', valueType: 'text', label: str_(UIStrings.columnResolution)},
];

for (const details of artifacts.InspectorIssues.mixedContentIssue) {
Expand Down
2 changes: 1 addition & 1 deletion core/audits/largest-contentful-paint-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LargestContentfulPaintElement extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: str_(i18n.UIStrings.columnElement)},
{key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnElement)},
];

const details = Audit.makeTableDetails(headings, lcpElementDetails);
Expand Down
6 changes: 3 additions & 3 deletions core/audits/layout-shift-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class LayoutShiftElements extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: str_(i18n.UIStrings.columnElement)},
{key: 'score', itemType: 'numeric',
granularity: 0.001, text: str_(UIStrings.columnContribution)},
{key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnElement)},
{key: 'score', valueType: 'numeric',
granularity: 0.001, label: str_(UIStrings.columnContribution)},
];

const details = Audit.makeTableDetails(headings, clsElementData);
Expand Down
2 changes: 1 addition & 1 deletion core/audits/lcp-lazy-loaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class LargestContentfulPaintLazyLoaded extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'node', itemType: 'node', text: str_(i18n.UIStrings.columnElement)},
{key: 'node', valueType: 'node', label: str_(i18n.UIStrings.columnElement)},
];

const details = Audit.makeTableDetails(headings, [
Expand Down
6 changes: 3 additions & 3 deletions core/audits/long-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ class LongTasks extends Audit {
/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
/* eslint-disable max-len */
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
{key: 'startTime', itemType: 'ms', granularity: 1, text: str_(i18n.UIStrings.columnStartTime)},
{key: 'duration', itemType: 'ms', granularity: 1, text: str_(i18n.UIStrings.columnDuration)},
{key: 'url', valueType: 'url', label: str_(i18n.UIStrings.columnURL)},
{key: 'startTime', valueType: 'ms', granularity: 1, label: str_(i18n.UIStrings.columnStartTime)},
{key: 'duration', valueType: 'ms', granularity: 1, label: str_(i18n.UIStrings.columnDuration)},
/* eslint-enable max-len */
];

Expand Down
4 changes: 2 additions & 2 deletions core/audits/main-thread-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class MainThreadTasks extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'startTime', itemType: 'ms', granularity: 1, text: 'Start Time'},
{key: 'duration', itemType: 'ms', granularity: 1, text: 'End Time'},
{key: 'startTime', valueType: 'ms', granularity: 1, label: 'Start Time'},
{key: 'duration', valueType: 'ms', granularity: 1, label: 'End Time'},
];

const tableDetails = Audit.makeTableDetails(headings, results);
Expand Down
6 changes: 4 additions & 2 deletions core/audits/mainthread-work-breakdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ class MainThreadWorkBreakdown extends Audit {

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'groupLabel', itemType: 'text', text: str_(UIStrings.columnCategory)},
{key: 'duration', itemType: 'ms', granularity: 1, text: str_(i18n.UIStrings.columnTimeSpent)},
/* eslint-disable max-len */
{key: 'groupLabel', valueType: 'text', label: str_(UIStrings.columnCategory)},
{key: 'duration', valueType: 'ms', granularity: 1, label: str_(i18n.UIStrings.columnTimeSpent)},
/* eslint-enable max-len */
];

results.sort((a, b) => categoryTotals[b.group] - categoryTotals[a.group]);
Expand Down
Loading