Only show pendo checkbox on in license form if license is missing

This commit is contained in:
mabashian
2018-07-17 19:31:20 -04:00
parent 5c7c441b47
commit e82d4e9664
2 changed files with 29 additions and 42 deletions

View File

@@ -53,21 +53,9 @@ export default
$scope.time.expiresOn = calcExpiresOn($scope.license.license_info.license_date); $scope.time.expiresOn = calcExpiresOn($scope.license.license_info.license_date);
$scope.valid = CheckLicense.valid($scope.license.license_info); $scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.compliant = $scope.license.license_info.compliant; $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); init(config);
@@ -113,34 +101,33 @@ export default
.then(() => { .then(() => {
reset(); reset();
ConfigService.delete(); ConfigService.delete();
ConfigService.getConfig() ConfigService.getConfig()
.then(function(config) { .then(function(config) {
delete($rootScope.features); delete($rootScope.features);
FeaturesService.get(); FeaturesService.get();
if ($scope.newLicense.pendo) { if ($rootScope.licenseMissing === true) {
pendoService.updatePendoTrackingState('detailed'); if ($scope.newLicense.pendo) {
pendoService.issuePendoIdentity(); pendoService.updatePendoTrackingState('detailed');
} else { pendoService.issuePendoIdentity();
pendoService.updatePendoTrackingState('off'); } else {
} pendoService.updatePendoTrackingState('off');
}
if ($rootScope.licenseMissing === true) { $state.go('dashboard', {
$state.go('dashboard', { licenseMissing: false
licenseMissing: false });
} else {
init(config);
$scope.success = true;
$rootScope.licenseMissing = false;
// for animation purposes
const successTimeout = setTimeout(function() {
$scope.success = false;
clearTimeout(successTimeout);
}, 4000);
}
}); });
} else {
init(config);
$scope.success = true;
$rootScope.licenseMissing = false;
// for animation purposes
const successTimeout = setTimeout(function() {
$scope.success = false;
clearTimeout(successTimeout);
}, 4000);
}
}); });
});
}; };
}]; }];

View File

@@ -122,7 +122,7 @@
</label> </label>
</div> </div>
</div> </div>
<div class="form-group License-detailsGroup License-detailsGroup--withSeparator"> <div class="form-group License-detailsGroup License-detailsGroup--withSeparator" ng-if="licenseMissing">
<div class="checkbox"> <div class="checkbox">
<label class="License-details--label"> <label class="License-details--label">
<input type="checkbox" ng-model="newLicense.pendo" ng-disabled="!user_is_superuser" required> <input type="checkbox" ng-model="newLicense.pendo" ng-disabled="!user_is_superuser" required>