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

44 lines
861 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-03-02 20:46:24 +01:00
// Init scope
2016-02-28 17:29:34 +01:00
$scope.machine={};
2016-03-02 20:46:24 +01:00
$scope.machineIsStarting=false; // For loading icon
2016-02-28 16:07:52 +01:00
2016-03-01 22:50:37 +01:00
$scope.$on('showMachineDetailsEvent', function(eventName ,machine, axioms){
2016-02-28 16:07:52 +01:00
$scope.machine=machine;
2016-03-01 22:50:37 +01:00
$scope.axioms=axioms;
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(){
2016-03-02 20:46:24 +01:00
// Display gif
$scope.machineIsStarting=true;
2016-02-28 17:29:34 +01:00
// Fake timeout
$timeout(function(){
2016-03-02 20:46:24 +01:00
$scope.machineIsStarting=false;
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
}]);