diff --git a/awx/ui/static/js/controllers/Authentication.js b/awx/ui/static/js/controllers/Authentication.js
index 1ff1131d55..805fe5c6a6 100644
--- a/awx/ui/static/js/controllers/Authentication.js
+++ b/awx/ui/static/js/controllers/Authentication.js
@@ -12,8 +12,16 @@
function Authenticate($window, $scope, $rootScope, $location, Authorization, ToggleClass, Alert)
{
+ var setLoginFocus = function() {
+ $('#login-username').focus();
+ };
+
// Display the login dialog
$('#login-modal').modal({ show: true, keyboard: false, backdrop: 'static' });
+ // Set focus to username field
+ $('#login-modal').on('shown.bs.modal', function() {
+ setLoginFocus();
+ });
var scope = angular.element(document.getElementById('login-modal')).scope();
@@ -58,7 +66,7 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
var token;
if (username == null || username == undefined || username == '' ||
password == null || password == undefined || password == '' ) {
- Alert('Error!', 'Please provide a username and password before attempting to login.');
+ Alert('Error!', 'Please provide a username and password before attempting to login.', 'alert-danger', setLoginFocus);
}
else {
Authorization.retrieveToken(username, password)
@@ -86,11 +94,11 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
$location.path('/organizations');
})
.error(function(data, status, headers, config) {
- Alert('Error', 'Failed to access user information. GET returned status: ' + status);
+ Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
});
})
.error( function(data, status, headers, config) {
- Alert('Error', 'Failed to access license information. GET returned status: ' + status);
+ Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
});
})
.error( function(data, status, headers, config) {
@@ -111,7 +119,7 @@ function Authenticate($window, $scope, $rootScope, $location, Authorization, Tog
msg = 'The login attempt failed with a status of: ' + status;
}
scope.reset();
- Alert(hdr, msg);
+ Alert(hdr, msg, 'alert-danger', setLoginFocus);
}
});
}
diff --git a/awx/ui/static/lib/ansible/directives.js b/awx/ui/static/lib/ansible/directives.js
index d17b4e0f0d..d99819b468 100644
--- a/awx/ui/static/lib/ansible/directives.js
+++ b/awx/ui/static/lib/ansible/directives.js
@@ -224,6 +224,10 @@ angular.module('AWDirectives', ['RestServices'])
$(document).bind('keydown', function(e) {
if (e.keyCode === 27) {
$(element).popover('destroy');
+ $('.popover').each(function(index) {
+ // remove lingering popover
. Seems to be a bug in TB3 RC1
+ $(this).remove();
+ });
}
});
}
diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js
index e548e93a5d..061fdb0999 100644
--- a/awx/ui/static/lib/ansible/form-generator.js
+++ b/awx/ui/static/lib/ansible/form-generator.js
@@ -72,15 +72,31 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
if (options.modal) {
this.scope.formHeader = (options.mode == 'add') ? form.addTitle : form.editTitle; //Default title for default modal
this.scope.formModalInfo = false //Disable info button for default modal
- $('.popover').popover('hide'); //remove any lingering pop-overs
+ $('.popover').each(function(index) {
+ // remove lingering popover
. Seems to be a bug in TB3 RC1
+ $(this).remove();
+ });
if (options.modal_selector) {
- $(options.modal_selector).removeClass('skinny-modal'); //Used in job_events to remove white space
- $(options.modal_selector).modal({ show: true, backdrop: 'static', keyboard: false });
+ $(options.modal_selector).modal({ show: true, backdrop: 'static', keyboard: true });
+ $(options.modal_selector).on('shown.bs.modal', function() {
+ $(options.modal_select + ' input:first').focus();
+ });
}
else {
- //$('#form-modal').removeClass('skinny-modal'); //Used in job_events to remove white space
- $('#form-modal').modal({ show: true, backdrop: 'static', keyboard: false });
+ $('#form-modal').modal({ show: true, backdrop: 'static', keyboard: true });
+ $('#form-modal').on('shown.bs.modal', function() {
+ $('#form-modal input:first').focus();
+ });
}
+ $(document).bind('keydown', function(e) {
+ if (e.keyCode === 27) {
+ if (options.modal_selector) {
+ $(options.modal_selector).modal('hide');
+ }
+ $('#prompt-modal').modal('hide');
+ $('#form-modal').modal('hide');
+ }
+ });
}
return this.scope;
},
diff --git a/awx/ui/static/lib/ansible/list-generator.js b/awx/ui/static/lib/ansible/list-generator.js
index 90a0d9c46f..ef17f1014a 100644
--- a/awx/ui/static/lib/ansible/list-generator.js
+++ b/awx/ui/static/lib/ansible/list-generator.js
@@ -88,8 +88,16 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
if (options.mode == 'lookup') {
// options should include {hdr: