Edit Compute service and home controller

This commit is contained in:
manzerbredes 2016-02-22 17:30:25 +01:00
parent 0c31cbdbd4
commit ff1832adcf
4 changed files with 24 additions and 5 deletions

View file

@ -1 +0,0 @@
loic@Manzerbredes.home.30343:1455008378

View file

@ -5,6 +5,13 @@
*/ */
mainApp.controller('homeCtrl', [ '$scope', 'Compute', function ($scope, Compute) mainApp.controller('homeCtrl', [ '$scope', 'Compute', function ($scope, Compute)
{ {
var updatePage=function(){
// TODO Update graph etc...
}
// Retrieve all Data
Compute.pullData(updatePage);
}]); }]);

View file

@ -8,8 +8,11 @@
*/ */
mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($scope, Identity, $rootScope) mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($scope, Identity, $rootScope)
{ {
// Give profile to model
$scope.profile=Identity.profile; $scope.profile=Identity.profile;
// Function to logout
$scope.logout=function(){ $scope.logout=function(){
Identity.logout(); Identity.logout();
$rootScope.$broadcast('logoutEvent'); $rootScope.$broadcast('logoutEvent');

View file

@ -2,6 +2,10 @@
mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
var data={};
data.machines={};
// Parser // Parser
var parseGetMachinesAnswer=function(response, failedToSendRequest){ var parseGetMachinesAnswer=function(response, failedToSendRequest){
@ -13,17 +17,23 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
var getMachines=function(callback){ var getMachines=function(callback){
var result=$http.post('../server/index.php', 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 services objects
return { return {
getMachines: getMachines getMachines: getMachines
pullData: pullData
data:data
}; };