diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js index d93c376..4e3bcda 100644 --- a/client/js/controllers/home/main.js +++ b/client/js/controllers/home/main.js @@ -13,6 +13,8 @@ mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($s // Retrieve all Data Compute.pullData(updatePage); + Compute.getMachines(function(adzda){}); + $scope.raiseShowMachineDetailsEvent=function(){ var machine={name: "Machine 1", online:true}; $rootScope.$broadcast("showMachineDetailsEvent", machine); diff --git a/client/js/services/Compute.js b/client/js/services/Compute.js index 70359ee..7e1764f 100644 --- a/client/js/services/Compute.js +++ b/client/js/services/Compute.js @@ -15,9 +15,18 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){ // Get Machine var getMachines=function(callback){ - + var result=$http.post('../server/index.php', - $.param({"token" : Identity.profile.token, "task" : "Compute"})); + $.param({"token" : Identity.getToken(), "task" : "compute", action:"getImage", serverID:"69d5bcc4-2fab-4634-b0d2-f455fee5b7bd"})); + + // Wait and handle the response + result.then(function (response){ + alert(response); + callback(parseGetMachinesAnswer(response, false)); + },function(response){ + alert(response.status); + callback(parseGetMachinesAnswer(response, true)); + }); };