summaryrefslogtreecommitdiff
path: root/client/js/services/Compute.js
diff options
context:
space:
mode:
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
};