From 5810e809da2e11eb0ae700af371e3e570a51bb51 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 14 Jan 2011 14:24:04 -0800 Subject: [PATCH] Template page - make Delete Template available as long as the template is not in downloaded status. --- ui/scripts/cloud.core.template.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ui/scripts/cloud.core.template.js b/ui/scripts/cloud.core.template.js index dfa9925b916..90d8ca31895 100644 --- a/ui/scripts/cloud.core.template.js +++ b/ui/scripts/cloud.core.template.js @@ -345,16 +345,26 @@ function templateJsonToDetailsTab() { noAvailableActions = false; } - // "Download Template", "Delete Template" + // "Download Template" if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) || (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") { //do nothing } else { - buildActionLinkForTab("Download Template", templateActionMap, $actionMenu, $midmenuItem1, $thisTab); - buildActionLinkForTab("Delete Template", templateActionMap, $actionMenu, $midmenuItem1, $thisTab); + buildActionLinkForTab("Download Template", templateActionMap, $actionMenu, $midmenuItem1, $thisTab); noAvailableActions = false; } + + // "Delete Template" + if (((isUser() && jsonObj.ispublic == true && !(jsonObj.domainid == g_domainid && jsonObj.account == g_account))) + || (jsonObj.isready == false && jsonObj.status != null && jsonObj.status.indexOf("Downloaded") != -1) + || jsonObj.templatetype == "SYSTEM") { + //do nothing + } + else { + buildActionLinkForTab("Delete Template", templateActionMap, $actionMenu, $midmenuItem1, $thisTab); + noAvailableActions = false; + } // no available actions if(noAvailableActions == true) {