new UI - multiple-selection action - confirm before start VM.

This commit is contained in:
Jessica Wang 2010-10-26 17:54:54 -07:00
parent 90f10cded7
commit 2e3a9d2dad
3 changed files with 79 additions and 25 deletions

View File

@ -129,4 +129,9 @@ please.confirm.you.want.to.force.a.reconnection.for.the.host = Please confirm yo
please.confirm.you.want.to.remove.the.host.from.the.management.server = Please confirm you want to remove the host from the management server
Please.choose.a.OS.preference.for.this.host..Virtual.machines.will.always.be.allocated.to.hosts.with.an.OS.preference.that.matches.with.the.OS.type.of.the.template.chosen.for.the.virtual.machine.before.choosing.other.hosts. = Please choose a OS preference for this host. Virtual machines will always be allocated to hosts with an OS preference that matches with the OS type of the template chosen for the virtual machine before choosing other hosts.
please.confirm.you.want.to.delete.the.primary.storage = Please confirm you want to delete the primary storage
please.confirm.you.want.to.delete.the.secondary.storage = Please confirm you want to delete the secondary storage
please.confirm.you.want.to.delete.the.secondary.storage = Please confirm you want to delete the secondary storage
please.confirm.you.want.to.start.instance = Please confirm you want to start instance
please.confirm.you.want.to.stop.instance = Please confirm you want to stop instance
please.confirm.you.want.to.reboot.instance = Please confirm you want to reboot instance
please.confirm.you.want.to.destroy.instance = Please confirm you want to destroy instance
please.confirm.you.want.to.restore.instance = Please confirm you want to restore instance

View File

@ -1118,4 +1118,35 @@
<%=t.t("please.confirm.you.want.to.disable.HA.for.the.virtual.machine.once.HA.is.disabled.the.virtual.machine.will.no.longer.be.automatically.restarted.in.the.event.of.a.failure")%>
</p>
</div>
<div id="dialog_confirmation_start_vm" title="Confirmation" style="display:none">
<p>
<%=t.t("please.confirm.you.want.to.start.instance")%>
</p>
</div>
<div id="dialog_confirmation_stop_vm" title="Confirmation" style="display:none">
<p>
<%=t.t("please.confirm.you.want.to.stop.instance")%>
</p>
</div>
<div id="dialog_confirmation_reboot_vm" title="Confirmation" style="display:none">
<p>
<%=t.t("please.confirm.you.want.to.reboot.instance")%>
</p>
</div>
<div id="dialog_confirmation_destroy_vm" title="Confirmation" style="display:none">
<p>
<%=t.t("please.confirm.you.want.to.destroy.instance")%>
</p>
</div>
<div id="dialog_confirmation_restore_vm" title="Confirmation" style="display:none">
<p>
<%=t.t("please.confirm.you.want.to.restore.instance")%>
</p>
</div>
<!-- ***** Dialogs (end) ***** -->

View File

@ -75,27 +75,40 @@ function afterLoadInstanceJSP() {
$("#dialog_info_please_select_one_item_in_middle_menu").dialog("open");
return false;
}
for(var id in selectedItemsInMidMenu) {
var apiCommand = "command=startVirtualMachine&id="+id;
var apiInfo = {
label: "Start Instance",
isAsyncJob: true,
asyncJobResponse: "startvirtualmachineresponse",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
var jsonObj = json.queryasyncjobresultresponse.jobresult.startvirtualmachineresponse;
vmToMidmenu(jsonObj, $midmenuItem1);
if( ($("#right_panel_content #tab_content_details").length > 0)
&& ($("#right_panel_content #tab_content_details").data("jsonObj") != null )
&& (jsonObj.id == $("#right_panel_content #tab_content_details").data("jsonObj").id))
vmToRightPanel($midmenuItem1);
}
}
doActionForMidMenu(id, apiInfo, apiCommand);
}
selectedItemsInMidMenu = {}; //clear selected items for action
$("#dialog_confirmation_start_vm")
.dialog('option', 'buttons', {
"Confirm": function() {
$(this).dialog("close");
var apiInfo = {
label: "Start Instance",
isAsyncJob: true,
asyncJobResponse: "startvirtualmachineresponse",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
var jsonObj = json.queryasyncjobresultresponse.jobresult.startvirtualmachineresponse;
vmToMidmenu(jsonObj, $midmenuItem1);
if( ($("#right_panel_content #tab_content_details").length > 0)
&& ($("#right_panel_content #tab_content_details").data("jsonObj") != null )
&& (jsonObj.id == $("#right_panel_content #tab_content_details").data("jsonObj").id))
vmToRightPanel($midmenuItem1);
}
}
for(var id in selectedItemsInMidMenu) {
var apiCommand = "command=startVirtualMachine&id="+id;
doActionForMidMenu(id, apiInfo, apiCommand);
}
selectedItemsInMidMenu = {}; //clear selected items for action
},
"Cancel": function() {
$(this).dialog("close");
}
}).dialog("open");
return false;
});
@ -116,7 +129,7 @@ function afterLoadInstanceJSP() {
var apiInfo = {
label: "Stop Instance",
isAsyncJob: true,
asyncJobResponse: "stopvirtualmachineresponse",
asyncJobResponse: "stopvirtualmachineresponse",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
//call listVirtualMachine to get embedded object until bug 6486 ("StopVirtualMachine API should return an embedded object on success") is fixed.
var jsonObj;
@ -160,7 +173,7 @@ function afterLoadInstanceJSP() {
var apiInfo = {
label: "Reboot Instance",
isAsyncJob: true,
asyncJobResponse: "rebootvirtualmachineresponse",
asyncJobResponse: "rebootvirtualmachineresponse",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
//call listVirtualMachine to get embedded object until Bug 6751("rebootVirtualMachine API should return an embedded object") is fixed.
var jsonObj;
@ -204,7 +217,7 @@ function afterLoadInstanceJSP() {
var apiInfo = {
label: "Destroy Instance",
isAsyncJob: true,
asyncJobResponse: "destroyvirtualmachineresponse",
asyncJobResponse: "destroyvirtualmachineresponse",
afterActionSeccessFn: function(json, $midmenuItem1, id) {
//call listVirtualMachine to get embedded object until bug 6041 ("DestroyVirtualMachine API should return an embedded object on success") is fixed.
var jsonObj;
@ -249,6 +262,11 @@ function afterLoadInstanceJSP() {
initDialog("dialog_confirmation_enable_ha");
initDialog("dialog_confirmation_disable_ha");
initDialog("dialog_create_template", 400);
initDialog("dialog_confirmation_start_vm");
initDialog("dialog_confirmation_stop_vm");
initDialog("dialog_confirmation_reboot_vm");
initDialog("dialog_confirmation_destroy_vm");
initDialog("dialog_confirmation_restore_vm");
$.ajax({
data: createURL("command=listOsTypes&response=json"),