From ec6aa13c74dfbd100ad6d75e145a8b8741dd9bed Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 4 Feb 2011 15:01:43 -0800 Subject: [PATCH] Add Primary Storage dialog - When protocol is PreSetup, compose URL as "presetup://~~~~~~~". --- ui/scripts/cloud.core.pod.js | 19 +++++++++++++++++-- ui/scripts/cloud.core.resource.js | 8 +++++++- ui/scripts/cloud.core.zone.js | 8 +++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/ui/scripts/cloud.core.pod.js b/ui/scripts/cloud.core.pod.js index 9f7124516f0..697a578c222 100644 --- a/ui/scripts/cloud.core.pod.js +++ b/ui/scripts/cloud.core.pod.js @@ -726,12 +726,18 @@ function bindAddPrimaryStorageButton($leftmenuItem1) { var server = trim($thisDialog.find("#add_pool_nfs_server").val()); var url = null; - if (protocol == "nfs" || protocol == "PreSetup") { + if (protocol == "nfs") { var path = trim($thisDialog.find("#add_pool_path").val()); if(path.substring(0,1)!="/") path = "/" + path; url = nfsURL(server, path); - } + } + else if (protocol == "PreSetup") { + var path = trim($thisDialog.find("#add_pool_path").val()); + if(path.substring(0,1)!="/") + path = "/" + path; + url = presetupURL(server, path); + } else if (protocol == "sharedMountPoint") { var path = trim($thisDialog.find("#add_pool_path").val()); if(path.substring(0,1)!="/") @@ -877,6 +883,15 @@ function nfsURL(server, path) { return url; } +function presetupURL(server, path) { + var url; + if(server.indexOf("://")==-1) + url = "presetup://" + server + path; + else + url = server + path; + return url; +} + function sharedMountPointURL(server, path) { var url; if(server.indexOf("://")==-1) diff --git a/ui/scripts/cloud.core.resource.js b/ui/scripts/cloud.core.resource.js index 03d89d115b4..098a76078e6 100644 --- a/ui/scripts/cloud.core.resource.js +++ b/ui/scripts/cloud.core.resource.js @@ -1783,12 +1783,18 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel var server = trim($thisDialog.find("#add_pool_nfs_server").val()); var url = null; - if (protocol == "nfs" || protocol == "PreSetup") { + if (protocol == "nfs") { var path = trim($thisDialog.find("#add_pool_path").val()); if(path.substring(0,1)!="/") path = "/" + path; url = nfsURL(server, path); } + else if (protocol == "PreSetup") { + var path = trim($thisDialog.find("#add_pool_path").val()); + if(path.substring(0,1)!="/") + path = "/" + path; + url = presetupURL(server, path); + } else if (protocol == "sharedMountPoint") { var path = trim($thisDialog.find("#add_pool_path").val()); if(path.substring(0,1)!="/") diff --git a/ui/scripts/cloud.core.zone.js b/ui/scripts/cloud.core.zone.js index 549cc43ea64..f04356ff2ca 100644 --- a/ui/scripts/cloud.core.zone.js +++ b/ui/scripts/cloud.core.zone.js @@ -943,12 +943,18 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) { var server = trim($thisDialog.find("#add_pool_nfs_server").val()); var url = null; - if (protocol == "nfs" || protocol == "PreSetup") { + if (protocol == "nfs") { var path = trim($thisDialog.find("#add_pool_path").val()); if(path.substring(0,1)!="/") path = "/" + path; url = nfsURL(server, path); } + else if (protocol == "PreSetup") { + var path = trim($thisDialog.find("#add_pool_path").val()); + if(path.substring(0,1)!="/") + path = "/" + path; + url = presetupURL(server, path); + } else if (protocol == "sharedMountPoint") { var path = trim($thisDialog.find("#add_pool_path").val()); if(path.substring(0,1)!="/")