From b7daa55a7941869a2a9cd0aefad3e958fc0b3518 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 24 Jan 2011 10:25:08 -0800 Subject: [PATCH] cluster page - pop up confirmation dialog before execute Delete Cluster action. --- ui/scripts/cloud.core.cluster.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ui/scripts/cloud.core.cluster.js b/ui/scripts/cloud.core.cluster.js index 090672fa6ed..19027d12cd4 100644 --- a/ui/scripts/cloud.core.cluster.js +++ b/ui/scripts/cloud.core.cluster.js @@ -91,6 +91,8 @@ function clusterClearDetailsTab() { $thisTab.find("#name").text(""); $thisTab.find("#zonename").text(""); $thisTab.find("#podname").text(""); + $thisTab.find("#hypervisortype").text(""); + $thisTab.find("#clustertype").text(""); //actions *** var $actionMenu = $thisTab.find("#action_link #action_menu"); @@ -101,7 +103,8 @@ function clusterClearDetailsTab() { var clusterActionMap = { "Delete Cluster": { api: "deleteCluster", - isAsyncJob: false, + isAsyncJob: false, + dialogBeforeActionFn : doDeleteCluster, inProcessText: "Deleting Cluster....", afterActionSeccessFn: function(json, $midmenuItem1, id) { $midmenuItem1.slideUp("slow", function() { @@ -114,3 +117,21 @@ var clusterActionMap = { } } } + +function doDeleteCluster($actionLink, $detailsTab, $midmenuItem1) { + var jsonObj = $midmenuItem1.data("jsonObj"); + var id = jsonObj.id; + + $("#dialog_confirmation") + .text("Please confirm you want to delete this cluster") + .dialog('option', 'buttons', { + "Confirm": function() { + $(this).dialog("close"); + var apiCommand = "command=deleteCluster&id="+id; + doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); +} \ No newline at end of file