updating license page for license that exists, but is not valid

This commit is contained in:
Jared Tabor
2016-06-13 14:05:12 -07:00
parent 850455efe0
commit a5634b24a7
3 changed files with 12 additions and 19 deletions

View File

@@ -34,19 +34,11 @@ export default
if (!license.valid_key){ if (!license.valid_key){
return false; 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; return true;
}, },
test: function(event){ test: function(event){
var //deferred = $q.defer(), var license = this.get();
license = this.get();
if(license === null || !$rootScope.license_tested){ if(license === null || !$rootScope.license_tested){
if(this.valid(license) === false) { if(this.valid(license) === false) {
$rootScope.licenseMissing = true; $rootScope.licenseMissing = true;
@@ -54,11 +46,9 @@ export default
event.preventDefault(); event.preventDefault();
} }
$state.go('license'); $state.go('license');
// deferred.reject();
} }
else { else {
$rootScope.licenseMissing = false; $rootScope.licenseMissing = false;
// deferred.resolve();
} }
} }
else if(this.valid(license) === false) { else if(this.valid(license) === false) {
@@ -67,13 +57,11 @@ export default
if(event){ if(event){
event.preventDefault(); event.preventDefault();
} }
// deferred.reject(license);
} }
else { else {
$rootScope.licenseMissing = false; $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 // calculate the number of days remaining on the license
var duration = moment.duration(seconds, 'seconds').asDays(); var duration = moment.duration(seconds, 'seconds').asDays();
duration = Math.floor(duration); duration = Math.floor(duration);
if(duration < 0 ){
duration = 0;
}
duration = (duration!==1) ? `${duration} Days` : `${duration} Day`; duration = (duration!==1) ? `${duration} Days` : `${duration} Day`;
return duration; return duration;
}; };
@@ -97,6 +100,7 @@ export default
$scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining); $scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
$scope.time.expiresOn = calcExpiresOn($scope.time.remaining); $scope.time.expiresOn = calcExpiresOn($scope.time.remaining);
$scope.valid = CheckLicense.valid($scope.license.license_info); $scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.compliant = $scope.license.license_info.compliant;
Wait('stop'); Wait('stop');
}); });
}; };

View File

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