diff options
Diffstat (limited to 'client/js/controllers')
| -rw-r--r-- | client/js/controllers/home/home.js | 10 | ||||
| -rw-r--r-- | client/js/controllers/image/image.js | 21 |
2 files changed, 29 insertions, 2 deletions
diff --git a/client/js/controllers/home/home.js b/client/js/controllers/home/home.js index f84f625..4402e62 100644 --- a/client/js/controllers/home/home.js +++ b/client/js/controllers/home/home.js @@ -3,7 +3,7 @@ * * @param {$scope} $scope The $scope service from angular */ -mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', function ($scope, Compute, $rootScope, Loading, Identity) +mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','Identity', 'Image', function ($scope, Compute, $rootScope, Loading, Identity, Image) { var callMeAfterPullData=function(data){ @@ -16,8 +16,14 @@ mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','I Loading.start(); Compute.pullData(callMeAfterPullData); } + else{ + if(Identity.isAlreadyLogin()){ + callMeAfterPullData(); + } + } - + + Image.getImages(function(){}); $scope.raiseShowMachineDetailsEvent=function(id){ diff --git a/client/js/controllers/image/image.js b/client/js/controllers/image/image.js new file mode 100644 index 0000000..e298fcc --- /dev/null +++ b/client/js/controllers/image/image.js @@ -0,0 +1,21 @@ +/** + * The image controller + * + * @param {$scope} $scope The $scope service from angular + */ +mainApp.controller('imageCtrl', ['$scope', 'Image', 'Loading', function ($scope, Image, Loading) +{ + var callbackTest=function(){ + $scope.images=Image.getData().images; + Loading.stop(); + }; + + if(Image.getData().images==null){ + Loading.start(); + Image.getImages(callbackTest); + } + else{ + callbackTest(); + } + +}]); |
