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;
@@ -47,27 +47,30 @@ export default
.success(function(){ .success(function(){
reset(); reset();
init(); init();
if($rootScope.licenseMissing === true){
$state.go('dashboard', {
licenseMissing: false
});
}
else{
$scope.success = true; $scope.success = true;
$rootScope.licenseMissing = false;
// for animation purposes // for animation purposes
var successTimeout = setTimeout(function(){ var successTimeout = setTimeout(function(){
$scope.success = false; $scope.success = false;
clearTimeout(successTimeout); clearTimeout(successTimeout);
}, 4000); }, 4000);
if($rootScope.licenseMissing === true){
$rootScope.licenseMissing = false;
$state.go('dashboard');
}
else{
$rootScope.licenseMissing = false;
} }
}); });
}; };
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
var duration = moment.duration(seconds, 'seconds'); var duration = moment.duration(seconds, 'seconds').days();
return duration.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
return moment().add(days, 'days').calendar(); return moment().add(days, 'days').calendar();

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">