Merge pull request #2375 from jaredevantabor/license-validity

updating license page for license that exists, but is not valid
This commit is contained in:
Jared Tabor 2016-06-13 16:20:38 -07:00 committed by GitHub
commit 4743723ec0
3 changed files with 12 additions and 19 deletions

View File

@ -29,24 +29,16 @@ export default
msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status});
});
},
valid: function(license) {
if (!license.valid_key){
return false;
}
else if (license.free_instances <= 0){
return false;
}
// notify if less than 15 days remaining
else if (license.time_remaining / 1000 / 60 / 60 / 24 > 15){
return false;
}
return true;
},
test: function(event){
var //deferred = $q.defer(),
license = this.get();
var license = this.get();
if(license === null || !$rootScope.license_tested){
if(this.valid(license) === false) {
$rootScope.licenseMissing = true;
@ -54,11 +46,9 @@ export default
event.preventDefault();
}
$state.go('license');
// deferred.reject();
}
else {
$rootScope.licenseMissing = false;
// deferred.resolve();
}
}
else if(this.valid(license) === false) {
@ -67,13 +57,11 @@ export default
if(event){
event.preventDefault();
}
// deferred.reject(license);
}
else {
$rootScope.licenseMissing = false;
// deferred.resolve(license);
}
return;// deferred.promise;
return;
}
};

View File

@ -75,6 +75,9 @@ export default
// calculate the number of days remaining on the license
var duration = moment.duration(seconds, 'seconds').asDays();
duration = Math.floor(duration);
if(duration < 0 ){
duration = 0;
}
duration = (duration!==1) ? `${duration} Days` : `${duration} Day`;
return duration;
};
@ -97,6 +100,7 @@ export default
$scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
$scope.time.expiresOn = calcExpiresOn($scope.time.remaining);
$scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.compliant = $scope.license.license_info.compliant;
Wait('stop');
});
};

View File

@ -7,8 +7,8 @@
<div class="License-field">
<div class="License-field--label">License</div>
<div class="License-field--content">
<span ng-show='valid'><i class="fa fa-circle License-greenText"></i>Valid</span>
<span ng-show='invalid'><i class="fa fa-circle License-redText"></i>Invalid</span>
<span class="License-greenText" ng-show='compliant'><i class="fa fa-circle License-greenText"></i>Valid License</span>
<span class="License-redText" ng-show='!compliant'><i class="fa fa-circle License-redText"></i>Invalid License</span>
</div>
</div>
<div class="License-field">
@ -43,7 +43,8 @@
</div>
<div class="License-field">
<div class="License-field--label">Time Remaining</div>
<div class="License-field--content">
<div class="License-field--content"
ng-class="{'License-redText': time.remaining=='0 Days'}">
{{time.remaining}}
</div>
</div>