From 9d7a2da5d8b4ea79d2b55ba12a14b0e567d175eb Mon Sep 17 00:00:00 2001
From: Jessica Wang
Date: Mon, 18 Oct 2010 16:45:37 -0700
Subject: [PATCH] new UI - implement Cancel Maintenance Mode.
---
.../classes/resources/resource.properties | 2 +-
ui/new/jsp/resource.jsp | 6 +++
ui/new/scripts/cloud.core2.resource.js | 46 +++++++++++++++----
3 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/client/WEB-INF/classes/resources/resource.properties b/client/WEB-INF/classes/resources/resource.properties
index 5ff959f979c..0bc210b955a 100644
--- a/client/WEB-INF/classes/resources/resource.properties
+++ b/client/WEB-INF/classes/resources/resource.properties
@@ -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
diff --git a/ui/new/jsp/resource.jsp b/ui/new/jsp/resource.jsp
index ce2cc2e6091..e113a4b2a29 100644
--- a/ui/new/jsp/resource.jsp
+++ b/ui/new/jsp/resource.jsp
@@ -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")%>
+
+
+
+ <%=t.t("please.confirm.you.want.to.cancel.maintenance.for.the.host")%>
+
+
diff --git a/ui/new/scripts/cloud.core2.resource.js b/ui/new/scripts/cloud.core2.resource.js
index e9f21a2ab4b..c2f2e8bc3be 100644
--- a/ui/new/scripts/cloud.core2.resource.js
+++ b/ui/new/scripts/cloud.core2.resource.js
@@ -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");
}
\ No newline at end of file