Skip to content

Commit

Permalink
report(devtools): enable report features (#9157)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored and paulirish committed Jun 12, 2019
1 parent 7bcd1b4 commit d18ad42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/build-dt-report-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ writeFile('templates.html', htmlReportAssets.REPORT_TEMPLATES);

const pathToReportAssets = require.resolve('../clients/devtools-report-assets.js');
browserify(generatorFilename, {standalone: 'Lighthouse.ReportGenerator'})
// Shims './html/html-report-assets' to resolve to devtools-report-assets.
.require(pathToReportAssets, {expose: './html/html-report-assets'})
// Shims './html/html-report-assets.js' to resolve to devtools-report-assets.js
.require(pathToReportAssets, {expose: './html/html-report-assets.js'})
.bundle((err, src) => {
if (err) throw err;
fs.writeFileSync(bundleOutFile, src.toString());
Expand Down
8 changes: 6 additions & 2 deletions lighthouse-core/report/html/renderer/report-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,12 @@ class ReportUIFeatures {
case 'print-summary':
this.collapseAllDetails();
this.closeToolsDropdown();
self.print();
this._print();
break;
case 'print-expanded':
this.expandAllDetails();
this.closeToolsDropdown();
self.print();
this._print();
break;
case 'save-json': {
const jsonStr = JSON.stringify(this.json, null, 2);
Expand Down Expand Up @@ -462,6 +462,10 @@ class ReportUIFeatures {
this._document.removeEventListener('keydown', this.onKeyDown);
}

_print() {
self.print();
}

/**
* Keydown handler for the document.
* @param {KeyboardEvent} e
Expand Down
9 changes: 0 additions & 9 deletions lighthouse-core/report/html/templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,6 @@
font: inherit;
outline: inherit;
}
/*
Some features in the tools dropdown menu don't work in the DevTools
client. They could with some tweaks, but currently they don't. For example:
Saving as HTML/JSON - does not bring up a file dialog, as one would expect in DevTools.
also, it saves the AuditsPanel HTML, which is funky.
*/
.lh-devtools .lh-tools__button {
display: none;
}
.lh-tools__button svg {
fill: var(--lh-tools-icon-color);
}
Expand Down

0 comments on commit d18ad42

Please sign in to comment.