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 -->
|
||||
<div id="dialog_attach_iso" title="Attach ISO" style="display:none">
|
||||
<p>
|
||||
Please specify the ISO you wish to attach to your Virtual Instance(s)
|
||||
</span></b>.</p>
|
||||
Please specify the ISO you wish to attach to your Virtual Instance(s).
|
||||
</p>
|
||||
<div class="dialog_formcontent">
|
||||
<form action="#" method="post" id="form_acquire">
|
||||
<ol>
|
||||
@ -613,3 +613,23 @@
|
||||
</form>
|
||||
</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 = {
|
||||
stopVirtualMachine: {
|
||||
label: "Stop Instance",
|
||||
"Stop Instance": {
|
||||
api: "stopVirtualMachine",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "stopvirtualmachineresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
startVirtualMachine: {
|
||||
label: "Start Instance",
|
||||
"Start Instance": {
|
||||
api: "startVirtualMachine",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "startvirtualmachineresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
rebootVirtualMachine: {
|
||||
label: "Reboot Instance",
|
||||
"Reboot Instance": {
|
||||
api: "rebootVirtualMachine",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "rebootvirtualmachineresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
destroyVirtualMachine: {
|
||||
label: "Destroy Instance",
|
||||
"Destroy Instance": {
|
||||
api: "destroyVirtualMachine",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "destroyvirtualmachineresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
recoverVirtualMachine: {
|
||||
label: "Restore Instance",
|
||||
"Restore Instance": {
|
||||
api: "recoverVirtualMachine",
|
||||
isAsyncJob: false,
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
attachIso: {
|
||||
label: "Attach ISO",
|
||||
"Attach ISO": {
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "attachisoresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm,
|
||||
dialogBeforeActionFn : doAttachISO
|
||||
asyncJobResponse: "attachisoresponse",
|
||||
dialogBeforeActionFn : doAttachISO,
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
detachIso: {
|
||||
label: "Detach ISO",
|
||||
"Detach ISO": {
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "detachisoresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm,
|
||||
dialogBeforeActionFn : doDetachISO
|
||||
}
|
||||
,
|
||||
resetPasswordForVirtualMachine: {
|
||||
label: "Reset Password",
|
||||
asyncJobResponse: "detachisoresponse",
|
||||
dialogBeforeActionFn : doDetachISO,
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
},
|
||||
"Reset Password": {
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "resetpasswordforvirtualmachineresponse",
|
||||
afterActionSeccessFn: function(){},
|
||||
dialogBeforeActionFn : doResetPassword
|
||||
asyncJobResponse: "resetpasswordforvirtualmachineresponse",
|
||||
dialogBeforeActionFn : doResetPassword,
|
||||
afterActionSeccessFn: function(){}
|
||||
},
|
||||
"Change Name": {
|
||||
isAsyncJob: false,
|
||||
dialogBeforeActionFn : doChangeName,
|
||||
afterActionSeccessFn: setMidmenuItemVm
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,6 +160,33 @@ function clickInstanceGroupHeader($arrowIcon) {
|
||||
}).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) {
|
||||
if(state == "Running")
|
||||
$rightPanelContent.find("#state").text(state).removeClass("red gray").addClass("green");
|
||||
@ -308,13 +336,13 @@ function clickInstanceGroupHeader($arrowIcon) {
|
||||
//action menu
|
||||
$("#action_link").show();
|
||||
$actionList.empty();
|
||||
for(var api in actionMap) {
|
||||
var apiInfo = actionMap[api];
|
||||
for(var label in actionMap) {
|
||||
var apiInfo = actionMap[label];
|
||||
var $listItem = $("#action_list_item").clone();
|
||||
$actionList.append($listItem.show());
|
||||
var $link = $listItem.find("#link").text(apiInfo.label);
|
||||
$link.data("api", api);
|
||||
$link.data("label", apiInfo.label);
|
||||
var $link = $listItem.find("#link").text(label);
|
||||
$link.data("label", label);
|
||||
$link.data("api", apiInfo.api);
|
||||
$link.data("isAsyncJob", apiInfo.isAsyncJob);
|
||||
$link.data("asyncJobResponse", apiInfo.asyncJobResponse);
|
||||
$link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn);
|
||||
@ -355,6 +383,12 @@ function clickInstanceGroupHeader($arrowIcon) {
|
||||
zIndex: 2000
|
||||
}));
|
||||
|
||||
activateDialog($("#dialog_change_name").dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
zIndex: 2000
|
||||
}));
|
||||
|
||||
//***** VM Wizard (begin) ******************************************************************************
|
||||
$vmPopup = $("#vm_popup");
|
||||
var $serviceOfferingTemplate = $("#vm_popup_service_offering_template");
|
||||
|
||||
@ -21,8 +21,7 @@
|
||||
// Version: @VERSION@
|
||||
|
||||
//var jobIdMap;
|
||||
function doAction(id, $t, apiCommand, listAPIMap) {
|
||||
var api = $t.data("api");
|
||||
function doAction(id, $t, apiCommand, listAPIMap) {
|
||||
var label = $t.data("label");
|
||||
var isAsyncJob = $t.data("isAsyncJob");
|
||||
var asyncJobResponse = $t.data("asyncJobResponse");
|
||||
@ -109,7 +108,7 @@ function doAction(id, $t, apiCommand, listAPIMap) {
|
||||
//Sync job (begin) *****
|
||||
else {
|
||||
$.ajax({
|
||||
data: createURL("command="+api+"&id="+id),
|
||||
data: createURL(apiCommand),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user