Revision 1b3857ab ui/templates/machines.html

b/ui/templates/machines.html
619 619

  
620 620
// intercept click on create button in metadata edit dialog
621 621
$('#editor-1.meta-modal button.create').click( function(){
622
    // go from edit metadata to add metadata
622
    // close edit metadata and open add metadata dialog
623 623
    $('a#meta-editor-1').data('overlay').close();
624 624
    addMetadata();
625 625
});
626 626

  
627 627
// intercept click on remove button in metadata edit dialog
628
$('#editor-1.meta-modal button.remove').live('click', function() {    
628
$('#editor-1.meta-modal button.remove').live('click', function() { 
629
    // get the server id and meta key needed for the ajax call   
629 630
    var serverID = $(this).parent().parent().parent().parent().children("h3").attr('id');
630 631
    var meta_key = $(this).parent().find("label").text();
631
    delete_server_metadata(serverID, meta_key);
632
    // make the ajax call and list the new GET results
633
    delete_metadata(serverID, meta_key);
632 634
    return false;
633 635
});
634 636

  
635 637
// intercept click on edit button in metadata edit dialog
636
$('#editor-1.meta-modal button.create').click( function(){
638
$('#editor-1.meta-modal button.edit').click( function(){
637 639
    // inline editing of selected key-value pair
638 640
    // on submission ajax call from updating
639 641
    // on success update the overlay
......
642 644

  
643 645
// intercept click on cancel button in metadata add dialog
644 646
$('#editor-2.meta-modal button.cancel').click( function(){
645
    // go from add meatata to edit metadata
647
    // close add metadata and open edit metadata dialog
646 648
    $('a#meta-editor-2').data('overlay').close();
647 649
    editMetadata();
648 650
});
649 651

  
650 652
// intercept click on save button in metadata add dialog
651
$('#editor-2.meta-modal button.save').live('click', function() {    
653
$('#editor-2.meta-modal button.save').live('click', function() {
654
    // get the server id, meta key and meta value needed for the ajax call       
652 655
    var serverID = $(this).parent().children("h3").attr('id');
653 656
    var meta_key = $(this).parent().find(".content input.key").attr('value');
654 657
    var meta_value = $(this).parent().find(".content input.value").attr('value');
655
    add_server_metadata(serverID, meta_key, meta_value);
658
    // make the ajax call and list the new GET results
659
    add_metadata(serverID, meta_key, meta_value);
660
    // close add metadata and open edit metadata dialog
661
    $('a#meta-editor-2').data('overlay').close();
662
    editMetadata();
656 663
    return false;
657 664
});
658 665

  
......
667 674
        pair = $("ul.meta-template li").clone();
668 675
        pair.find("label").text(key);
669 676
        pair.find("p").text(meta[key]);
670
        pair.appendTo("#editor-1 div.content ul.meta-list");
677
        pair.appendTo("#editor-1 div.content ul.meta-list").fadeIn();
671 678
    }
672 679
}
673 680

  

Also available in: Unified diff