This commit is contained in:
Yoggzo 2016-02-29 14:20:13 +01:00
parent 6349739a6c
commit cfce59d6dc
47 changed files with 500 additions and 52 deletions

View file

@ -0,0 +1,39 @@
/**
* The home controller
*
* @param {$scope} $scope The $scope service from angular
*/
mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', '$timeout', function ($scope, Compute, $rootScope, $timeout)
{
$scope.machine={};
$("#waitingForToggleMachine").hide();
$scope.$on('showMachineDetailsEvent', function(eventName ,machine){
$scope.machine=machine;
$('#machineDetailsModal').modal({backdrop: false, keyboard: true});
});
$scope.toggleMachineState=function(){
$("#waitingForToggleMachine").show();
// Fake timeout
$timeout(function(){
$("#waitingForToggleMachine").hide();
}, 3000);
$timeout(function(){
$scope.machine.online=!$scope.machine.online;
}, 3000);
};
$scope.applyModifications=function(){
//Todo
}
}]);

View file

@ -3,15 +3,22 @@
*
* @param {$scope} $scope The $scope service from angular
*/
mainApp.controller('homeCtrl', [ '$scope', 'Compute', function ($scope, Compute)
mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', function ($scope, Compute, $rootScope)
{
var updatePage=function(){
// TODO Update graph etc...
}
// Retrieve all Data
Compute.pullData(updatePage);
Compute.getMachines(function(adzda){});
$scope.raiseShowMachineDetailsEvent=function(){
var machine={name: "Machine 1", online:true};
$rootScope.$broadcast("showMachineDetailsEvent", machine);
}
}]);

View file

@ -13,14 +13,19 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
if(!Identity.isAlreadyLogin()){
$('#loginModal').modal({backdrop: 'static', keyboard: false});
}
// Manager logout event
$scope.$on('logoutEvent', function(){
Identity.logout();
$('#loginModal').modal({backdrop: 'static', keyboard: false});
});
// Hide loading button and message alert
$('#loadingLoginButton').hide();
$('#failedToLoginAlert').hide();
// Defined function for login
$scope.loginAction=function(){
// Begin login state for template

View file

@ -10,13 +10,11 @@ mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($
{
// Give profile to model
$scope.profile=Identity.profile;
$scope.profile=Identity.getProfile();
// Function to logout
$scope.logout=function(){
Identity.logout();
$scope.raiseLogoutEvent=function(){
$rootScope.$broadcast('logoutEvent');
};
}]);