Revision 5784dfe4
b/ui/templates/machines.html | ||
---|---|---|
702 | 702 |
|
703 | 703 |
// intercept click on save button in metadata edit dialog |
704 | 704 |
$('#edit-dialog button.save').live('click', function(){ |
705 |
// get the updated values and the old key |
|
706 |
var oldKey = $(this).parent().find('label.oldValue').text(); |
|
707 |
var newKey = $(this).parent().find('input.edit-meta-key').val(); |
|
708 |
var newValue = $(this).parent().find('textarea.edit-meta-value').val(); |
|
705 | 709 |
// put the new values and close the forms |
706 |
$(this).parent().find('label').html($(this).parent().find('input.edit-meta-key').text()); |
|
707 |
$(this).parent().find('p').html($(this).parent().find('textarea.edit-meta-value').text()); |
|
708 |
// make the call |
|
709 |
// TODO |
|
710 |
$(this).parent().find('label').html(newKey); |
|
711 |
$(this).parent().find('p').html(newValue); |
|
712 |
// check if the new metadata key is the same with the old one |
|
713 |
if ( oldKey != newKey ) { |
|
714 |
// if the key has changed, delete old pair |
|
715 |
delete_metadata(serverID, oldKey) |
|
716 |
} |
|
717 |
// add or update meatadata pair |
|
718 |
add_metadata(serverID, newKey, newValue); |
|
719 |
|
|
710 | 720 |
// show/hide the appropriate buttons |
711 | 721 |
$(this).hide(); // this button (save) |
712 | 722 |
$(this).prev().hide(); // the cancel button |
Also available in: Unified diff