mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
new UI - implement change VM name action.
This commit is contained in:
parent
6f14b406ce
commit
1b78b9cda2
@ -597,8 +597,8 @@
|
|||||||
<!-- Attach ISO Dialog -->
|
<!-- Attach ISO Dialog -->
|
||||||
<div id="dialog_attach_iso" title="Attach ISO" style="display:none">
|
<div id="dialog_attach_iso" title="Attach ISO" style="display:none">
|
||||||
<p>
|
<p>
|
||||||
Please specify the ISO you wish to attach to your Virtual Instance(s)
|
Please specify the ISO you wish to attach to your Virtual Instance(s).
|
||||||
</span></b>.</p>
|
</p>
|
||||||
<div class="dialog_formcontent">
|
<div class="dialog_formcontent">
|
||||||
<form action="#" method="post" id="form_acquire">
|
<form action="#" method="post" id="form_acquire">
|
||||||
<ol>
|
<ol>
|
||||||
@ -613,3 +613,23 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Change Name Dialog -->
|
||||||
|
<div id="dialog_change_name" title="Change Name" style="display:none">
|
||||||
|
<p>
|
||||||
|
Please specify the new name you want to change for your Virtual Instance(s).
|
||||||
|
</p>
|
||||||
|
<div class="dialog_formcontent">
|
||||||
|
<form action="#" method="post" id="form_acquire">
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<label for="user_name">
|
||||||
|
Instance Name:</label>
|
||||||
|
<input class="text" type="text" name="change_instance_name" id="change_instance_name" />
|
||||||
|
<div id="change_instance_name_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -22,56 +22,57 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var actionMap = {
|
var actionMap = {
|
||||||
stopVirtualMachine: {
|
"Stop Instance": {
|
||||||
label: "Stop Instance",
|
api: "stopVirtualMachine",
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "stopvirtualmachineresponse",
|
asyncJobResponse: "stopvirtualmachineresponse",
|
||||||
afterActionSeccessFn: setMidmenuItemVm
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
},
|
},
|
||||||
startVirtualMachine: {
|
"Start Instance": {
|
||||||
label: "Start Instance",
|
api: "startVirtualMachine",
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "startvirtualmachineresponse",
|
asyncJobResponse: "startvirtualmachineresponse",
|
||||||
afterActionSeccessFn: setMidmenuItemVm
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
},
|
},
|
||||||
rebootVirtualMachine: {
|
"Reboot Instance": {
|
||||||
label: "Reboot Instance",
|
api: "rebootVirtualMachine",
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "rebootvirtualmachineresponse",
|
asyncJobResponse: "rebootvirtualmachineresponse",
|
||||||
afterActionSeccessFn: setMidmenuItemVm
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
},
|
},
|
||||||
destroyVirtualMachine: {
|
"Destroy Instance": {
|
||||||
label: "Destroy Instance",
|
api: "destroyVirtualMachine",
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "destroyvirtualmachineresponse",
|
asyncJobResponse: "destroyvirtualmachineresponse",
|
||||||
afterActionSeccessFn: setMidmenuItemVm
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
},
|
},
|
||||||
recoverVirtualMachine: {
|
"Restore Instance": {
|
||||||
label: "Restore Instance",
|
api: "recoverVirtualMachine",
|
||||||
isAsyncJob: false,
|
isAsyncJob: false,
|
||||||
afterActionSeccessFn: setMidmenuItemVm
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
},
|
},
|
||||||
attachIso: {
|
"Attach ISO": {
|
||||||
label: "Attach ISO",
|
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "attachisoresponse",
|
asyncJobResponse: "attachisoresponse",
|
||||||
afterActionSeccessFn: setMidmenuItemVm,
|
dialogBeforeActionFn : doAttachISO,
|
||||||
dialogBeforeActionFn : doAttachISO
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
},
|
},
|
||||||
detachIso: {
|
"Detach ISO": {
|
||||||
label: "Detach ISO",
|
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "detachisoresponse",
|
asyncJobResponse: "detachisoresponse",
|
||||||
afterActionSeccessFn: setMidmenuItemVm,
|
dialogBeforeActionFn : doDetachISO,
|
||||||
dialogBeforeActionFn : doDetachISO
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
}
|
},
|
||||||
,
|
"Reset Password": {
|
||||||
resetPasswordForVirtualMachine: {
|
|
||||||
label: "Reset Password",
|
|
||||||
isAsyncJob: true,
|
isAsyncJob: true,
|
||||||
asyncJobResponse: "resetpasswordforvirtualmachineresponse",
|
asyncJobResponse: "resetpasswordforvirtualmachineresponse",
|
||||||
afterActionSeccessFn: function(){},
|
dialogBeforeActionFn : doResetPassword,
|
||||||
dialogBeforeActionFn : doResetPassword
|
afterActionSeccessFn: function(){}
|
||||||
|
},
|
||||||
|
"Change Name": {
|
||||||
|
isAsyncJob: false,
|
||||||
|
dialogBeforeActionFn : doChangeName,
|
||||||
|
afterActionSeccessFn: setMidmenuItemVm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +160,33 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||||||
}).dialog("open");
|
}).dialog("open");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doChangeName($t, selectedItemIds, listAPIMap) {
|
||||||
|
$("#dialog_change_name")
|
||||||
|
.dialog('option', 'buttons', {
|
||||||
|
"Confirm": function() {
|
||||||
|
var thisDialog = $(this);
|
||||||
|
thisDialog.dialog("close");
|
||||||
|
|
||||||
|
// validate values
|
||||||
|
var isValid = true;
|
||||||
|
isValid &= validateString("Name", thisDialog.find("#change_instance_name"), thisDialog.find("#change_instance_name_errormsg"));
|
||||||
|
if (!isValid) return;
|
||||||
|
|
||||||
|
var name = trim(thisDialog.find("#change_instance_name").val());
|
||||||
|
|
||||||
|
for(var id in selectedItemIds) {
|
||||||
|
var apiCommand = "command=updateVirtualMachine&id="+id+"&displayName="+encodeURIComponent(escape(name));
|
||||||
|
doAction(id, $t, apiCommand, listAPIMap);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Cancel": function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}).dialog("open");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function updateVirtualMachineStateInRightPanel(state) {
|
function updateVirtualMachineStateInRightPanel(state) {
|
||||||
if(state == "Running")
|
if(state == "Running")
|
||||||
$rightPanelContent.find("#state").text(state).removeClass("red gray").addClass("green");
|
$rightPanelContent.find("#state").text(state).removeClass("red gray").addClass("green");
|
||||||
@ -308,13 +336,13 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||||||
//action menu
|
//action menu
|
||||||
$("#action_link").show();
|
$("#action_link").show();
|
||||||
$actionList.empty();
|
$actionList.empty();
|
||||||
for(var api in actionMap) {
|
for(var label in actionMap) {
|
||||||
var apiInfo = actionMap[api];
|
var apiInfo = actionMap[label];
|
||||||
var $listItem = $("#action_list_item").clone();
|
var $listItem = $("#action_list_item").clone();
|
||||||
$actionList.append($listItem.show());
|
$actionList.append($listItem.show());
|
||||||
var $link = $listItem.find("#link").text(apiInfo.label);
|
var $link = $listItem.find("#link").text(label);
|
||||||
$link.data("api", api);
|
$link.data("label", label);
|
||||||
$link.data("label", apiInfo.label);
|
$link.data("api", apiInfo.api);
|
||||||
$link.data("isAsyncJob", apiInfo.isAsyncJob);
|
$link.data("isAsyncJob", apiInfo.isAsyncJob);
|
||||||
$link.data("asyncJobResponse", apiInfo.asyncJobResponse);
|
$link.data("asyncJobResponse", apiInfo.asyncJobResponse);
|
||||||
$link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn);
|
$link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn);
|
||||||
@ -355,6 +383,12 @@ function clickInstanceGroupHeader($arrowIcon) {
|
|||||||
zIndex: 2000
|
zIndex: 2000
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
activateDialog($("#dialog_change_name").dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
modal: true,
|
||||||
|
zIndex: 2000
|
||||||
|
}));
|
||||||
|
|
||||||
//***** VM Wizard (begin) ******************************************************************************
|
//***** VM Wizard (begin) ******************************************************************************
|
||||||
$vmPopup = $("#vm_popup");
|
$vmPopup = $("#vm_popup");
|
||||||
var $serviceOfferingTemplate = $("#vm_popup_service_offering_template");
|
var $serviceOfferingTemplate = $("#vm_popup_service_offering_template");
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
//var jobIdMap;
|
//var jobIdMap;
|
||||||
function doAction(id, $t, apiCommand, listAPIMap) {
|
function doAction(id, $t, apiCommand, listAPIMap) {
|
||||||
var api = $t.data("api");
|
|
||||||
var label = $t.data("label");
|
var label = $t.data("label");
|
||||||
var isAsyncJob = $t.data("isAsyncJob");
|
var isAsyncJob = $t.data("isAsyncJob");
|
||||||
var asyncJobResponse = $t.data("asyncJobResponse");
|
var asyncJobResponse = $t.data("asyncJobResponse");
|
||||||
@ -109,7 +108,7 @@ function doAction(id, $t, apiCommand, listAPIMap) {
|
|||||||
//Sync job (begin) *****
|
//Sync job (begin) *****
|
||||||
else {
|
else {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command="+api+"&id="+id),
|
data: createURL(apiCommand),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user