bug 7151: cluster page - add "Add Host", "Add Primary Storage" option.

This commit is contained in:
Jessica Wang 2010-11-17 15:18:09 -08:00
parent d491490cde
commit 8c8188afec
3 changed files with 184 additions and 5 deletions

View File

@ -79,3 +79,162 @@
<!-- Details tab (end)-->
</div>
<!-- Add Host Dialog (begin) -->
<div id="dialog_add_host" title="Add Host" style="display: none">
<p>
Add a host for zone <b><span id="zone_name"></span></b>, pod <b><span id="pod_name">
</span></b>
</p>
<div class="dialog_formcontent">
<form action="#" method="post" id="form_acquire">
<ol>
<li>
<label for="host_hostname">
Host name:</label>
<input class="text" type="text" name="host_hostname" id="host_hostname" />
<div id="host_hostname_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label for="user_name">
User name:</label>
<input class="text" type="text" name="host_username" id="host_username" />
<div id="host_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label for="user_name">
Password:</label>
<input class="text" type="password" name="host_password" id="host_password" autocomplete="off" />
<div id="host_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="cluster_options_container">
<label>
&nbsp;</label><span><u>Cluster Options</u></span> </li>
<li id="new_cluster_radio_container">
<label>
<input type="radio" name="cluster" value="new_cluster_radio" checked />&nbsp;New
cluster:</label>
<input class="text" type="text" id="new_cluster_name" />
<div id="new_cluster_name_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="existing_cluster_radio_container">
<label>
<input type="radio" name="cluster" value="existing_cluster_radio" />&nbsp;Join cluster:</label>
<select class="select" id="cluster_select">
</select>
</li>
<li id="no_cluster_radio_container">
<label>
<input type="radio" name="cluster" value="no_cluster_radio" />&nbsp;Standalone</label>
<span style="padding-left: 20px"></span></li>
</ol>
</form>
</div>
<!--Loading box-->
<div id="spinning_wheel" class="ui_dialog_loaderbox" style="display: none;">
<div class="ui_dialog_loader">
</div>
<p>
Adding....</p>
</div>
<!--Confirmation msg box-->
<!--Note: for error msg, just have to add error besides everything for eg. add error(class) next to ui_dialog_messagebox error, ui_dialog_msgicon error, ui_dialog_messagebox_text error. -->
<div id="info_container" class="ui_dialog_messagebox error" style="display: none;">
<div id="icon" class="ui_dialog_msgicon error">
</div>
<div id="info" class="ui_dialog_messagebox_text error">
(info)</div>
</div>
</div>
<!-- Add Host Dialog (end) -->
<!-- Add Primary Storage Dialog (begin) -->
<div id="dialog_add_pool" title="Add Primary Storage" style="display: none">
<p>
Add a new Primary Storage for zone <b><span id="zone_name"></span></b>, pod <b><span
id="pod_name"></span></b>
</p>
<div class="dialog_formcontent">
<form action="#" method="post" id="form_acquire">
<ol>
<li id="pool_cluster_container">
<label for="pool_cluster">
Cluster:</label>
<select class="select" id="pool_cluster">
</select>
<div id="pool_cluster_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label for="user_name">
Name:</label>
<input class="text" type="text" name="add_pool_name" id="add_pool_name" />
<div id="add_pool_name_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label for="add_pool_protocol">
Protocol:</label>
<select class="select" id="add_pool_protocol">
<option value="nfs">NFS</option>
<option value="iscsi">ISCSI</option>
</select>
</li>
<li>
<label for="add_pool_nfs_server">
Server:</label>
<input class="text" type="text" name="add_pool_nfs_server" id="add_pool_nfs_server" />
<div id="add_pool_nfs_server_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_path_container">
<label for="add_pool_path">
Path:</label>
<input class="text" type="text" name="add_pool_path" id="add_pool_path" />
<div id="add_pool_path_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_iqn_container" style="display: none">
<label for="add_pool_iqn">
Target IQN:</label>
<input class="text" type="text" name="add_pool_iqn" id="add_pool_iqn" />
<div id="add_pool_iqn_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_lun_container" style="display: none">
<label for="add_pool_lun">
LUN #:</label>
<input class="text" type="text" name="add_pool_lun" id="add_pool_lun" />
<div id="add_pool_lun_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li id="add_pool_tags_container">
<label for="add_pool_tags">
Tags:</label>
<input class="text" type="text" id="add_pool_tags" />
<div id="add_pool_tags_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
</ol>
</form>
</div>
<!--Loading box-->
<div id="spinning_wheel" class="ui_dialog_loaderbox" style="display: none;">
<div class="ui_dialog_loader">
</div>
<p>
Adding....</p>
</div>
<!--Confirmation msg box-->
<!--Note: for error msg, just have to add error besides everything for eg. add error(class) next to ui_dialog_messagebox error, ui_dialog_msgicon error, ui_dialog_messagebox_text error. -->
<div id="info_container" class="ui_dialog_messagebox error" style="display: none;">
<div id="icon" class="ui_dialog_msgicon error">
</div>
<div id="info" class="ui_dialog_messagebox_text error">
(info)</div>
</div>
</div>
<!-- Add Primary Storage Dialog (end) -->

