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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lighthouse-extension/app/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,20 @@ document.addEventListener('DOMContentLoaded', _ => {
' Close the other tabs to use lighthouse.';
}

const reportErrorEl = document.createElement('a');
reportErrorEl.className = 'button button--report-error';

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!


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.

reportErrorEl.target = '_blank';

feedbackEl.textContent = message;
feedbackEl.appendChild(reportErrorEl);

stopSpinner();
background.console.error(err);
});
Expand Down
11 changes: 11 additions & 0 deletions lighthouse-extension/app/styles/lighthouse.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ body {
margin: 0 auto;
}

.button--report-error {
background: rgba(239, 83, 80, 0.81);
text-decoration: none;
padding: 3px 5px;
font-size: .8em;
text-align: center;
display: inline;
margin-left: 5px;
}

.subpage {
position: fixed;
top: 0;
Expand Down Expand Up @@ -190,6 +200,7 @@ body {
left: 16px;
width: 180px;
line-height: 1.45;
font-size: .9em;
}

/* 1. scrollbar when extension is too small */
Expand Down