diff options
Diffstat (limited to 'client/js/controllers/home/main.js')
| -rw-r--r-- | client/js/controllers/home/main.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js index 4e3bcda..f84f625 100644 --- a/client/js/controllers/home/main.js +++ b/client/js/controllers/home/main.js @@ -3,21 +3,33 @@ * * @param {$scope} $scope The $scope service from angular */ -mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($scope, Compute, $rootScope) +mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', function ($scope, Compute, $rootScope, Loading, Identity) { - var updatePage=function(){ - // TODO Update graph etc... + var callMeAfterPullData=function(data){ + $scope.machines=Compute.getData().machines; + Loading.stop(); } - // Retrieve all Data - Compute.pullData(updatePage); + ; + if(Compute.getData().machines == null && Identity.isAlreadyLogin()){ + Loading.start(); + Compute.pullData(callMeAfterPullData); + } + + + + + $scope.raiseShowMachineDetailsEvent=function(id){ - Compute.getMachines(function(adzda){}); + var callback=function(){ + Loading.stop(); + var data=Compute.getData(); + $rootScope.$broadcast("showMachineDetailsEvent", data.machines[id], data.axioms); - $scope.raiseShowMachineDetailsEvent=function(){ - var machine={name: "Machine 1", online:true}; - $rootScope.$broadcast("showMachineDetailsEvent", machine); + } + Loading.start(); + Compute.pullMachines(callback); } |
