Commit 94041c48 authored by Markos Gogoulos's avatar Markos Gogoulos
Browse files

remove metadata for a virtual server

Refs #375
parent 26e38c32
......@@ -702,6 +702,29 @@ function get_metadata(serverID) {
return false;
}
// delete server metadata action
function delete_server_metadata(serverID, meta_key) {
$.ajax({
url: API_URL + '/servers/' + serverID + '/meta/' + meta_key,
type: "DELETE",
//async: false,
dataType: "json",
timeout: TIMEOUT,
error: function(jqXHR, textStatus, errorThrown) {
try {
ajax_error(jqXHR.status, undefined, 'Delete metadata', jqXHR.responseText);
} catch (err) {
ajax_error(err);
}
},
success: function(data, textStatus, jqXHR) {
get_metadata(serverID);
}
});
return false;
}
// show the welcome screen
function showWelcome() {
$("#view-select").fadeOut("fast");
......
......@@ -625,10 +625,11 @@ $('#editor-1.meta-modal button.create').click( function(){
});
// intercept click on remove button in metadata edit dialog
$('#editor-1.meta-modal button.create').click( function(){
// ajax call to delete selected metadata key-value pair
// if successful remove it from the overlay
// TODO
$('#editor-1.meta-modal button.remove').live('click', function() {
var serverID = $(this).parent().parent().parent().parent().children("h3").attr('id');
var meta_key = $(this).parent().find("label").text();
delete_server_metadata(serverID, meta_key);
return false;
});
// intercept click on edit button in metadata edit dialog
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment