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

41 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-05-04 18:50:28 +02:00
/**
* The home controller
*
* @param {$scope} $scope The $scope service from angular
*/
mainApp.controller('machineCreationCtrl', ['$scope', 'Compute', '$rootScope', '$timeout', 'Identity', function ($scope, Compute, $rootScope, $timeout, Identity)
{
2016-05-04 22:46:40 +02:00
$scope.name = "";
$('#pleaseChooseAnImage').hide();
2016-05-04 18:50:28 +02:00
// When we need to show details of machine
2016-05-04 19:38:09 +02:00
$scope.$on('showMachineCreationEvent', function (eventName, axioms) {
2016-05-04 22:46:40 +02:00
$scope.axioms = axioms;
2016-05-04 18:50:28 +02:00
$('#machineCreationModal').modal({backdrop: false, keyboard: true});
});
2016-05-04 22:46:40 +02:00
var callMeAfterMachineCreation=function(response){
Compute.pullData(function(){});
};
$scope.createMachine = function () {
if ($scope.selectedImage == null) {
$('#pleaseChooseAnImage').show();
} else {
$('#pleaseChooseAnImage').hide();
$('#machineCreationModal').modal("hide");
machine = {}
machine.name = $scope.name
machine.flavorId = 1
machine.imageId = $scope.selectedImage
Compute.createMachine(callMeAfterMachineCreation, machine)
$scope.name="";
}
2016-05-04 19:38:09 +02:00
};
2016-05-04 18:50:28 +02:00
}]);