Add delete machine
This commit is contained in:
parent
b2c76ddf0a
commit
cddd9682e6
4 changed files with 26 additions and 3 deletions
|
@ -108,7 +108,22 @@ 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}));
|
||||
$.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();
|
||||
});
|
||||
};
|
||||
|
||||
var deleteMachine = function (callback, machineId) {
|
||||
// Send listServers request
|
||||
var result = $http.post('../server/index.php',
|
||||
$.param({"token": Identity.getToken(), "task": "compute", "action": "deleteServer", 'serverId': machineId}));
|
||||
|
||||
// Wait and handle the response
|
||||
result.then(function (response) {
|
||||
|
@ -149,7 +164,8 @@ mainApp.factory('Compute', ['$http', 'Identity', function ($http, Identity) {
|
|||
return {
|
||||
pullMachines: pullMachines,
|
||||
pullData: pullData,
|
||||
createMachine:createMachine,
|
||||
createMachine: createMachine,
|
||||
deleteMachine: deleteMachine,
|
||||
getData: getData
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue