From c5e909da1b83048d0323e9aa5da826c7f1a63fb0 Mon Sep 17 00:00:00 2001 From: Loic GUEGAN Date: Sun, 8 May 2016 15:14:47 +0200 Subject: Add auto update --- client/js/controllers/home/home.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'client/js/controllers/home') 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(); -- cgit v1.2.3