mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
posting license after user posts license
then reissue pendo identity
This commit is contained in:
@@ -25,9 +25,11 @@ export default
|
|||||||
|
|
||||||
.factory('CheckLicense', ['$rootScope', '$compile', 'CreateDialog', 'Store',
|
.factory('CheckLicense', ['$rootScope', '$compile', 'CreateDialog', 'Store',
|
||||||
'LicenseUpdateForm', 'GenerateForm', 'TextareaResize', 'ToJSON', 'GetBasePath',
|
'LicenseUpdateForm', 'GenerateForm', 'TextareaResize', 'ToJSON', 'GetBasePath',
|
||||||
'Rest', 'ProcessErrors', 'Alert', 'IsAdmin', '$location',
|
'Rest', 'ProcessErrors', 'Alert', 'IsAdmin', '$location', 'pendoService',
|
||||||
|
'Authorization', 'Wait',
|
||||||
function($rootScope, $compile, CreateDialog, Store, LicenseUpdateForm, GenerateForm,
|
function($rootScope, $compile, CreateDialog, Store, LicenseUpdateForm, GenerateForm,
|
||||||
TextareaResize, ToJSON, GetBasePath, Rest, ProcessErrors, Alert, IsAdmin, $location) {
|
TextareaResize, ToJSON, GetBasePath, Rest, ProcessErrors, Alert, IsAdmin, $location,
|
||||||
|
pendoService, Authorization, Wait) {
|
||||||
return {
|
return {
|
||||||
getRemainingDays: function(time_remaining) {
|
getRemainingDays: function(time_remaining) {
|
||||||
// assumes time_remaining will be in seconds
|
// assumes time_remaining will be in seconds
|
||||||
@@ -164,21 +166,32 @@ export default
|
|||||||
if (typeof json_data === 'object' && Object.keys(json_data).length > 0) {
|
if (typeof json_data === 'object' && Object.keys(json_data).length > 0) {
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post(json_data)
|
Rest.post(json_data)
|
||||||
.success(function () {
|
.success(function (response) {
|
||||||
try {
|
response.license_info = response;
|
||||||
$('#license-modal-dialog').dialog('close');
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
Alert('License Accepted', 'The Ansible Tower license was updated. To review or update the license, choose View License from the Setup menu.','alert-info');
|
Alert('License Accepted', 'The Ansible Tower license was updated. To review or update the license, choose View License from the Setup menu.','alert-info');
|
||||||
$rootScope.features = undefined;
|
$rootScope.features = undefined;
|
||||||
$location.path('/home');
|
|
||||||
|
Authorization.getLicense()
|
||||||
|
.success(function (data) {
|
||||||
|
Authorization.setLicense(data);
|
||||||
|
pendoService.issuePendoIdentity();
|
||||||
|
Wait("stop");
|
||||||
|
$location.path('/home');
|
||||||
|
})
|
||||||
|
.error(function () {
|
||||||
|
Wait('stop');
|
||||||
|
Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger',
|
||||||
|
$location.path('/logout'));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.catch(function (response) {
|
||||||
scope.license_json_api_error = "A valid license key in JSON format is required";
|
scope.license_json_api_error = "A valid license key in JSON format is required";
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(scope, response.data, response.status, null, { hdr: 'Error!',
|
||||||
msg: 'Failed to update license. POST returned: ' + status
|
msg: 'Failed to update license. POST returned: ' + response.status
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user