diff --git a/awx/ui/static/css/ansible-ui.css b/awx/ui/static/css/ansible-ui.css
index e58a8b880e..1ca01ded47 100644
--- a/awx/ui/static/css/ansible-ui.css
+++ b/awx/ui/static/css/ansible-ui.css
@@ -78,8 +78,8 @@
}
.login-alert {
- font-weight: bold;
- font-size: 16px;
+ font-weight: normal;
+ font-size: 14px;
text-align: center;
color: #0088cc;
margin-bottom: 25px;
@@ -375,7 +375,10 @@
/* Jobs pages */
- .job-error, .job-failed,
+ .job-error,
+ .job-failed,
+ .license-expired,
+ .license-invalid,
.active-failures-true,
.active-failures-true a,
.active-failures-true a:active,
@@ -394,7 +397,8 @@
color: #da4f49;
}
- .job-event-status {
+ .job-event-status,
+ .license-status {
padding-top: 5px;
}
@@ -408,13 +412,16 @@
.job-success,
.job-successful,
.active-failures-false,
+ .license-valid,
input[type="text"].job-success,
input[type="text"].job-successful
{
color: #5bb75b;
}
- .job-changed {
+ .job-changed,
+ .license-warning,
+ .license-demo {
color: #FF9900;
}
@@ -508,7 +515,7 @@
}
#hosts-well {
- padding-top: 10px;
+ padding-top: 5px;
}
#hosts-title p {
@@ -522,6 +529,11 @@
#hosts-well .search-widget {
margin-top: 10px;
}
+
+ #hosts-well .list-actions {
+ padding-top: 10px;
+ }
+
.parse-selection {
font-size: 12px;
margin: 5px 0 8px 0;
diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js
index 4cd380d9a5..a3e668bb56 100644
--- a/awx/ui/static/js/app.js
+++ b/awx/ui/static/js/app.js
@@ -60,7 +60,9 @@ angular.module('ansible', [
'ProjectPathHelper',
'md5Helper',
'AccessHelper',
- 'SelectionHelper'
+ 'SelectionHelper',
+ 'LicenseFormDefinition',
+ 'License'
])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.
@@ -214,8 +216,8 @@ angular.module('ansible', [
otherwise({redirectTo: '/'});
}])
- .run(['$rootScope', 'CheckLicense', '$location', 'Authorization','LoadBasePaths',
- function($rootScope, CheckLicense, $location, Authorization, LoadBasePaths) {
+ .run(['$rootScope', 'CheckLicense', '$location', 'Authorization','LoadBasePaths', 'ViewLicense',
+ function($rootScope, CheckLicense, $location, Authorization, LoadBasePaths, ViewLicense) {
LoadBasePaths();
@@ -265,5 +267,10 @@ angular.module('ansible', [
$rootScope.viewCurrentUser = function() {
$location.path('/users/' + $rootScope.current_user.id);
- }
+ }
+
+ $rootScope.viewLicense = function() {
+ //$location.path('/license');
+ ViewLicense();
+ }
}]);
diff --git a/awx/ui/static/js/forms/License.js b/awx/ui/static/js/forms/License.js
new file mode 100644
index 0000000000..69f8353751
--- /dev/null
+++ b/awx/ui/static/js/forms/License.js
@@ -0,0 +1,86 @@
+/*********************************************
+ * Copyright (c) 2013 AnsibleWorks, Inc.
+ *
+ * License.js
+ * Form definition for LIcense model
+ *
+ *
+ */
+angular.module('LicenseFormDefinition', [])
+ .value(
+ 'LicenseForm', {
+
+ name: 'license',
+ well: false,
+ well: false,
+ forceListeners: true,
+ 'class': 'horizontal-narrow',
+
+ fields: {
+ license_status: {
+ label: 'Status',
+ type: 'custom',
+ control: '
\{\{ license_status \}\}
',
+ readonly: true,
+ section: 'License'
+ },
+ license_key: {
+ label: 'Key',
+ type: 'textarea',
+ section: 'License',
+ 'class': 'modal-input-xlarge',
+ readonly: true
+ },
+ license_date: {
+ label: 'Activated On',
+ type: 'text',
+ readonly: true,
+ section: 'License'
+ },
+ time_remaining: {
+ label: 'Days Left',
+ type: 'text',
+ readonly: true,
+ section: 'License'
+ },
+ available_instances: {
+ label: 'License Count',
+ type: 'text',
+ readonly: true,
+ section: 'Available Servers'
+ },
+ current_instances: {
+ label: 'Used',
+ type: 'text',
+ readonly: true,
+ section: 'Available Servers'
+ },
+ free_instances: {
+ label: 'Remaining',
+ type: 'text',
+ readonly: true,
+ section: 'Available Servers'
+ },
+ company_name: {
+ label: 'Company',
+ type: 'text',
+ readonly: true,
+ section: 'Contact Info'
+ },
+ contact_name: {
+ label: 'Contact',
+ type: 'text',
+ readonly: true,
+ section: 'Contact Info'
+ },
+ contact_email: {
+ label: 'Contact Email',
+ type: 'text',
+ readonly: true,
+ section: 'Contact Info'
+ }
+ }
+
+ }); //form
+
+
\ No newline at end of file
diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js
index 851eaf97d0..a1a225ce02 100644
--- a/awx/ui/static/lib/ansible/form-generator.js
+++ b/awx/ui/static/lib/ansible/form-generator.js
@@ -681,15 +681,26 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
}
else {
// original, single-column form
- var section = '';
+ var section = '';
+ var group = '';
for (var fld in this.form.fields) {
var field = this.form.fields[fld];
+
+ if (field.group && field.group != group) {
+ if (group !== '') {
+ html += "\n";
+ }
+ html += "\n";
+ html += "
" + field.group + "
\n";
+ group = field.group;
+ }
+
if (field.section && field.section != section) {
if (section !== '') {
html += "\n";
}
else {
- html += "";
+ html += "\n";
html += "\n";
}
var sectionShow = (this.form[field.section + 'Show']) ? " ng-show=\"" + this.form[field.section + 'Show'] + "\"" : "";
@@ -697,11 +708,15 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
html += "
\n";
section = field.section;
}
+
html += this.buildField(fld, field, options);
}
if (section !== '') {
html += "
\n
\n";
}
+ if (group !== '') {
+ html += "\n";
+ }
}
//buttons
diff --git a/awx/ui/static/lib/ansible/license.js b/awx/ui/static/lib/ansible/license.js
new file mode 100644
index 0000000000..9e2359e29a
--- /dev/null
+++ b/awx/ui/static/lib/ansible/license.js
@@ -0,0 +1,69 @@
+/*****************************************
+ * License.js
+ *
+ * View license info: /api/vi/config/
+ *
+ *****************************************/
+
+'use strict';
+
+angular.module('License', ['LicenseFormDefinition', 'RestServices', 'Utilities', 'FormGenerator'])
+ .factory('ViewLicense', ['$location', 'LicenseForm', 'GenerateForm', 'Rest', 'Alert', 'GetBasePath', 'ProcessErrors',
+ function($location, LicenseForm, GenerateForm, Rest, Alert, GetBasePath, ProcessErrors) {
+ return function() {
+
+ var defaultUrl=GetBasePath('config');
+ var generator = GenerateForm;
+ var form = LicenseForm;
+ var base = $location.path().replace(/^\//,'').split('/')[0];
+
+ // load the form
+ var scope = generator.inject(form, { mode: 'edit', modal: true, related: false});
+ generator.reset();
+ scope.formModalAction = function() {
+ $('#form-modal').modal("hide");
+ }
+ scope.formModalActionLabel = 'OK';
+ scope.formModalCancelShow = false;
+ scope.formModalInfo = false;
+ $('#form-modal .btn-success').removeClass('btn-success').addClass('btn-none');
+ $('#form-modal').addClass('skinny-modal');
+ scope.formModalHeader = 'AWX License';
+
+ // Retrieve detail record and prepopulate the form
+ Rest.setUrl(defaultUrl);
+ Rest.get()
+ .success( function(data, status, headers, config) {
+ for (var fld in form.fields) {
+ if (data['license_info'][fld]) {
+ scope[fld] = data['license_info'][fld];
+ }
+ }
+ var license = data['license_info'][fld];
+ if (license['valid_key'] !== undefined && license['valid_key'] == false) {
+ scope['license_status'] = 'Invalid';
+ scope['status_color'] = 'license-invalid';
+ }
+ else if (license['demo'] !== undefined && license['demo'] == true) {
+ scope['license_status'] = 'Demo';
+ scope['status_color'] = 'license-demo';
+ }
+ else if (license['date_warning'] !== undefined && license['date_warning'] == true) {
+ scope['license_status'] = 'Expired';
+ scope['status_color'] = 'license-expired';
+ }
+ else if (license['free_instances'] !== undefined && parseInt(license['free_instances']) <= 0) {
+ scope['license_status'] = 'No available servers';
+ scope['status_color'] = 'license-warning';
+ }
+ else {
+ scope['license_status'] = 'Valid';
+ scope['status_color'] = 'license-valid';
+ }
+ })
+ .error( function(data, status, headers, config) {
+ ProcessErrors(scope, data, status, form,
+ { hdr: 'Error!', msg: 'Failed to retrieve license. GET status: ' + status });
+ });
+ }
+ }]);
diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html
index 2e55183540..bba138d684 100644
--- a/awx/ui/templates/ui/index.html
+++ b/awx/ui/templates/ui/index.html
@@ -32,6 +32,7 @@
+
@@ -57,6 +58,7 @@
+
@@ -102,6 +104,7 @@