istic-openstack/client/js/controllers/home/machineDetails.js

41 lines
819 B
JavaScript
Raw Normal View History

2016-02-28 16:07:52 +01:00
/**
* The home controller
*
* @param {$scope} $scope The $scope service from angular
*/
2016-02-28 17:29:34 +01:00
mainApp.controller('machineDetailsCtrl', [ '$scope', 'Compute', '$rootScope', '$timeout', function ($scope, Compute, $rootScope, $timeout)
2016-02-28 16:07:52 +01:00
{
2016-02-28 17:29:34 +01:00
$scope.machine={};
$("#waitingForToggleMachine").hide();
2016-02-28 16:07:52 +01:00
$scope.$on('showMachineDetailsEvent', function(eventName ,machine){
$scope.machine=machine;
2016-03-01 20:51:08 +01:00
console.log(machine);
2016-02-28 16:07:52 +01:00
$('#machineDetailsModal').modal({backdrop: false, keyboard: true});
});
2016-02-28 17:29:34 +01:00
$scope.toggleMachineState=function(){
$("#waitingForToggleMachine").show();
// Fake timeout
$timeout(function(){
$("#waitingForToggleMachine").hide();
2016-02-28 17:54:15 +01:00
}, 3000);
2016-02-28 17:29:34 +01:00
$timeout(function(){
$scope.machine.online=!$scope.machine.online;
2016-02-28 17:54:15 +01:00
}, 3000);
2016-02-28 17:29:34 +01:00
};
$scope.applyModifications=function(){
//Todo
}
2016-02-28 16:07:52 +01:00
}]);