From ffa4ef7af3ed069107e48c89718246bf48c86ddd Mon Sep 17 00:00:00 2001
From: Jessica Wang
Date: Fri, 29 Oct 2010 10:38:56 -0700
Subject: [PATCH] new UI - instance page - routers tab - show confirm dialog
box before each action.
---
.../classes/resources/resource.properties | 8 +-
ui/new/jsp/instance.jsp | 18 ++++
ui/new/scripts/cloud.core2.instance.js | 85 ++++++++++++++++---
3 files changed, 98 insertions(+), 13 deletions(-)
diff --git a/client/WEB-INF/classes/resources/resource.properties b/client/WEB-INF/classes/resources/resource.properties
index 9b02e37071b..edbe01ab325 100644
--- a/client/WEB-INF/classes/resources/resource.properties
+++ b/client/WEB-INF/classes/resources/resource.properties
@@ -134,4 +134,10 @@ please.confirm.you.want.to.start.instance = Please confirm you want to start ins
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
\ No newline at end of file
+please.confirm.you.want.to.restore.instance = Please confirm you want to restore instance
+
+
+
+please.confirm.you.want.to.start.router = Please confirm you want to start router
+please.confirm.you.want.to.stop.router = Please confirm you want to stop router
+please.confirm.you.want.to.reboot.router = Please confirm you want to reboot router
\ No newline at end of file
diff --git a/ui/new/jsp/instance.jsp b/ui/new/jsp/instance.jsp
index e5dad5d3e43..0abbc1f97f8 100644
--- a/ui/new/jsp/instance.jsp
+++ b/ui/new/jsp/instance.jsp
@@ -1241,4 +1241,22 @@
+
+
+ <%=t.t("please.confirm.you.want.to.start.router")%>
+
+
+
+
+
+ <%=t.t("please.confirm.you.want.to.stop.router")%>
+
+
+
+
+
+ <%=t.t("please.confirm.you.want.to.reboot.router")%>
+
+
+
diff --git a/ui/new/scripts/cloud.core2.instance.js b/ui/new/scripts/cloud.core2.instance.js
index f9e6c5f799e..b16e53b1a7b 100644
--- a/ui/new/scripts/cloud.core2.instance.js
+++ b/ui/new/scripts/cloud.core2.instance.js
@@ -81,7 +81,10 @@ function afterLoadInstanceJSP() {
initDialog("dialog_confirmation_stop_vm");
initDialog("dialog_confirmation_reboot_vm");
initDialog("dialog_confirmation_destroy_vm");
- initDialog("dialog_confirmation_restore_vm");
+ initDialog("dialog_confirmation_restore_vm");
+ initDialog("dialog_confirmation_start_router");
+ initDialog("dialog_confirmation_stop_router");
+ initDialog("dialog_confirmation_reboot_router");
vmPopulateDropdown();
}
@@ -1743,7 +1746,7 @@ function doCreateTemplateFromVmVolume($actionLink, $subgridItem) {
//***** Routers tab (begin) ***************************************************************************************
-function routerAfterSubgridItemAction(json, id, $subgridItem) {
+function vmRouterAfterSubgridItemAction(json, id, $subgridItem) {
//var jsonObj = json.queryasyncjobresultresponse.router[0];
//vmRouterJSONToTemplate(jsonObj, $subgridItem);
@@ -1753,27 +1756,85 @@ function routerAfterSubgridItemAction(json, id, $subgridItem) {
vmJsonToRouterTab(vmObj);
}
-var vmRouterActionMap = {
- "Stop Router": {
- api: "stopRouter",
- isAsyncJob: true,
- asyncJobResponse: "stoprouterresponse",
- inProcessText: "Stopping Router....",
- afterActionSeccessFn: routerAfterSubgridItemAction
- },
+var vmRouterActionMap = {
"Start Router": {
api: "startRouter",
isAsyncJob: true,
asyncJobResponse: "startrouterresponse",
inProcessText: "Starting Router....",
- afterActionSeccessFn: routerAfterSubgridItemAction
+ dialogBeforeActionFn : doStartVmRouter,
+ afterActionSeccessFn: vmRouterAfterSubgridItemAction
+ },
+ "Stop Router": {
+ api: "stopRouter",
+ isAsyncJob: true,
+ asyncJobResponse: "stoprouterresponse",
+ inProcessText: "Stopping Router....",
+ dialogBeforeActionFn : doStopVmRouter,
+ afterActionSeccessFn: vmRouterAfterSubgridItemAction
},
"Reboot Router": {
api: "rebootRouter",
isAsyncJob: true,
asyncJobResponse: "rebootrouterresponse",
inProcessText: "Rebooting Router....",
- afterActionSeccessFn: routerAfterSubgridItemAction
+ dialogBeforeActionFn : doRebootVmRouter,
+ afterActionSeccessFn: vmRouterAfterSubgridItemAction
}
}
+
+function doStartVmRouter($actionLink, $subgridItem) {
+ $("#dialog_confirmation_start_router")
+ .dialog('option', 'buttons', {
+ "Confirm": function() {
+ $(this).dialog("close");
+
+ var jsonObj = $subgridItem.data("jsonObj");
+ var id = jsonObj.id;
+ var apiCommand = "command=startRouter&id="+id;
+ doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem);
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+
+ }
+ }).dialog("open");
+}
+
+function doStopVmRouter($actionLink, $subgridItem) {
+//function doStopRouter($actionLink, $detailsTab, $midmenuItem1) {
+ $("#dialog_confirmation_stop_router")
+ .dialog('option', 'buttons', {
+ "Confirm": function() {
+ $(this).dialog("close");
+
+ var jsonObj = $subgridItem.data("jsonObj");
+ var id = jsonObj.id;
+ var apiCommand = "command=stopRouter&id="+id;
+ doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem);
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+
+ }
+ }).dialog("open");
+}
+
+function doRebootVmRouter($actionLink, $subgridItem) {
+ $("#dialog_confirmation_reboot_router")
+ .dialog('option', 'buttons', {
+ "Confirm": function() {
+ $(this).dialog("close");
+
+ var jsonObj = $subgridItem.data("jsonObj");
+ var id = jsonObj.id;
+ var apiCommand = "command=rebootRouter&id="+id;
+ doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem);
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+
+ }
+ }).dialog("open");
+}
//***** Routers tab (end) ***************************************************************************************
\ No newline at end of file