diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 22de6ed5b7..22e3455789 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -446,8 +446,11 @@ angular.module('ansible', [ }; $rootScope.viewLicense = function () { - //$location.path('/license'); ViewLicense(); }; + $rootScope.toggleTab = function(e, tab, tabs) { + e.preventDefault(); + $('#' + tabs + ' #' + tab).tab('show'); + }; } ]); \ No newline at end of file diff --git a/awx/ui/static/js/controllers/Authentication.js b/awx/ui/static/js/controllers/Authentication.js index 2ee4bd7f6b..b57a7e55c6 100644 --- a/awx/ui/static/js/controllers/Authentication.js +++ b/awx/ui/static/js/controllers/Authentication.js @@ -104,7 +104,7 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth $rootScope.user_is_superuser = data.results[0].is_superuser; Authorization.getLicense() .success(function (data) { - Authorization.setLicense(data.license_info); + Authorization.setLicense(data); if (lastPath()) { // Go back to most recent navigation path $location.path(lastPath()); @@ -114,12 +114,12 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth }) .error(function () { Wait('stop'); - Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus); + Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', setLoginFocus); }); }) .error(function (data, status) { Wait('stop'); - Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', setLoginFocus); + Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus); }); }) .error(function (data, status) { diff --git a/awx/ui/static/js/forms/LicenseForm.js b/awx/ui/static/js/forms/LicenseForm.js index cc0b3e6822..bfadbd41cf 100644 --- a/awx/ui/static/js/forms/LicenseForm.js +++ b/awx/ui/static/js/forms/LicenseForm.js @@ -13,7 +13,17 @@ angular.module('LicenseFormDefinition', []) name: 'license', well: false, - forceListeners: true, + + tabs: [{ + name: 'license', + label: 'License' + }, { + name: 'managed', + label: 'Managed Hosts' + },{ + name: 'contact', + label: 'Contact Info' + }], fields: { license_status: { @@ -21,64 +31,64 @@ angular.module('LicenseFormDefinition', []) control: "
To purchase a license or extend an existing license ' + 'visit the Ansible online store, ' + 'or visit support.ansible.com for assistance.
'; @@ -62,9 +62,9 @@ angular.module('AccessHelper', ['RestServices', 'Utilities', 'ngCookies']) if (license && !Authorization.licenseTested()) { // This is our first time evaluating the license license.tested = true; - $cookieStore.remove('license'); - $cookieStore.put('license', license); + Store('license',license); //update with tested flag $rootScope.license_tested = true; + $rootScope.version = license.version; if (license.valid_key !== undefined && license.valid_key === false) { // The license is invalid. Stop the user from logging in. status = 'alert-danger'; diff --git a/awx/ui/static/less/ansible-ui.less b/awx/ui/static/less/ansible-ui.less index 99df23631d..aab902398f 100644 --- a/awx/ui/static/less/ansible-ui.less +++ b/awx/ui/static/less/ansible-ui.less @@ -185,6 +185,11 @@ textarea { font-size: 16px; } +.license-version { + font-size: 18px; + color: @grey-txt; +} + .modal-dialog .ui-accordion .ui-accordion-content { overflow: hidden; } @@ -454,7 +459,7 @@ dd { } .copyright { - padding-top: 18px; + padding-top: 6px; font-weight: normal; text-align: center; } diff --git a/awx/ui/static/lib/ansible/AuthService.js b/awx/ui/static/lib/ansible/AuthService.js index cbf19b01da..b2522a0fac 100644 --- a/awx/ui/static/lib/ansible/AuthService.js +++ b/awx/ui/static/lib/ansible/AuthService.js @@ -11,8 +11,8 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) -.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', 'GetBasePath', - function ($http, $rootScope, $location, $cookieStore, GetBasePath) { +.factory('Authorization', ['$http', '$rootScope', '$location', '$cookieStore', 'GetBasePath', 'Store', + function ($http, $rootScope, $location, $cookieStore, GetBasePath, Store) { return { setToken: function (token, expires) { // set the session cookie @@ -63,7 +63,6 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) $cookieStore.remove('token_expires'); $cookieStore.remove('current_user'); $cookieStore.remove('lastPath'); - $cookieStore.remove('license'); $cookieStore.put('userLoggedIn', false); $cookieStore.put('sessionExpired', false); $cookieStore.remove('lastPath', '/home'); @@ -86,9 +85,11 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) }); }, - setLicense: function (license) { + setLicense: function (data) { + var license = data.license_info; + license.version = data.version; license.tested = false; - $cookieStore.put('license', license); + Store('license', license); }, licenseTested: function () { @@ -96,7 +97,9 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) if ($rootScope.license_tested !== undefined) { result = $rootScope.license_tested; } else { - license = $cookieStore.get('license'); + // User may have hit browser refresh + license = Store('license'); + $rootScope.version = license.version; if (license && license.tested !== undefined) { result = license.tested; } else { diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 7fccc482e5..62efc86a82 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -1161,7 +1161,9 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities']) if (i === 0) { html += " class=\"active\""; } - html += ">" + tab.label + "\n"; + html += ">" + tab.label + "\n"; } html += "\n"; html += "