Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3076)

Unified Diff: chrome/browser/resources/net_internals/export_view.js

Issue 2544263002: Disable save-to-file button until there is some text (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/net_internals/export_view.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/export_view.js
diff --git a/chrome/browser/resources/net_internals/export_view.js b/chrome/browser/resources/net_internals/export_view.js
index 72c5bb3cb21d67be98a51e9b7ce95241ff1ad99e..52829984922215ad954ebe4e2442f648694323da 100644
--- a/chrome/browser/resources/net_internals/export_view.js
+++ b/chrome/browser/resources/net_internals/export_view.js
@@ -29,6 +29,8 @@ var ExportView = (function() {
this.saveStatusText_ = $(ExportView.SAVE_STATUS_TEXT_ID);
this.userCommentsTextArea_ = $(ExportView.USER_COMMENTS_TEXT_AREA_ID);
+ this.enableSaveFileButton_(false);
+ this.userCommentsTextArea_.onkeyup = this.onUserCommentsUpdated_.bind(this);
// Track blob for previous log dump so it can be revoked when a new dump is
// saved.
@@ -125,10 +127,7 @@ var ExportView = (function() {
*/
createLogDump_: function(callback) {
// Get an explanation for the dump file (this is mandatory!)
- var userComments = this.getNonEmptyUserComments_();
- if (userComments == undefined) {
- return;
- }
+ var userComments = this.userCommentsTextArea_.value;
this.setSaveFileStatus('Preparing data...', true);
@@ -154,30 +153,14 @@ var ExportView = (function() {
*/
setUserComments_: function(userComments) {
this.userCommentsTextArea_.value = userComments;
+ this.onUserCommentsUpdated_();
},
/**
- * Fetches the user comments for this dump. If none were entered, warns the
- * user and returns undefined. Otherwise returns the comments text.
+ * User comments are updated.
*/
- getNonEmptyUserComments_: function() {
- var value = this.userCommentsTextArea_.value;
-
- // Reset the class name in case we had hilighted it earlier.
- this.userCommentsTextArea_.className = '';
-
- // We don't accept empty explanations. We don't care what is entered, as
- // long as there is something (a single whitespace would work).
- if (value == '') {
- // Put a big obnoxious red border around the text area.
- this.userCommentsTextArea_.className =
- 'export-view-explanation-warning';
- alert('Please fill in the text field!');
- this.userCommentsTextArea_.focus();
- return undefined;
- }
-
- return value;
+ onUserCommentsUpdated_: function() {
+ this.enableSaveFileButton_(this.userCommentsTextArea_.value != '');
},
/**
« no previous file with comments | « chrome/browser/resources/net_internals/export_view.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698