Merge pull request #2574 from mabashian/2253-pendo-checkbox

Only show pendo checkbox on in license form if license is missing
This commit is contained in:
Michael Abashian
2018-07-19 16:43:24 -04:00
committed by GitHub
2 changed files with 31 additions and 44 deletions

View File

@@ -9,9 +9,9 @@ import {N_} from "../i18n";
export default export default
['Wait', '$state', '$scope', '$rootScope', ['Wait', '$state', '$scope', '$rootScope',
'ProcessErrors', 'CheckLicense', 'moment','$window', 'ProcessErrors', 'CheckLicense', 'moment','$window',
'ConfigService', 'FeaturesService', 'pendoService', 'i18n', 'config', 'Rest', 'GetBasePath', 'ConfigService', 'FeaturesService', 'pendoService', 'i18n', 'config',
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment, function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment,
$window, ConfigService, FeaturesService, pendoService, i18n, config, Rest, GetBasePath) { $window, ConfigService, FeaturesService, pendoService, i18n, config) {
const calcDaysRemaining = function(seconds) { const calcDaysRemaining = function(seconds) {
// calculate the number of days remaining on the license // calculate the number of days remaining on the license
@@ -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>