summaryrefslogtreecommitdiff
path: root/client/js/controllers
diff options
context:
space:
mode:
authorYoggzo <yogg@epsina.com>2016-02-29 14:20:13 +0100
committerYoggzo <yogg@epsina.com>2016-02-29 14:20:13 +0100
commitcfce59d6dc120848624e105614575ae0f48af81b (patch)
tree348540cbed9dfce254a64ceee69977e9954b65e1 /client/js/controllers
parent6349739a6c42d413e1bc1ea5068336187055c277 (diff)
merge
Diffstat (limited to 'client/js/controllers')
-rw-r--r--client/js/controllers/home/machineDetails.js39
-rw-r--r--client/js/controllers/home/main.js13
-rw-r--r--client/js/controllers/login.js9
-rw-r--r--client/js/controllers/status.js6
4 files changed, 58 insertions, 9 deletions
diff --git a/client/js/controllers/home/machineDetails.js b/client/js/controllers/home/machineDetails.js
new file mode 100644
index 0000000..f84a073
--- /dev/null
+++ b/client/js/controllers/home/machineDetails.js
@@ -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
+ }
+
+
+
+}]);
diff --git a/client/js/controllers/home/main.js b/client/js/controllers/home/main.js
index d25bfad..4e3bcda 100644
--- a/client/js/controllers/home/main.js
+++ b/client/js/controllers/home/main.js
@@ -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);
+ }
+
+
}]);
diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js
index 829fc1d..1a89563 100644
--- a/client/js/controllers/login.js
+++ b/client/js/controllers/login.js
@@ -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
diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js
index e01df34..940d794 100644
--- a/client/js/controllers/status.js
+++ b/client/js/controllers/status.js
@@ -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');
-
};
}]);