diff options
| author | root <root@kabir-PC> | 2016-03-02 15:11:56 +0100 |
|---|---|---|
| committer | root <root@kabir-PC> | 2016-03-02 15:11:56 +0100 |
| commit | dac5c28a6795984a32687fe21c41783de2e85d8b (patch) | |
| tree | bb5b719f923b33e31d5a0880d1d50dbe49543e45 /client/js/controllers/home/main.js | |
| parent | 70fcf3553abb4a25672ee198dafb89e430e2bd79 (diff) | |
| parent | b6d7d2c30efe5e9758072bb82ea3a947bda7fd1d (diff) | |
Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into othmane
Diffstat (limited to 'client/js/controllers/home/main.js')
| -rw-r--r-- | client/js/controllers/home/main.js | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js index d25bfad..f84f625 100644 --- a/client/js/controllers/home/main.js +++ b/client/js/controllers/home/main.js @@ -3,15 +3,34 @@ * * @param {$scope} $scope The $scope service from angular */ -mainApp.controller('homeCtrl', [ '$scope', 'Compute', function ($scope, Compute) +mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', function ($scope, Compute, $rootScope, Loading, Identity) { + var callMeAfterPullData=function(data){ + $scope.machines=Compute.getData().machines; + Loading.stop(); + } - var updatePage=function(){ - // TODO Update graph etc... + ; + if(Compute.getData().machines == null && Identity.isAlreadyLogin()){ + Loading.start(); + Compute.pullData(callMeAfterPullData); } - // Retrieve all Data - Compute.pullData(updatePage); - + + + + $scope.raiseShowMachineDetailsEvent=function(id){ + + var callback=function(){ + Loading.stop(); + var data=Compute.getData(); + $rootScope.$broadcast("showMachineDetailsEvent", data.machines[id], data.axioms); + + } + Loading.start(); + Compute.pullMachines(callback); + } + + }]); |
