Small UX changes to License and ActStream

This commit is contained in:
Jared Tabor 2016-05-06 14:37:20 -04:00
parent 0dc4b6d805
commit c304427e5d
3 changed files with 38 additions and 30 deletions

View File

@ -233,6 +233,7 @@ var tower = angular.module('Tower', [
url: '/home',
templateUrl: urlPrefix + 'partials/home.html',
controller: Home,
params: {licenseMissing: null},
data: {
activityStream: true
},
@ -789,6 +790,10 @@ var tower = angular.module('Tower', [
if (fromState.name === 'signIn'){
CheckLicense.notify();
}
if(fromState.name === 'license' && toParams.hasOwnProperty('licenseMissing')){
$rootScope.licenseMissing = toParams.licenseMissing;
}
var list, id;
// broadcast event change if editing crud object
if ($location.$$path && $location.$$path.split("/")[3] && $location.$$path.split("/")[3] === "schedules") {

View File

@ -6,9 +6,9 @@
export default
['Wait', '$state', '$scope', '$rootScope', '$location', 'GetBasePath',
'Rest', 'ProcessErrors', 'CheckLicense', 'moment','$window',
'Rest', 'ProcessErrors', 'CheckLicense', 'moment','$window', '$filter',
function( Wait, $state, $scope, $rootScope, $location, GetBasePath, Rest,
ProcessErrors, CheckLicense, moment, $window){
ProcessErrors, CheckLicense, moment, $window, $filter){
$scope.getKey = function(event){
// Mimic HTML5 spec, show filename
$scope.fileName = event.target.files[0].name;
@ -40,33 +40,36 @@ export default
$window.open('https://www.ansible.com/license', '_blank');
};
$scope.newLicense = {};
$scope.submit = function(){
Wait('start');
CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula)
.success(function(){
reset();
init();
$scope.success = true;
// for animation purposes
var successTimeout = setTimeout(function(){
$scope.success = false;
clearTimeout(successTimeout);
}, 4000);
if($rootScope.licenseMissing === true){
$rootScope.licenseMissing = false;
$state.go('dashboard');
}
else{
$rootScope.licenseMissing = false;
}
});
};
var calcDaysRemaining = function(seconds){
// calculate the number of days remaining on the license
var duration = moment.duration(seconds, 'seconds');
return duration.days();
};
$scope.newLicense = {};
$scope.submit = function(){
Wait('start');
CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula)
.success(function(){
reset();
init();
if($rootScope.licenseMissing === true){
$state.go('dashboard', {
licenseMissing: false
});
}
else{
$scope.success = true;
$rootScope.licenseMissing = false;
// for animation purposes
var successTimeout = setTimeout(function(){
$scope.success = false;
clearTimeout(successTimeout);
}, 4000);
}
});
};
var calcDaysRemaining = function(seconds){
// calculate the number of days remaining on the license
var duration = moment.duration(seconds, 'seconds').days();
duration = (duration!==1) ? $filter('number')(duration, 0) + ' days' : $filter('number')(duration, 0) + ' day';
return duration;
};
var calcExpiresOn = function(days){
// calculate the expiration date of the license

View File

@ -44,7 +44,7 @@
<div class="License-field">
<div class="License-field--label">Time Remaining</div>
<div class="License-field--content">
{{time.remaining}} Days
{{time.remaining}}
</div>
</div>
<div class="License-field">