new UI - implement Cancel Maintenance Mode.

This commit is contained in:
Jessica Wang 2010-10-18 16:45:37 -07:00
parent c67c618d44
commit 9d7a2da5d8
3 changed files with 43 additions and 11 deletions

View File

@ -122,4 +122,4 @@ please.select.an.available.zone.to.associate.your.new.ip.with..acquiring.additio
please.confirm.you.want.to.release.this.IP.address = Please confirm you want to release this IP address
please.restart.your.management.server.for.your.new.settings.to.take.effect = Please RESTART your management server for your new settings to take effect
enabling.maintenance.mode.will.cause.a.live.migration.of.all.running.instances.on.this.host.to.any.available.host = Enabling maintenance mode will cause a live migration of all running instances on this host to any available host.
please.confirm.you.want.to.cancel.maintenance.for.the.host = Please confirm you want to cancel maintenance for the host

View File

@ -1089,3 +1089,9 @@
<%=t.t("enabling.maintenance.mode.will.cause.a.live.migration.of.all.running.instances.on.this.host.to.any.available.host")%>
</p>
</div>
<div id="dialog_confirmation_cancel_maintenance" title="Confirmation" style="display: none">
<p>
<%=t.t("please.confirm.you.want.to.cancel.maintenance.for.the.host")%>
</p>
</div>

View File

@ -400,6 +400,12 @@ function hostJsonToDetailsTab(jsonObj) {
//build action Remove Host
}
else if(jsonObj.state == "Alert") {
//temporary for testing (begin) *****
buildActionLinkForDetailsTab("Enable Maintenance Mode", hostActionMap, $actionMenu, midmenuItemId, $detailsTab); //when right panel has more than 1 details tab, we need to specify which one it is building action to.
buildActionLinkForDetailsTab("Cancel Maintenance Mode", hostActionMap, $actionMenu, midmenuItemId, $detailsTab); //when right panel has more than 1 details tab, we need to specify which one it is building action to.
//temporary for testing (begin) *****
//build action Update OS Preference
}
else if (jsonObj.state == "ErrorInMaintenance") {
@ -705,6 +711,7 @@ function afterLoadResourceJSP() {
initDialog("dialog_add_secondarystorage");
initDialog("dialog_add_vlan_for_zone");
initDialog("dialog_confirmation_enable_maintenance");
initDialog("dialog_confirmation_cancel_maintenance");
// if hypervisor is KVM, limit the server option to NFS for now
if (getHypervisorType() == 'kvm')
@ -1231,18 +1238,20 @@ var hostActionMap = {
dialogBeforeActionFn : doEnableMaintenanceMode,
inProcessText: "Enabling Maintenance Mode....",
afterActionSeccessFn: function(json, id, midmenuItemId) {
// Host status is likely to change at this point. So, refresh the row now.
$.ajax({
data: createURL("command=listHosts&id="+hostId),
dataType: "json",
success: function(json) {
hostJsonToDetailsTab(json.listhostsresponse.host[0], $("#right_panel_content #host_page #tab_content_details"));
}
});
hostJsonToDetailsTab(json.queryasyncjobresultresponse.host[0], $("#right_panel_content #host_page #tab_content_details"));
$("#right_panel_content #after_action_info").text("We are actively enabling maintenance on your host. Please refresh periodically for an updated status.");
}
}
},
"Cancel Maintenance Mode": {
isAsyncJob: true,
asyncJobResponse: "cancelhostmaintenanceresponse",
dialogBeforeActionFn : doCancelMaintenanceMode,
inProcessText: "Cancelling Maintenance Mode....",
afterActionSeccessFn: function(json, id, midmenuItemId) {
hostJsonToDetailsTab(json.queryasyncjobresultresponse.host[0], $("#right_panel_content #host_page #tab_content_details"));
$("#right_panel_content #after_action_info").text("We are actively cancelling your scheduled maintenance. Please refresh periodically for an updated status.");
}
}
}
function doEnableMaintenanceMode($actionLink, $detailsTab, midmenuItemId){
@ -1260,4 +1269,21 @@ function doEnableMaintenanceMode($actionLink, $detailsTab, midmenuItemId){
$(this).dialog("close");
}
}).dialog("open");
}
function doCancelMaintenanceMode($actionLink, $detailsTab, midmenuItemId){
var jsonObj = $detailsTab.data("jsonObj");
$("#dialog_confirmation_cancel_maintenance")
.dialog("option", "buttons", {
"OK": function() {
$(this).dialog("close");
var id = jsonObj.id;
var apiCommand = "command=cancelHostMaintenance&id="+id;
doActionToDetailsTab(id, $actionLink, apiCommand, midmenuItemId);
},
"Cancel": function() {
$(this).dialog("close");
}
}).dialog("open");
}