Fixed license delete navigation bug

This commit is contained in:
Michael Abashian
2017-06-22 16:14:50 -04:00
parent 65b1e58d23
commit 2319c249c3
3 changed files with 20 additions and 16 deletions

View File

@@ -9,10 +9,10 @@ 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', 'ConfigService', 'FeaturesService', 'pendoService', 'i18n', 'config',
function( Wait, $state, $scope, $rootScope, function( Wait, $state, $scope, $rootScope,
ProcessErrors, CheckLicense, moment, $window, ConfigService, ProcessErrors, CheckLicense, moment, $window, ConfigService,
FeaturesService, pendoService, i18n){ FeaturesService, pendoService, i18n, config){
var calcDaysRemaining = function(seconds){ var calcDaysRemaining = function(seconds){
// calculate the number of days remaining on the license // calculate the number of days remaining on the license
@@ -38,18 +38,13 @@ export default
// license/license.partial.html compares fileName // license/license.partial.html compares fileName
$scope.fileName = N_("No file selected."); $scope.fileName = N_("No file selected.");
$scope.title = $rootScope.licenseMissing ? ("Tower " + i18n._("License")) : i18n._("License Management"); $scope.title = $rootScope.licenseMissing ? ("Tower " + i18n._("License")) : i18n._("License Management");
Wait('start'); $scope.license = config;
ConfigService.delete(); $scope.license.version = config.version.split('-')[0];
ConfigService.getConfig().then(function(config){ $scope.time = {};
$scope.license = config; $scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
$scope.license.version = config.version.split('-')[0]; $scope.time.expiresOn = calcExpiresOn($scope.license.license_info.license_date);
$scope.time = {}; $scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining); $scope.compliant = $scope.license.license_info.compliant;
$scope.time.expiresOn = calcExpiresOn($scope.license.license_info.license_date);
$scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.compliant = $scope.license.license_info.compliant;
Wait('stop');
});
}; };
init(); init();

View File

@@ -98,7 +98,7 @@
</span> </span>
</div> </div>
<form id="License-form" name="license"> <form id="License-form" name="uploadlicense">
<div class="License-subTitleText prepend-asterisk"> <translate>License File</translate></div> <div class="License-subTitleText prepend-asterisk"> <translate>License File</translate></div>
<div class="input-group License-file--container"> <div class="input-group License-file--container">
<span class="btn btn-primary" ng-click="fakeClick()" translate>Browse</span> <span class="btn btn-primary" ng-click="fakeClick()" translate>Browse</span>

View File

@@ -24,6 +24,15 @@ export default {
return CheckLicense.notify(); return CheckLicense.notify();
} }
}] }],
config: ['ConfigService', 'CheckLicense', '$rootScope',
function(ConfigService, CheckLicense, $rootScope) {
ConfigService.delete();
return ConfigService.getConfig()
.then(function(config){
$rootScope.licenseMissing = (CheckLicense.valid(config.license_info) === false) ? true : false;
return config;
});
}]
}, },
}; };