diff options
Diffstat (limited to 'client/js/controllers/home/home.js')
| -rwxr-xr-x | client/js/controllers/home/home.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/client/js/controllers/home/home.js b/client/js/controllers/home/home.js index aeb89e5..8ec4c95 100755 --- a/client/js/controllers/home/home.js +++ b/client/js/controllers/home/home.js @@ -5,7 +5,6 @@ */ mainApp.controller('homeCtrl', ['$scope', 'Compute', '$rootScope', 'Loading', 'Identity', 'Image', function ($scope, Compute, $rootScope, Loading, Identity, Image) { - graph = new joint.dia.Graph; paper = new joint.dia.Paper({ el: $('#graphHolder'), @@ -87,18 +86,14 @@ mainApp.controller('homeCtrl', ['$scope', 'Compute', '$rootScope', 'Loading', 'I var tryToRetrieveData = function () { // If no data retrieve about machine and user is logged - if (Compute.getData().machines == null && Identity.isAlreadyLogin()) { + if (Identity.isAlreadyLogin()) { Loading.start(); // Show loading gif Compute.pullData(callMeAfterPullData); // Retrieve data and call the callback - } else { - // Else if user is logged and data is already retrieve - // simply display data - if (Identity.isAlreadyLogin()) { - callMeAfterPullData(); // Display data - } - } + } }; + tryToRetrieveData(); + // On user login $scope.$on('loginEvent', function () { tryToRetrieveData(); |
