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

View File

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

View File

@@ -44,7 +44,7 @@
<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">
{{time.remaining}} Days {{time.remaining}}
</div> </div>
</div> </div>
<div class="License-field"> <div class="License-field">