Revision a70a9116
b/ui/static/synnefo.js | ||
---|---|---|
675 | 675 |
} |
676 | 676 |
|
677 | 677 |
// rename action |
678 |
function rename(serverIDs){
|
|
679 |
if (!serverIDs.length){
|
|
678 |
function rename(serverID, serverName){
|
|
679 |
if (!serverID.length){ |
|
680 | 680 |
//ajax_success('DEFAULT'); |
681 | 681 |
return false; |
682 | 682 |
} |
683 | 683 |
// ajax post rename call |
684 | 684 |
var payload = { |
685 |
"rename": {"type" : "PUT"}
|
|
685 |
"server": {"name" : serverName}
|
|
686 | 686 |
}; |
687 | 687 |
|
688 |
var serverID = serverIDs.pop() |
|
689 | 688 |
$.ajax({ |
690 | 689 |
url: API_URL + '/servers/' + serverID + '/action', |
691 |
type: "POST",
|
|
690 |
type: "PUT",
|
|
692 | 691 |
contentType: "application/json", |
693 | 692 |
dataType: "json", |
694 | 693 |
data: JSON.stringify(payload), |
... | ... | |
703 | 702 |
} catch(err) {} |
704 | 703 |
// indicate that the action succeeded |
705 | 704 |
display_success(serverID); |
706 |
// continue with the rest of the servers |
|
707 |
start(serverIDs); |
|
708 | 705 |
} else { |
709 | 706 |
ajax_error(jqXHR.status, serverID, 'Rename', jqXHR.responseText); |
710 | 707 |
} |
b/ui/templates/standard.html | ||
---|---|---|
73 | 73 |
return false; |
74 | 74 |
}); |
75 | 75 |
|
76 |
//rename machine
|
|
76 |
//initiate machine renaming
|
|
77 | 77 |
$(".rename, h5.editable span.name").live('click', function() { |
78 | 78 |
$(this).parent().find('.name').html("<input id=\"txtEdit\" type=\"text\" class=\"nametextbox\" value=\"" + $(this).parent().find('.name').text() + "\" / ><span class=\"oldValue\" style=\"display:none;\" >" + $(this).parent().find('.name').text() + "</span>"); |
79 | 79 |
$(this).parent().find('.rename').hide(); |
... | ... | |
82 | 82 |
return false; |
83 | 83 |
}); |
84 | 84 |
|
85 |
//rename machine |
|
86 |
$(".editbuttons .save").live('click', function() { |
|
87 |
serverID = $(this).parent().parent().parent().attr("id"); |
|
88 |
serverName = $(this).parent().parent().find('.name').find('.nametextbox').val(); |
|
89 |
var found = false; |
|
90 |
$(this).parent().parent().find('.name').html($(this).parent().parent().find('.nametextbox').val()); |
|
91 |
$(this).parent().parent().find(".editbuttons").fadeOut("fast"); |
|
92 |
$(this).parent().parent().find(".rename").fadeIn("slow"); |
|
93 |
for (i=0;i<pending_actions.length;i++){ // if there is already a pending action for this server replace it |
|
94 |
if (pending_actions[i][1]==serverID){ |
|
95 |
pending_actions[i][0] = rename; |
|
96 |
found = true |
|
97 |
} |
|
98 |
} |
|
99 |
if (!found) // no pending action for this server was found, so let's just add it to the list |
|
100 |
pending_actions.push([rename, serverID, serverName]) |
|
101 |
return false; |
|
102 |
}); |
|
103 |
|
|
85 | 104 |
//cancel renaming |
86 | 105 |
$(".editbuttons .cancel").live('click', function() { |
87 |
console.info($(this).parent().parent().find('.name').find('.oldValue').text()); |
|
88 | 106 |
$(this).parent().parent().find('.name').html($(this).parent().parent().find('.name').find('.oldValue').text()); |
89 | 107 |
$(this).parent().parent().find(".editbuttons").hide(); |
90 | 108 |
$(this).parent().parent().find(".rename").fadeIn(); |
Also available in: Unified diff