|
@ -10,18 +10,30 @@ angular.module('workApp', ['chart.js']) |
|
|
$scope.users={}; |
|
|
$scope.users={}; |
|
|
$scope.projects={}; |
|
|
$scope.projects={}; |
|
|
$scope.currentInclude='login.html'; |
|
|
$scope.currentInclude='login.html'; |
|
|
var refreshTime=20000; |
|
|
|
|
|
|
|
|
var refreshTime=10000;//every 10 seconds
|
|
|
|
|
|
|
|
|
|
|
|
var errorsGettingData=0; |
|
|
|
|
|
$scope.serverNotResponding = function(){ |
|
|
|
|
|
console.log("server not responding, data error"); |
|
|
|
|
|
toastr.error("server not responding"); |
|
|
|
|
|
$scope.$broadcast('scroll.refreshComplete');//refresher stop
|
|
|
|
|
|
errorsGettingData++; |
|
|
|
|
|
console.log("errorsGettingData: " + errorsGettingData); |
|
|
|
|
|
if(errorsGettingData>3) |
|
|
|
|
|
{ |
|
|
|
|
|
$interval.cancel(intervalGetData); |
|
|
|
|
|
$scope.currentInclude="login.html"; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
$scope.getLoggedUser = function(){ |
|
|
$scope.getLoggedUser = function(){ |
|
|
//get logged user
|
|
|
//get logged user
|
|
|
$http.get(urlapi + 'users/byusername/' + $scope.user.username) |
|
|
|
|
|
|
|
|
$http.get(urlapi + 'users/loggeduser/' + $scope.user.username) |
|
|
.success(function(data, status, headers,config){ |
|
|
.success(function(data, status, headers,config){ |
|
|
console.log(data); |
|
|
console.log(data); |
|
|
$scope.user=data; |
|
|
$scope.user=data; |
|
|
}) |
|
|
}) |
|
|
.error(function(data, status, headers,config){ |
|
|
.error(function(data, status, headers,config){ |
|
|
console.log("server not responding, data error"); |
|
|
|
|
|
toastr.error("server not responding"); |
|
|
|
|
|
$scope.$broadcast('scroll.refreshComplete');//refresher stop
|
|
|
|
|
|
|
|
|
$scope.serverNotResponding(); |
|
|
}) |
|
|
}) |
|
|
.then(function(result){ |
|
|
.then(function(result){ |
|
|
users = result.data; |
|
|
users = result.data; |
|
@ -37,10 +49,12 @@ angular.module('workApp', ['chart.js']) |
|
|
if(localStorage.getItem("owt_user")){ |
|
|
if(localStorage.getItem("owt_user")){ |
|
|
$scope.user=JSON.parse(localStorage.getItem("owt_user")); |
|
|
$scope.user=JSON.parse(localStorage.getItem("owt_user")); |
|
|
}else{ |
|
|
}else{ |
|
|
$scope.currentInclude="login.html"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.serverNotResponding(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$scope.getLoggedUser(); |
|
|
$scope.getLoggedUser(); |
|
|
|
|
|
|
|
|
//getting users
|
|
|
//getting users
|
|
|
$http.get(urlapi + 'users') |
|
|
$http.get(urlapi + 'users') |
|
|
.success(function(data, status, headers,config){ |
|
|
.success(function(data, status, headers,config){ |
|
|