diff options
| author | Loic GUEGAN <loic@Manzerbredes.home> | 2016-05-08 15:14:47 +0200 |
|---|---|---|
| committer | Loic GUEGAN <loic@Manzerbredes.home> | 2016-05-08 15:14:47 +0200 |
| commit | c5e909da1b83048d0323e9aa5da826c7f1a63fb0 (patch) | |
| tree | b17ef5b6776305a345742215d9a6cb507d217679 | |
| parent | 3b5d1e033ab13e3836073689cd154648f5f5c0d6 (diff) | |
Add auto update
| -rwxr-xr-x | client/js/controllers/home/home.js | 13 | ||||
| -rwxr-xr-x | client/js/controllers/image/image.js | 9 |
2 files changed, 7 insertions, 15 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(); diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js index b402b52..5bafa88 100755 --- a/client/js/controllers/image/image.js +++ b/client/js/controllers/image/image.js @@ -14,12 +14,9 @@ mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', 'Identity', '$roo // If user is login try to retrieve data if (Identity.isAlreadyLogin()) { - if (Image.getData().images == null) { - Loading.start(); - Image.getImages(callMeAfterGetImage); - } else { - callMeAfterGetImage(); - } + Loading.start(); + Image.getImages(callMeAfterGetImage); + } // Manager logout event |
