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

Extension: add report error button #944

Merged
merged 6 commits into from
Nov 16, 2016
Merged

Extension: add report error button #944

merged 6 commits into from
Nov 16, 2016

Conversation

olingern
Copy link
Contributor

@olingern olingern commented Nov 15, 2016

fixes #919

@googlebot
Copy link

CLAs look good, thanks!

@brendankenny
Copy link
Member

Thanks for the PR!

I'll take a closer look at it shortly, but just as a quick drive by comment on the screenshot in #919, we'll definitely want the plugin and Chrome versions included in the bug report body.

Looks like you may have to parse the UA string to get the Chrome version (unless there's an extension API I'm missing), and you may need to pipe in the extension version through the background page.

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.

In addition to the version numbers, we probably want the full error stack as well. Many of the error messages we give won't be enough to diagnose the problem the user is seeing


const base = 'https://github.com/googlechrome/lighthouse/issues/new?';
const title = 'title=Lighthouse%20Extension%20Error';
const body = '&body=Error:%20' + message;
Copy link
Member

Choose a reason for hiding this comment

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

the two cases handled by if statements above (devtools open and multiple tabs) should not trigger the report error button, since they're local things the user needs to fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thank ya!

const body = '&body=Error:%20' + message;

reportErrorEl.href = base + title + body;
reportErrorEl.text = 'Report Error';
Copy link
Contributor

Choose a reason for hiding this comment

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

.text -> .textContent incase we use something other than HTMLAnchorElement in the future.

@olingern
Copy link
Contributor Author

olingern commented Nov 16, 2016

@ebidel @brendankenny
Thanks for the comments! I think everything should be there now. You can see how this looks below.

  • Plugin version ( found here )
  • Chrome version (thanks @brendankenny !)
  • Update link text property to be textContent

Updated view
screen shot 2016-11-16 at 4 21 45 am

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.

looking good. Just some small style things left from me

@@ -37,6 +37,32 @@ document.addEventListener('DOMContentLoaded', _ => {
const optionsList = document.body.querySelector('.options__list');
const okButton = document.getElementById('ok');

function getLightHouseVersion() {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we aren't always consistent with this, but lighthouse is one word, so should be getLighthouseVersion()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -37,6 +37,32 @@ document.addEventListener('DOMContentLoaded', _ => {
const optionsList = document.body.querySelector('.options__list');
const okButton = document.getElementById('ok');

function getLightHouseVersion() {
return chrome.runtime.getManifest().version;
Copy link
Member

Choose a reason for hiding this comment

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

nice find!


function buildReportErrorLink(err) {
const reportErrorEl = document.createElement('a');
reportErrorEl.className = 'button button--report-error';
Copy link
Member

Choose a reason for hiding this comment

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

I have @robdodson in my head saying "just use a button" here. Should this be just a button? Alternatively we could make the link more link-like.

I don't want to bikeshed here too much, we can always change it up later if we don't get it exactly right at first. @ebidel for a quick opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A button would be consistent with the existing HTML buttons, but would have a few small hoops to jump through, i.e. storing the link on a data-issue-link attribute and binding an onclick function to the button. Nothing too crazy, but a link was easiest 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

in general buttons are for actions and links are for navigation. Not sure what the intent of this control is but happy to take a look in-person if that's any help

Copy link
Member

Choose a reason for hiding this comment

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

yeah, my point was more styling. It's a link acting like a link, but somewhat styled like a button :)

However, it works and we've talked about reworking the popup as it keeps getting more crowded anyways, so we can address this at that point if need be. I'd like to get this landed now to help users out.


let qsBody = '**Lighthouse Version**: ' + getLightHouseVersion() + '\n';
qsBody += '**Chrome Version**: ' + getChromeVersion() + '\n';
qsBody += '**Stack Trace**:\n' + err.stack;
Copy link
Member

Choose a reason for hiding this comment

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

nit: possible to surround the stack with `````s to turn it into a code block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call and done. After placing it in a code block, I noticed the original error wasn't in the stack trace, so I also added that.

@ebidel
Copy link
Contributor

ebidel commented Nov 16, 2016

Think a link is fine because it's action is a URL taking you to a webpage.

On Wed, Nov 16, 2016, 1:17 AM Nick Olinger notifications@github.com wrote:

@olingern commented on this pull request.

In lighthouse-extension/app/src/popup.js
#944:

@@ -37,6 +37,32 @@ document.addEventListener('DOMContentLoaded', _ => {
const optionsList = document.body.querySelector('.options__list');
const okButton = document.getElementById('ok');

  • function getLightHouseVersion() {
  • return chrome.runtime.getManifest().version;
  • }
  • function getChromeVersion() {
  • return /Chrome/([0-9.]+)/.exec(navigator.userAgent)[1];
  • }
  • function buildReportErrorLink(err) {
  • const reportErrorEl = document.createElement('a');
  • reportErrorEl.className = 'button button--report-error';

A button would be consistent with the existing HTML buttons, but would
have a few small hoops to jump through, i.e. storing the link on a
data-issue-link attribute and binding an onclick function to the button.
Nothing too crazy, but a link was easiest 😄


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#944, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOigFSIJd1FPgoa84NO8xYZJIIymhTGks5q-sodgaJpZM4Kyc8C
.

@@ -51,7 +51,8 @@ document.addEventListener('DOMContentLoaded', _ => {

let qsBody = '**Lighthouse Version**: ' + getLightHouseVersion() + '\n';
qsBody += '**Chrome Version**: ' + getChromeVersion() + '\n';
qsBody += '**Stack Trace**:\n' + err.stack;
qsBody += '**Error Message**: ' + err.message + '\n';
qsBody += '**Stack Trace**:\n ```' + err.stack + '```';
Copy link
Contributor

Choose a reason for hiding this comment

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

The URL the user was running LH against would also be helpful to add to the bug report.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that, but is thought it could be considered invasive. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we could have a placeholder for them to fill in?

**URL:\n**: <Enter the URL that caused this error>

Copy link
Member

Choose a reason for hiding this comment

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

yeah, it could be invasive. Most of the extension issues we've seen with an actual caught error (as opposed to something more subtle, like -1 in FMP) have been tracked down without the URL. We can add the optional prompt for it later if we find ourselves asking for it more often than not

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.

🐛➡️📜 looks great. Thanks for this!

@brendankenny brendankenny merged commit b118119 into GoogleChrome:master Nov 16, 2016
@paulirish
Copy link
Member

just came across this. Awesome work here @olingern!

@olingern
Copy link
Contributor Author

Thanks, @paulirish. You guys have an awesome initiative and it's a fun project to contribute to!

andrewrota pushed a commit to andrewrota/lighthouse that referenced this pull request Jan 13, 2017
* Includes error message, stack trace, chrome and lighthouse versions in issue body
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.

Report bug from extension popup
6 participants