View File

@ -19,9 +19,17 @@
function afterLoadClusterJSP($midmenuItem1) {
showMiddleMenu();
$("#midmenu_add_link").unbind("click").hide();
$("#midmenu_add2_link").unbind("click").hide();
$("#midmenu_add3_link").unbind("click").hide();
//$("#midmenu_add_link").unbind("click").hide();
//$("#midmenu_add2_link").unbind("click").hide();
//???
initAddHostButton($("#midmenu_add_link"), "cluster_page");
initAddPrimaryStorageButton($("#midmenu_add2_link"), "cluster_page");
$("#midmenu_add3_link").unbind("click").hide();
initDialog("dialog_add_host");
initDialog("dialog_add_pool");
//???
clusterJsonToRightPanel($midmenuItem1);
var clusterId = $midmenuItem1.data("jsonObj").id;

View File

@ -255,7 +255,7 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
dialogAddHost = $("#dialog_add_host");
dialogAddHost.find("#info_container").hide();
dialogAddHost.find("#new_cluster_name").val("");
var zoneId, podId, clusterId;
if(currentPageInRightPanel == "pod_page") {
var podObj = $("#tab_content_details").data("jsonObj");
@ -264,6 +264,12 @@ function initAddHostButton($midmenuAddLink1, currentPageInRightPanel) {
dialogAddHost.find("#zone_name").text(fromdb(podObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(podObj.name));
}
else if(currentPageInRightPanel == "cluster_page") {
var clusterObj = $("#tab_content_details").data("jsonObj");
zoneId = clusterObj.zoneid;
podId = clusterObj.podid;
clusterId = clusterObj.id;
}
else if(currentPageInRightPanel == "host_page") {
var hostObj = $("#tab_content_details").data("jsonObj");
zoneId = hostObj.zoneid;
@ -407,7 +413,13 @@ function initAddPrimaryStorageButton($midmenuAddLink2, currentPageInRightPanel)
podId = podObj.id;
dialogAddPool.find("#zone_name").text(fromdb(podObj.zonename));
dialogAddPool.find("#pod_name").text(fromdb(podObj.name));
}
}
else if(currentPageInRightPanel == "cluster_page") {
var clusterObj = $("#tab_content_details").data("jsonObj");
zoneId = clusterObj.zoneid;
podId = clusterObj.podid;
sourceClusterId = clusterObj.id;
}
else if(currentPageInRightPanel == "host_page") {
var hostObj = $("#tab_content_details").data("jsonObj");
zoneId = hostObj.zoneid;