From 5ad2f3e330e025e06df52f01abc072b02be9464f Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 29 Jan 2015 21:07:12 -0500 Subject: [PATCH] Final pass of making errors nicer --- .../static/js/controllers/Authentication.js | 4 +- awx/ui/static/js/forms/SurveyMaker.js | 2 +- awx/ui/static/js/forms/SurveyQuestion.js | 50 +++++++++---------- awx/ui/static/js/helpers/JobSubmission.js | 30 +++++------ awx/ui/static/lib/ansible/form-generator.js | 32 ++++++------ awx/ui/static/partials/configure_tower.html | 2 +- awx/ui/static/partials/job_templates.html | 2 +- awx/ui/templates/ui/index.html | 6 +-- 8 files changed, 64 insertions(+), 64 deletions(-) diff --git a/awx/ui/static/js/controllers/Authentication.js b/awx/ui/static/js/controllers/Authentication.js index 793739ec03..8109981693 100644 --- a/awx/ui/static/js/controllers/Authentication.js +++ b/awx/ui/static/js/controllers/Authentication.js @@ -120,7 +120,7 @@ function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $locati "
\n" + "\n" + - "
A value is required.
\n" + + "
Please enter a username.
\n" + "
\n" + "
\n" + "\n" + @@ -129,7 +129,7 @@ function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $locati "
\n" + "\n" + - "
A value is required.
\n" + + "
Please enter a password.
\n" + "
\n" + "
\n" + "\n" + diff --git a/awx/ui/static/js/forms/SurveyMaker.js b/awx/ui/static/js/forms/SurveyMaker.js index e16f4aa655..7cf8da6aad 100644 --- a/awx/ui/static/js/forms/SurveyMaker.js +++ b/awx/ui/static/js/forms/SurveyMaker.js @@ -30,7 +30,7 @@ angular.module('SurveyMakerFormDefinition', []) // ' //
'+ // ''+ - // '
A value is required.
'+ + // '
Please enter a survey name.
'+ // '
'+ // '
'+ // '
'+ diff --git a/awx/ui/static/js/forms/SurveyQuestion.js b/awx/ui/static/js/forms/SurveyQuestion.js index 875d3ee2a5..2f39879574 100644 --- a/awx/ui/static/js/forms/SurveyQuestion.js +++ b/awx/ui/static/js/forms/SurveyQuestion.js @@ -61,9 +61,9 @@ angular.module('SurveyQuestionFormDefinition', []) 'user_id
host_name
esc or click to close
" '+ 'data-placement="right" data-container="body" data-title="Answer Variable Name" class="help-link" data-original-title="" title="" tabindex="-1"> '+ '
'+ - '
A value is required.
'+ - '
The value contains an illegal character!
'+ - '
This variable is already in use.
' + + '
Please enter an answer variable name.
'+ + '
Please remove the illegal character from the survey question variable name.
'+ + '
This question variable is already in use. Please enter a different variable name.
' + '
'+ '
', addRequired: true, @@ -104,14 +104,14 @@ angular.module('SurveyQuestionFormDefinition', []) control:'
'+ '
'+ ''+ - '
This is not a valid integer.
'+ - '
Too high!
'+ - '
Too low!
'+ + '
The minimum length you entered is not a number. Please enter a number.
'+ + '
The minimium length is too high. Please enter a lower number.
'+ + '
The minimum length is too low. Please enter a positive number.
'+ '
'+ '
'+ ''+ - '
This is not a valid integer.
'+ - '
Too low!
'+ + '
The maximum length you entered is not a number. Please enter a number.
'+ + '
The maximum length is too low. Please enter a number larger than the minimum length you set.
'+ '
'+ '
', ngShow: 'type.type==="text" ', @@ -125,14 +125,14 @@ angular.module('SurveyQuestionFormDefinition', []) control:'
'+ '
'+ ''+ - '
This is not a valid integer.
'+ - '
Too high!
'+ - '
Too low!
'+ + '
The minimum length you entered is not a number. Please enter a number.
'+ + '
The minimium length is too high. Please enter a lower number.
'+ + '
The minimum length is too low. Please enter a positive number.
'+ '
'+ '
'+ ''+ - '
This is not a valid integer.
'+ - '
Too low!
'+ + '
The maximum length you entered is not a number. Please enter a number.
'+ + '
The maximum length is too low. Please enter a number larger than the minimum length you set.
'+ '
'+ '
', ngShow: 'type.type==="textarea" ', @@ -146,13 +146,13 @@ angular.module('SurveyQuestionFormDefinition', []) control:'
'+ '
'+ ''+ - '
This is not a valid integer.
'+ - '
Too high!
'+ + '
Please enter a valid integer.
'+ + '
Please enter a smaller integer.
'+ '
'+ '
'+ ''+ - '
This is not a valid integer.
'+ - '
Too low!
'+ + '
Please enter a valid integer.
'+ + '
Please enter a larger integer.
'+ '
'+ '
', ngShow: 'type.type==="integer" ', @@ -166,13 +166,13 @@ angular.module('SurveyQuestionFormDefinition', []) control: '
'+ '
'+ ''+ - '
This is not a valid decimal number.
'+ - '
Too high!
'+ + '
Please enter a valid decimal number.
'+ + '
Please enter a smaller decimal number.
'+ '
'+ '
'+ ''+ - '
This is not a valid decimal number.
'+ - '
Too low!
'+ + '
Please enter a valid decimal number.
'+ + '
Please enter a larger decimal number.
'+ '
'+ '
', @@ -217,8 +217,8 @@ angular.module('SurveyQuestionFormDefinition', []) control: '
'+ ''+ ''+ - '
This is not a valid integer.
'+ - '
The value must be in range {{int_min}} to {{int_max}}!
'+ + '
Please enter a valid integer.
'+ + '
Please enter a value in the range of {{int_min}} to {{int_max}}.
'+ '
', column: 2, ngShow: 'type.type === "integer" ' @@ -229,8 +229,8 @@ angular.module('SurveyQuestionFormDefinition', []) control: '
'+ ''+ ''+ - '
This is not a valid decimal number.
'+ - '
The value must be in range {{float_min}} to {{float_max}}!
'+ + '
Please enter a valid decimal number.
'+ + '
Please enter a value in the range of {{float_min}} to {{float_max}}!
'+ '
', column: 2, ngShow: 'type.type=== "float" ' diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index 9d63b472de..e8e89ed40e 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -308,7 +308,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi html += " >"; // Add error messages html += "
A value is required.
\n"; + "job_launch_form." + fld + ".$error.required\">Please enter a password.
\n"; html += "
\n"; html += "
\n"; @@ -330,9 +330,9 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi html += "/>"; // Add error messages html += "
A value is required.\n"; + "job_launch_form." + fld + ".$error.required\">Please confirm the password.\n"; html += (field.awPassMatch) ? "Must match Password value
\n" : ""; + ".$error.awpassmatch\">This value does not match the password you entered previously. Please confirm that password.\n" : ""; html += "
\n"; html += "\n"; } @@ -529,9 +529,9 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi 'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+ 'class="form-control" ng-required='+question.required+'>'+ '
A value is required.
'+ + 'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.'+ '
The answer must be between {{'+minlength+'}} to {{'+maxlength+'}} characters long.
'+ + 'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.'+ '
'; } @@ -543,9 +543,9 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi 'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+ 'class="form-control final" ng-required="'+question.required+'" rows="3">'+ '
A value is required.
'+ + 'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.'+ '
The answer must be between {{'+minlength+'}} to {{'+maxlength+'}} characters long.
'+ + 'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.'+ '
'; } @@ -562,7 +562,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi ''+choices[j] +'
' ; } html+= '
A value is required.
'+ + 'job_launch_form.'+question.variable+'.$error.required\">Please select an answer.'+ '
'; html+= ''; //end survey_taker_input } @@ -587,16 +587,16 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi //surveyCheckboxes takes a list of checkboxes and connects them to one scope variable html += ''+ '{{job_launch_form.'+question.variable+'_object.$error.checkbox}}'+ - '
A value is required.
'; + '
Please select at least one answer.
'; } if(question.type === 'integer'){ min = (!Empty(question.min)) ? Number(question.min) : ""; max = (!Empty(question.max)) ? Number(question.max) : "" ; html+=''+ - '
A value is required.
'+ - '
This is not a valid integer.
'+ - '
The value must be in range {{'+min+'}} to {{'+max+'}}!
'; + '
Please enter an answer.
'+ + '
Please enter an answer that is a valid integer.
'+ + '
Please enter an answer between {{'+min+'}} and {{'+max+'}}.
'; } @@ -605,9 +605,9 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi max = (!Empty(question.max)) ? question.max : "" ; defaultValue = (!Empty(question.default)) ? question.default : (!Empty(question.default_float)) ? question.default_float : "" ; html+=''+ - '
A value is required.
'+ - '
This is not a valid decimal number.
'+ - '
The value must be in range {{'+min+'}} to {{'+max+'}}!
'; + '
Please enter an answer.
'+ + '
Please enter an answer that is a decimal number.
'+ + '
Please enter a decimal number between {{'+min+'}} and {{'+max+'}}.
'; } html+=''; if(question.index === scope.survey_questions.length-1){ diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 9790b4c220..63f396909d 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -776,11 +776,11 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) || field.awRequiredWhen) { html += "
A value is required.
\n"; + this.form.name + '_form.' + fld + ".$error.required\">Please enter a value.\n"; } if (field.type === "email") { html += "
A valid email address is required.
\n"; + this.form.name + '_form.' + fld + ".$error.email\">Please enter a valid email address.\n"; } if (field.awPassMatch) { html += "
This URL must begin with ssh, http or https and may not contain '@'.
\n"; + ".$error.awvalidurl\">Please enter a URL that begins with ssh, http or https. The URL may not contain the '@' character. \n"; } html += "
\n"; @@ -796,7 +796,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator if (field.chkPass) { // complexity error html += "
The password should be stronger (see strength bar below).
\n"; + ".$error.complexity\">Please enter a stronger password (see strength bar below).\n"; // progress bar html += "
\n"; @@ -876,7 +876,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator // Add error messages if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) { html += "
A value is required.
\n"; + this.form.name + '_form.' + fld + ".$error.required\">Please enter a value.
\n"; } html += "
\n"; html += "\n"; @@ -916,7 +916,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) || field.awRequiredWhen) { html += "
A value is required.
\n"; + this.form.name + '_form.' + fld + ".$error.required\">Please select a value.\n"; } html += "
\n"; @@ -962,15 +962,15 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator // Add error messages if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) { html += "
A value is required.
\n"; + this.form.name + '_form.' + fld + ".$error.required\">Please enter a value.\n"; } if (field.integer) { - html += "
Must be an integer value
\n"; + html += "
Please enter a number.
\n"; } if (field.min !== undefined || field.max !== undefined) { html += "
Must be an integer between " + field.min + " and "; - html += (field.max !== undefined) ? field.max : 'unlimited'; + this.form.name + '_form.' + fld + ".$error.max\">Please enter a number greater than " + field.min; + html += (field.max !== undefined) ? " and less than " + field.max + "." : "."; html += "
\n"; } html += "
\n"; @@ -995,14 +995,14 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator // Add error messages if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) { html += "
A value is required.
\n"; + this.form.name + '_form.' + fld + ".$error.required\">Please select at least one value.\n"; } if (field.integer) { - html += "
Must be an integer value
\n"; + html += "
Please select a number.
\n"; } if (field.min || field.max) { html += "
Must be in range " + field.min + " to " + + this.form.name + '_form.' + fld + ".$error.max\">Please select a number between " + field.min + " and " + field.max + "
\n"; } html += "
\n"; @@ -1066,7 +1066,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) { html += "
A value is required.
\n"; + this.form.name + '_form.' + fld + ".$error.required\">Please select a value.\n"; } html += "
\n"; @@ -1145,13 +1145,13 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator this.form.name + '_form.' + field.sourceModel + '_' + field.sourceField + ".$dirty && " + this.form.name + '_form.' + field.sourceModel + '_' + field.sourceField + - ".$error.required\">A value is required.\n"; + ".$error.required\">Please select a value.\n"; } html += "
Value not found.
\n"; + ".$error.awlookup\">That value was not found. Please enter or select a valid value.\n"; html += "
\n"; html += "\n"; diff --git a/awx/ui/static/partials/configure_tower.html b/awx/ui/static/partials/configure_tower.html index c5fab74906..ac04adad18 100644 --- a/awx/ui/static/partials/configure_tower.html +++ b/awx/ui/static/partials/configure_tower.html @@ -26,6 +26,6 @@
How many days of data would you like to keep?
-
A value is required.
+
Please enter the number of days you would like to keep this data.
\ No newline at end of file diff --git a/awx/ui/static/partials/job_templates.html b/awx/ui/static/partials/job_templates.html index 7676a7cda2..296a8ca820 100644 --- a/awx/ui/static/partials/job_templates.html +++ b/awx/ui/static/partials/job_templates.html @@ -8,7 +8,7 @@
What would you like to name the copy of job template ?
-
A value is required.
+
Please enter a name for this job template copy.
\ No newline at end of file diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 29e6259c65..ad114712f8 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -426,9 +426,9 @@
How many days of data would you like to keep?
-
A value is required.
-
This is not a valid integer.
-
This value cannot be negative!
+
Please enter the number of days you would like to keep this data.
+
Please enter a valid number.
+
Please enter a non-negative number.