mirror of
https://github.com/ansible/awx.git
synced 2026-05-21 15:57:52 -02:30
Finixhed applying jsHint linting to js files. Created initial Gruntfile.js build script and package.json script for keeping track of required node modules.
This commit is contained in:
@@ -7,52 +7,51 @@
|
||||
* duration set in config.js
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
angular.module('TimerService', ['ngCookies', 'Utilities'])
|
||||
.factory('Timer', ['$rootScope', '$cookieStore', '$location', 'GetBasePath', 'Empty',
|
||||
function($rootScope, $cookieStore, $location, GetBasePath, Empty) {
|
||||
return {
|
||||
.factory('Timer', ['$rootScope', '$cookieStore', '$location', 'GetBasePath', 'Empty',
|
||||
function ($rootScope, $cookieStore) {
|
||||
return {
|
||||
|
||||
sessionTime: null,
|
||||
timeout: null,
|
||||
|
||||
getSessionTime: function() {
|
||||
return (this.sessionTime) ? this.sessionTime : $cookieStore.get('sessionTime');
|
||||
},
|
||||
sessionTime: null,
|
||||
timeout: null,
|
||||
|
||||
isExpired: function() {
|
||||
var stime = this.getSessionTime();
|
||||
var now = new Date().getTime();
|
||||
if ((stime - now) <= 0) {
|
||||
//expired
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// not expired. move timer forward.
|
||||
this.moveForward();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
expireSession: function() {
|
||||
this.sessionTime = 0;
|
||||
$rootScope.sessionExpired = true;
|
||||
$cookieStore.put('sessionExpired', true);
|
||||
},
|
||||
getSessionTime: function () {
|
||||
return (this.sessionTime) ? this.sessionTime : $cookieStore.get('sessionTime');
|
||||
},
|
||||
|
||||
moveForward: function() {
|
||||
var t = new Date().getTime() + ($AnsibleConfig.session_timeout * 1000);
|
||||
this.sessionTime = t;
|
||||
$cookieStore.put('sessionTime', t);
|
||||
$rootScope.sessionExpired = false;
|
||||
$cookieStore.put('sessionExpired', false);
|
||||
},
|
||||
isExpired: function () {
|
||||
var stime = this.getSessionTime(),
|
||||
now = new Date().getTime();
|
||||
if ((stime - now) <= 0) {
|
||||
//expired
|
||||
return true;
|
||||
} else {
|
||||
// not expired. move timer forward.
|
||||
this.moveForward();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
init: function() {
|
||||
this.moveForward();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
expireSession: function () {
|
||||
this.sessionTime = 0;
|
||||
$rootScope.sessionExpired = true;
|
||||
$cookieStore.put('sessionExpired', true);
|
||||
},
|
||||
|
||||
moveForward: function () {
|
||||
var t = new Date().getTime() + ($AnsibleConfig.session_timeout * 1000);
|
||||
this.sessionTime = t;
|
||||
$cookieStore.put('sessionTime', t);
|
||||
$rootScope.sessionExpired = false;
|
||||
$cookieStore.put('sessionExpired', false);
|
||||
},
|
||||
|
||||
init: function () {
|
||||
this.moveForward();
|
||||
return this;
|
||||
}
|
||||
};
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user