make call to pendo setting and set check box based on that when license already exists

This commit is contained in:
John Mitchell 2018-03-13 15:41:45 -04:00
parent f8c6187007
commit c65342acc9
No known key found for this signature in database
GPG Key ID: FE6A9B5BD4EB5C94
2 changed files with 17 additions and 5 deletions

View File

@ -9,9 +9,9 @@ import {N_} from "../i18n";
export default
['Wait', '$state', '$scope', '$rootScope',
'ProcessErrors', 'CheckLicense', 'moment','$window',
'ConfigService', 'FeaturesService', 'pendoService', 'i18n', 'config',
'ConfigService', 'FeaturesService', 'pendoService', 'i18n', 'config', 'Rest', 'GetBasePath',
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment,
$window, ConfigService, FeaturesService, pendoService, i18n, config) {
$window, ConfigService, FeaturesService, pendoService, i18n, config, Rest, GetBasePath) {
const calcDaysRemaining = function(seconds) {
// calculate the number of days remaining on the license
@ -43,7 +43,7 @@ export default
if ($rootScope.licenseMissing) {
$scope.title = $rootScope.BRAND_NAME + i18n._(" License");
} else {
$scope.title = i18n._("License Management")
$scope.title = i18n._("License Management");
}
$scope.license = config;
@ -55,7 +55,19 @@ export default
$scope.compliant = $scope.license.license_info.compliant;
$scope.newLicense = {};
$scope.newLicense.pendo = true;
Rest.setUrl(`${GetBasePath('settings')}ui`);
Rest.get()
.then(({data}) => {
if (data.PENDO_TRACKING_STATE === 'off' && !$rootScope.licenseMissing) {
$scope.newLicense.pendo = false;
} else {
$scope.newLicense.pendo = true;
}
})
.catch(() => {
// default pendo tracking to true when settings is not accessible
$scope.newLicense.pendo = true;
});
};
init(config);

View File

@ -130,7 +130,7 @@
<a target="_blank"
href="http://docs.ansible.com/ansible-tower/latest/html/installandreference/user-data.html#index-0">
this Tower documentation page
</a>.
</a>. Uncheck this box to disable this feature.
</translate>
</label>
</div>