From ff1832adcfe10fadb6cbf738c874611f77f6dd43 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 22 Feb 2016 17:30:25 +0100 Subject: [PATCH] Edit Compute service and home controller --- client/js/controllers/.#status.js | 1 - client/js/controllers/home/main.js | 9 ++++++++- client/js/controllers/status.js | 5 ++++- client/js/services/Compute.js | 14 ++++++++++++-- 4 files changed, 24 insertions(+), 5 deletions(-) delete mode 120000 client/js/controllers/.#status.js diff --git a/client/js/controllers/.#status.js b/client/js/controllers/.#status.js deleted file mode 120000 index e6c258f..0000000 --- a/client/js/controllers/.#status.js +++ /dev/null @@ -1 +0,0 @@ -loic@Manzerbredes.home.30343:1455008378 \ No newline at end of file diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js index d42e413..d25bfad 100644 --- a/client/js/controllers/home/main.js +++ b/client/js/controllers/home/main.js @@ -5,6 +5,13 @@ */ mainApp.controller('homeCtrl', [ '$scope', 'Compute', function ($scope, Compute) { - + + + var updatePage=function(){ + // TODO Update graph etc... + } + + // Retrieve all Data + Compute.pullData(updatePage); }]); diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js index 6bc602a..e01df34 100644 --- a/client/js/controllers/status.js +++ b/client/js/controllers/status.js @@ -8,8 +8,11 @@ */ mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($scope, Identity, $rootScope) { + + // Give profile to model $scope.profile=Identity.profile; - + + // Function to logout $scope.logout=function(){ Identity.logout(); $rootScope.$broadcast('logoutEvent'); diff --git a/client/js/services/Compute.js b/client/js/services/Compute.js index 748510e..c5c8da9 100644 --- a/client/js/services/Compute.js +++ b/client/js/services/Compute.js @@ -2,6 +2,10 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){ + + var data={}; + data.machines={}; + // Parser var parseGetMachinesAnswer=function(response, failedToSendRequest){ @@ -13,17 +17,23 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){ var getMachines=function(callback){ var result=$http.post('../server/index.php', - $.param({"token" : Identity.profile.token, "task" : "Compute"})); + $.param({"token" : Identity.profile.token, "task" : "Compute"})); - }; + + var pullData=function(callback){ + // TODO call getMachines etc... + } + // Return services objects return { getMachines: getMachines + pullData: pullData + data:data };