summaryrefslogtreecommitdiff
path: root/client/js/services/Compute.js
diff options
context:
space:
mode:
authorLoic GUEGAN <loic@Manzerbredes.home>2016-05-04 19:38:09 +0200
committerLoic GUEGAN <loic@Manzerbredes.home>2016-05-04 19:38:09 +0200
commit0266c16ffc97042853916c390aaaccecc72e69a1 (patch)
treeaed361ca7133bdab46683d1ff9c3edf38048ef27 /client/js/services/Compute.js
parentf819bc0c909dd85c4d98c8fb870ce5c6fce37383 (diff)
Commit for testing
Diffstat (limited to 'client/js/services/Compute.js')
-rw-r--r--client/js/services/Compute.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/client/js/services/Compute.js b/client/js/services/Compute.js
index 712b9a2..312f235 100644
--- a/client/js/services/Compute.js
+++ b/client/js/services/Compute.js
@@ -105,6 +105,21 @@ mainApp.factory('Compute', ['$http', 'Identity', function ($http, Identity) {
});
};
+ var createMachine = function (callback, machine) {
+ // Send listServers request
+ var result = $http.post('../server/index.php',
+ $.param({"token": Identity.getToken(), "task": "compute", "action": "createServer", 'name':machine.name, "imageId":machine.imageId,"flavorId":machine.flavorId}));
+
+ // Wait and handle the response
+ result.then(function (response) {
+ callback();
+ console.log(response.data.Error)
+ }, function (response) {
+ console.log("error")
+ callback();
+ });
+ };
+
/**
* Retrieve all data
@@ -134,6 +149,7 @@ mainApp.factory('Compute', ['$http', 'Identity', function ($http, Identity) {
return {
pullMachines: pullMachines,
pullData: pullData,
+ createMachine:createMachine,
getData: getData
};