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

@ -7,4 +7,11 @@ 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)
{
// Give profile to model
$scope.profile=Identity.profile;
// Function to logout
$scope.logout=function(){
Identity.logout();
$rootScope.$broadcast('logoutEvent');

View file

@ -3,6 +3,10 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
var data={};
data.machines={};
// Parser
var parseGetMachinesAnswer=function(response, failedToSendRequest){
@ -16,14 +20,20 @@ mainApp.factory('Compute',[ '$http', 'Identity', function($http, Identity){
$.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
};