Add Primary Storage dialog - When protocol is PreSetup, compose URL as "presetup://~~~~~~~".

This commit is contained in:
Jessica Wang 2011-02-04 15:01:43 -08:00
parent 41a1e2cd9e
commit ec6aa13c74
3 changed files with 31 additions and 4 deletions

View File

@ -726,12 +726,18 @@ function bindAddPrimaryStorageButton($leftmenuItem1) {
var server = trim($thisDialog.find("#add_pool_nfs_server").val()); var server = trim($thisDialog.find("#add_pool_nfs_server").val());
var url = null; var url = null;
if (protocol == "nfs" || protocol == "PreSetup") { if (protocol == "nfs") {
var path = trim($thisDialog.find("#add_pool_path").val()); var path = trim($thisDialog.find("#add_pool_path").val());
if(path.substring(0,1)!="/") if(path.substring(0,1)!="/")
path = "/" + path; path = "/" + path;
url = nfsURL(server, 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") { else if (protocol == "sharedMountPoint") {
var path = trim($thisDialog.find("#add_pool_path").val()); var path = trim($thisDialog.find("#add_pool_path").val());
if(path.substring(0,1)!="/") if(path.substring(0,1)!="/")
@ -877,6 +883,15 @@ function nfsURL(server, path) {
return url; 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) { function sharedMountPointURL(server, path) {
var url; var url;
if(server.indexOf("://")==-1) if(server.indexOf("://")==-1)

View File

@ -1783,12 +1783,18 @@ function initAddPrimaryStorageShortcut($midmenuAddLink2, currentPageInRightPanel
var server = trim($thisDialog.find("#add_pool_nfs_server").val()); var server = trim($thisDialog.find("#add_pool_nfs_server").val());
var url = null; var url = null;
if (protocol == "nfs" || protocol == "PreSetup") { if (protocol == "nfs") {
var path = trim($thisDialog.find("#add_pool_path").val()); var path = trim($thisDialog.find("#add_pool_path").val());
if(path.substring(0,1)!="/") if(path.substring(0,1)!="/")
path = "/" + path; path = "/" + path;
url = nfsURL(server, 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") { else if (protocol == "sharedMountPoint") {
var path = trim($thisDialog.find("#add_pool_path").val()); var path = trim($thisDialog.find("#add_pool_path").val());
if(path.substring(0,1)!="/") if(path.substring(0,1)!="/")

View File

@ -943,12 +943,18 @@ function bindAddPrimaryStorageButtonOnZonePage($button, zoneId, zoneName) {
var server = trim($thisDialog.find("#add_pool_nfs_server").val()); var server = trim($thisDialog.find("#add_pool_nfs_server").val());
var url = null; var url = null;
if (protocol == "nfs" || protocol == "PreSetup") { if (protocol == "nfs") {
var path = trim($thisDialog.find("#add_pool_path").val()); var path = trim($thisDialog.find("#add_pool_path").val());
if(path.substring(0,1)!="/") if(path.substring(0,1)!="/")
path = "/" + path; path = "/" + path;
url = nfsURL(server, 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") { else if (protocol == "sharedMountPoint") {
var path = trim($thisDialog.find("#add_pool_path").val()); var path = trim($thisDialog.find("#add_pool_path").val());
if(path.substring(0,1)!="/") if(path.substring(0,1)!="/")