Commit 1a814c9e authored by jamiewalch's avatar jamiewalch Committed by Commit bot

Add category selector to feedback dialog.

* Add a <select> element to the dialog allowing the user to choose a category, or "other".
* Disable the OK button and hide the reset options until a category is selected.
* Clean up some duplicated code now that this dialog depends on base.js.

BUG=b/20950552

Review URL: https://codereview.chromium.org/1131153003

Cr-Commit-Position: refs/heads/master@{#329784}
parent d2447799
...@@ -497,9 +497,33 @@ ...@@ -497,9 +497,33 @@
<message desc="Title for the dialog prompting the user to consent to their email address being included as part of their feedback." name="IDS_FEEDBACK_CONSENT_TITLE"> <message desc="Title for the dialog prompting the user to consent to their email address being included as part of their feedback." name="IDS_FEEDBACK_CONSENT_TITLE">
Report an issue Report an issue
</message> </message>
<message desc="Text asking the user for consent to their email address being included as part of their feedback." name="IDS_FEEDBACK_CONSENT"> <message desc="Text asking the user for consent to their email address being included as part of their feedback." name="IDS_FEEDBACK_CONSENT_EMAIL">
To allow us to contact you for further information, your email address will be included in any feedback you submit. To allow us to contact you for further information, your email address will be included in any feedback you submit.
</message> </message>
<message desc="Text asking the user to choose a category for their feedback." name="IDS_FEEDBACK_CATEGORY_INSTRUCTIONS">
To help us solve your problem, please tell us what went wrong:
</message>
<message desc="The initial 'category', indicating that the user must select something to continue." name="IDS_FEEDBACK_CATEGORY_SELECT">
Select…
</message>
<message desc="Category indicating that the user is having problems launching the application." name="IDS_FEEDBACK_CATEGORY_APP_LAUNCH">
I can't open the application.
</message>
<message desc="Category indicating that the application is running too slowly." name="IDS_FEEDBACK_CATEGORY_APP_PERFORMANCE">
The application is too slow.
</message>
<message desc="Category indicating that the user is having keyboard or mouse issues." name="IDS_FEEDBACK_CATEGORY_INPUT">
I'm having problems with my keyboard or mouse.
</message>
<message desc="Category indicating that the user is having problems with Google Drive not uploading their files." name="IDS_FEEDBACK_CATEGORY_DRIVE_UPLOAD">
I can't see my saved files on-line in Google Drive.
</message>
<message desc="Category indicating that the user is having problems with Google Drive not downloading their files." name="IDS_FEEDBACK_CATEGORY_DRIVE_DOWNLOAD">
I can't open my Google Drive files.
</message>
<message desc="Category indicating that the user is having a problem not covered by any of the common categories." name="IDS_FEEDBACK_CATEGORY_OTHER">
Something else.
</message>
<message desc="Title for the submenu item containing a list of windows opened by the remote app." name="IDS_WINDOWS_SUBMENU_TITLE"> <message desc="Title for the submenu item containing a list of windows opened by the remote app." name="IDS_WINDOWS_SUBMENU_TITLE">
Windows Windows
</message> </message>
......
...@@ -19,4 +19,8 @@ a.disabled { ...@@ -19,4 +19,8 @@ a.disabled {
.information-box > p:first-child { .information-box > p:first-child {
margin-top: 0; margin-top: 0;
}
select {
margin-top: 12px;
} }
\ No newline at end of file
...@@ -20,9 +20,19 @@ found in the LICENSE file. ...@@ -20,9 +20,19 @@ found in the LICENSE file.
</head> </head>
<body> <body>
<h2 i18n-content="FEEDBACK_CONSENT_TITLE"></h2> <h2 i18n-content="FEEDBACK_CONSENT_TITLE"></h2>
<p i18n-content="FEEDBACK_CONSENT" <p i18n-content="FEEDBACK_CONSENT_EMAIL"
class="message"></p> class="message"></p>
<div id="form-body"> <p i18n-content="FEEDBACK_CATEGORY_INSTRUCTIONS"></p>
<select id="feedback-category">
<option i18n-content="FEEDBACK_CATEGORY_SELECT"></option>
<option i18n-content="FEEDBACK_CATEGORY_APP_LAUNCH"></option>
<option i18n-content="FEEDBACK_CATEGORY_APP_PERFORMANCE"></option>
<option i18n-content="FEEDBACK_CATEGORY_INPUT"></option>
<option i18n-content="FEEDBACK_CATEGORY_DRIVE_UPLOAD"></option>
<option i18n-content="FEEDBACK_CATEGORY_DRIVE_DOWNLOAD"></option>
<option i18n-content="FEEDBACK_CATEGORY_OTHER"></option>
</select>
<div id="form-body" hidden>
<label class="checkbox-label" <label class="checkbox-label"
id="abandon-host-label"> id="abandon-host-label">
<input id="abandon-host" <input id="abandon-host"
...@@ -57,7 +67,8 @@ found in the LICENSE file. ...@@ -57,7 +67,8 @@ found in the LICENSE file.
hidden></span> hidden></span>
<button id="feedback-consent-ok" <button id="feedback-consent-ok"
i18n-content="OK" i18n-content="OK"
autofocus="autofocus"></button> autofocus="autofocus"
disabled></button>
<button id="feedback-consent-cancel" <button id="feedback-consent-cancel"
i18n-content="CANCEL"></button> i18n-content="CANCEL"></button>
</div> </div>
......
...@@ -34,6 +34,12 @@ var applicationWindow = null; ...@@ -34,6 +34,12 @@ var applicationWindow = null;
*/ */
var crashServiceReportId = ''; var crashServiceReportId = '';
/**
* @type {string} The user-selected feedback category, represented by its
* l10n tag.
*/
var selectedCategory = '';
/** /**
* @param {string} email * @param {string} email
* @param {string} realName * @param {string} realName
...@@ -59,7 +65,8 @@ function onUserInfo(email, realName) { ...@@ -59,7 +65,8 @@ function onUserInfo(email, realName) {
'&psd_hostId=' + escape(hostId) + '&psd_hostId=' + escape(hostId) +
'&psd_abandonHost=' + escape(abandonHost) + '&psd_abandonHost=' + escape(abandonHost) +
'&psd_crashServiceReportId=' + escape(crashServiceReportId) + '&psd_crashServiceReportId=' + escape(crashServiceReportId) +
'&psd_connectionStats=' + escape(connectionStats)); '&psd_connectionStats=' + escape(connectionStats) +
'&psd_category=' + escape(selectedCategory));
window.close(); window.close();
// If the VM was successfully abandoned, close the application. // If the VM was successfully abandoned, close the application.
...@@ -94,7 +101,7 @@ function showError() { ...@@ -94,7 +101,7 @@ function showError() {
abandonHost = 'failed'; abandonHost = 'failed';
crashServiceReportId = ''; crashServiceReportId = '';
formBody.hidden = true; formBody.hidden = true;
resizeWindow(); base.resizeWindowToContent(true);
} }
/** /**
...@@ -191,12 +198,20 @@ function onLearnMore(event) { ...@@ -191,12 +198,20 @@ function onLearnMore(event) {
var learnMoreInfobox = document.getElementById('privacy-info'); var learnMoreInfobox = document.getElementById('privacy-info');
learnMoreLink.hidden = true; learnMoreLink.hidden = true;
learnMoreInfobox.hidden = false; learnMoreInfobox.hidden = false;
resizeWindow(); base.resizeWindowToContent(true);
} }
function resizeWindow() { function onCategorySelect() {
var borderY = window.outerHeight - window.innerHeight; var feedbackCategory = /** @type {HTMLSelectElement} */
window.resizeTo(window.outerWidth, document.body.clientHeight + borderY); (document.getElementById('feedback-category'));
base.debug.assert(feedbackCategory.selectedOptions.length == 1);
var selectedOption = /** @type {HTMLElement} */
(feedbackCategory.selectedOptions[0]);
selectedCategory = selectedOption.getAttribute('i18n-content');
var selected = selectedCategory != 'FEEDBACK_CATEGORY_SELECT';
document.getElementById('feedback-consent-ok').disabled = !selected;
document.getElementById('form-body').hidden = !selected;
base.resizeWindowToContent(false);
} }
function onLoad() { function onLoad() {
...@@ -208,12 +223,14 @@ function onLoad() { ...@@ -208,12 +223,14 @@ function onLoad() {
var abandon = document.getElementById('abandon-host-label'); var abandon = document.getElementById('abandon-host-label');
var includeLogs = document.getElementById('include-logs-label'); var includeLogs = document.getElementById('include-logs-label');
var learnMoreLink = document.getElementById('learn-more'); var learnMoreLink = document.getElementById('learn-more');
var feedbackCategory = document.getElementById('feedback-category');
ok.addEventListener('click', onOk, false); ok.addEventListener('click', onOk, false);
cancel.addEventListener('click', onCancel, false); cancel.addEventListener('click', onCancel, false);
abandon.addEventListener('click', onToggleAbandon, false); abandon.addEventListener('click', onToggleAbandon, false);
includeLogs.addEventListener('click', onToggleLogs, false); includeLogs.addEventListener('click', onToggleLogs, false);
learnMoreLink.addEventListener('click', onLearnMore, false); learnMoreLink.addEventListener('click', onLearnMore, false);
resizeWindow(); feedbackCategory.addEventListener('change', onCategorySelect, false);
base.resizeWindowToContent(true);
} }
/** @param {Event} event */ /** @param {Event} event */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment