From a5634b24a7173f13bf0fe0f7b0dee5bab8312b1b Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 13 Jun 2016 14:05:12 -0700 Subject: [PATCH] updating license page for license that exists, but is not valid --- .../src/license/checkLicense.factory.js | 20 ++++--------------- .../client/src/license/license.controller.js | 4 ++++ .../client/src/license/license.partial.html | 7 ++++--- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/awx/ui/client/src/license/checkLicense.factory.js b/awx/ui/client/src/license/checkLicense.factory.js index cd0f7fd27e..d68358cd29 100644 --- a/awx/ui/client/src/license/checkLicense.factory.js +++ b/awx/ui/client/src/license/checkLicense.factory.js @@ -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; } }; diff --git a/awx/ui/client/src/license/license.controller.js b/awx/ui/client/src/license/license.controller.js index 77a79ccc17..aac6b9446d 100644 --- a/awx/ui/client/src/license/license.controller.js +++ b/awx/ui/client/src/license/license.controller.js @@ -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'); }); }; diff --git a/awx/ui/client/src/license/license.partial.html b/awx/ui/client/src/license/license.partial.html index cb1d452a2b..0977bbc641 100644 --- a/awx/ui/client/src/license/license.partial.html +++ b/awx/ui/client/src/license/license.partial.html @@ -7,8 +7,8 @@
License
- Valid - Invalid + Valid License + Invalid License
@@ -43,7 +43,8 @@
Time Remaining
-
+
{{time.remaining}}