physical resource - (1) always show host node and storage node even the cluster doesn't have any host/storage. (2) host page - remove Add Primary Storage option. (3) Primary Storage page - remove Add Host option.

This commit is contained in:
Jessica Wang 2010-12-30 13:13:44 -08:00
parent 283acbdd06
commit 1e6c16e294
8 changed files with 16 additions and 353 deletions

View File

@ -841,14 +841,14 @@
<div id="cluster_header" class="leftmenu_content">
<div class="leftmenu_fifthindent">
<div class="leftmenu_arrowloader" id="cluster_loading_container" style="display:none;"></div>
<div class="leftmenu_arrows white_nonexpanded_close" id="cluster_arrow">
<div class="leftmenu_arrows expanded_close" id="cluster_arrow">
</div>
<span id="cluster_name_label"><fmt:message key="label.cluster"/>: </span>
<span id="cluster_name"></span>
</div>
</div>
<div id="cluster_content" style="display: none">
<div class="leftmenu_expandedlist" id="leftmenu_host_node_template" style="display:none">
<div class="leftmenu_expandedlist" id="leftmenu_host_node_template">
<div id="host_header" class="leftmenu_content">
<div class="leftmenu_sixthindent">
<div class="leftmenu_arrowloader" id="host_loading_container" style="display:none;"></div>
@ -858,7 +858,7 @@
</div>
</div>
</div>
<div class="leftmenu_expandedlist" id="leftmenu_primarystorage_node_template" style="display:none">
<div class="leftmenu_expandedlist" id="leftmenu_primarystorage_node_template">
<div id="primarystorage_header" class="leftmenu_content">
<div class="leftmenu_sixthindent">
<div class="leftmenu_arrowloader" id="primarystorage_loading_container" style="display:none;"></div>

View File

@ -356,16 +356,7 @@
Add Host
</div>
</div>
</div>
<div class="actionpanel_button_wrapper" id="add_primarystorage_button">
<div class="actionpanel_button">
<div class="actionpanel_button_icons">
<img src="images/addvm_actionicon.png" alt="Add Primary Storage" /></div>
<div class="actionpanel_button_links">
Add Primary Storage
</div>
</div>
</div>
</div>
</div>
<!-- top buttons (end) -->
@ -937,107 +928,7 @@
(info)</div>
</div>
</div>
<!-- Add Primary Storage Dialog -->
<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>
<option value="vmfs">VMFS</option>
</select>
</li>
<li id="add_pool_server_container">
<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" input_group="nfs">
<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" input_group="iscsi">
<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" input_group="iscsi">
<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 input_group="vmfs">
<label for="add_pool_vmfs_dc">
vCenter Datacenter:</label>
<input class="text" type="text" name="add_pool_vmfs_dc" id="add_pool_vmfs_dc" />
<div id="add_pool_vmfs_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmfs">
<label for="add_pool_vmfs_ds">
vCenter Datastore:</label>
<input class="text" type="text" name="add_pool_vmfs_ds" id="add_pool_vmfs_ds" />
<div id="add_pool_vmfs_ds_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>
<!-- dialogs -->
<div id="dialog_confirmation_enable_maintenance" title="Confirmation" style="display: none">
<p>

View File

@ -187,16 +187,7 @@
</div>
<!-- top buttons (begin) -->
<div id="top_buttons">
<div class="actionpanel_button_wrapper" id="add_host_button">
<div class="actionpanel_button">
<div class="actionpanel_button_icons">
<img src="images/addvm_actionicon.png" alt="Add Host" /></div>
<div class="actionpanel_button_links">
Add Host
</div>
</div>
</div>
<div id="top_buttons">
<div class="actionpanel_button_wrapper" id="add_primarystorage_button">
<div class="actionpanel_button">
<div class="actionpanel_button_icons">
@ -209,120 +200,6 @@
</div>
<!-- top buttons (end) -->
<!-- Add Host Dialog -->
<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_hypervisor">Hypervisor:</label>
<select class="select" id="host_hypervisor">
<option value="XenServer" SELECTED>Xen Server</option>
<option value="KVM">KVM</option>
<option value="VmWare">VMware</option>
</select>
</li>
<li input_group="general">
<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 input_group="general">
<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 input_group="general">
<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 input_group="vmware">
<label for="host_vcenter_address">
vCenter Address:</label>
<input class="text" type="text" name="host_vcenter_address" id="host_vcenter_address" />
<div id="host_vcenter_address_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_username">
vCenter User:</label>
<input class="text" type="text" name="host_vcenter_username" id="host_vcenter_username" />
<div id="host_vcenter_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_password">
vCenter Password:</label>
<input class="text" type="password" name="host_vcenter_password" id="host_vcenter_password" autocomplete="off" />
<div id="host_vcenter_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_dc">
vCenter Datacenter:</label>
<input class="text" type="text" name="host_vcenter_dc" id="host_vcenter_dc" />
<div id="host_vcenter_dc_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="vmware">
<label for="host_vcenter_host">
vCenter Host:</label>
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
<div id="host_vcenter_host_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 Primary Storage Dialog -->
<div id="dialog_add_pool" title="Add Primary Storage" style="display: none">
<p>

View File

@ -17,6 +17,7 @@
*/
function afterLoadClusterJSP($midmenuItem1) {
hideMiddleMenu();
initDialog("dialog_add_host");
initDialog("dialog_add_pool");
}

View File

@ -73,9 +73,7 @@ function hostToRightPanel($midmenuItem1) {
}
function afterLoadHostJSP() {
initDialog("dialog_add_host");
initDialog("dialog_add_pool");
bindEventHandlerToDialogAddPool($("#dialog_add_pool"));
initDialog("dialog_add_host");
initDialog("dialog_confirmation_enable_maintenance");
initDialog("dialog_confirmation_cancel_maintenance");
initDialog("dialog_confirmation_force_reconnect");
@ -98,8 +96,7 @@ function hostJsonToDetailsTab() {
if(jsonObj == null)
return;
bindAddHostButton($midmenuItem1);
bindAddPrimaryStorageButton($midmenuItem1);
bindAddHostButton($midmenuItem1);
$.ajax({
data: createURL("command=listHosts&id="+jsonObj.id),

View File

@ -771,7 +771,7 @@ function bindAddPrimaryStorageButton($leftmenuItem1) {
$clusterArrow.click();
}
$("#cluster_"+clusterId+"_primarystorage").show().click();
$("#cluster_"+clusterId+"_primarystorage").click();
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {

View File

@ -67,16 +67,10 @@ function primarystorageToMidmenu(jsonObj, $midmenuItem1) {
function primarystorageToRightPanel($midmenuItem1) {
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
primarystorageJsonToDetailsTab();
/*
copyActionInfoFromMidMenuToRightPanel($midmenuItem1);
resourceLoadPage("jsp/primarystorage.jsp", $midmenuItem1); //after reloading "jsp/primarystorage.jsp", afterLoadPrimaryStorageJSP() will be called.
*/
primarystorageJsonToDetailsTab();
}
function afterLoadPrimaryStorageJSP($midmenuItem1) {
initDialog("dialog_add_host");
function afterLoadPrimaryStorageJSP($midmenuItem1) {
initDialog("dialog_add_pool");
bindEventHandlerToDialogAddPool($("#dialog_add_pool"));
initDialog("dialog_confirmation_delete_primarystorage");
@ -90,8 +84,7 @@ function primarystorageJsonToDetailsTab() {
var jsonObj = $midmenuItem1.data("jsonObj");
if(jsonObj == null)
return;
bindAddHostButton($midmenuItem1);
bindAddPrimaryStorageButton($midmenuItem1);
$.ajax({

View File

@ -241,31 +241,7 @@ function buildZoneTree() {
var $clusterArrow = $thisNode.find("#cluster_arrow").hide();
var clusterObj = $thisNode.data("jsonObj");
var $clusterContent = $thisNode.find("#cluster_content");
if($target.hasClass("expanded_close")) {
$.ajax({
data: createURL("command=listHosts&type=Routing&clusterid="+clusterObj.id),
dataType: "json",
async: false,
success: function(json) {
var items = json.listhostsresponse.host;
if (items != null && items.length > 0) {
$clusterContent.find("#cluster_"+clusterObj.id+"_host").show();
}
}
});
$.ajax({
data: createURL("command=listStoragePools&clusterid="+clusterObj.id),
dataType: "json",
async: false,
success: function(json) {
var items = json.liststoragepoolsresponse.storagepool;
if(items != null && items.length > 0) {
$clusterContent.find("#cluster_"+clusterObj.id+"_primarystorage").show();
}
}
});
if($target.hasClass("expanded_close")) {
$target.removeClass("expanded_close").addClass("expanded_open");
$clusterContent.show();
}
@ -307,67 +283,7 @@ function buildZoneTree() {
break;
}
return false;
});
/*
$("#leftmenu_host_node_template").unbind("click").bind("click", function(event) {
var $thisNode = $(this);
selectRowInZoneTree($thisNode.find("#host_header"));
if(currentRightPanelJSP != "jsp/host.jsp") {
removeDialogs();
$("#right_panel").load("jsp/host.jsp", function(){
currentRightPanelJSP = "jsp/host.jsp";
var $topButtonContainer = clearButtonsOnTop();
$("#top_buttons").appendTo($topButtonContainer);
$thisNode.data("onRefreshFn", function() {
hostJsonToDetailsTab();
});
afterLoadHostJSP();
hostToRightPanel($thisNode);
});
}
else {
hostToRightPanel($thisNode);
}
return false;
});
*/
/*
$("#leftmenu_primarystorage_node_template").unbind("click").bind("click", function(event) {
var $thisNode = $(this);
selectRowInZoneTree($thisNode.find("#primarystorage_header"));
if(currentRightPanelJSP != "jsp/primarystorage.jsp") {
removeDialogs();
$("#right_panel").load("jsp/primarystorage.jsp", function(){
currentRightPanelJSP = "jsp/primarystorage.jsp";
var $topButtonContainer = clearButtonsOnTop();
$("#top_buttons").appendTo($topButtonContainer);
$thisNode.data("onRefreshFn", function() {
primarystorageJsonToDetailsTab();
});
afterLoadPrimaryStorageJSP();
primarystorageToRightPanel($thisNode);
});
}
else {
primarystorageToRightPanel($thisNode);
}
return false;
});
*/
});
}
function refreshClusterUnderPod($podNode, newClusterName, existingClusterId, noClicking) {
@ -467,19 +383,7 @@ function clusterJSONToTreeNode(json, $clusterNode) {
$clusterNode.find("#leftmenu_primarystorage_node_template").data("clusterObj", json).attr("id",("cluster_"+json.id+"_primarystorage"));
$clusterNode.data("id", json.id).data("name", fromdb(json.name));
var clusterName = $clusterNode.find("#cluster_name").text(fromdb(json.name));
clusterName.data("jsonObj", json);
$.ajax({
data: createURL("command=listHosts&type=Routing&clusterid="+json.id),
dataType: "json",
async: false,
success: function(json) {
var items = json.listhostsresponse.host;
if (items != null && items.length > 0) {
$clusterNode.find("#cluster_arrow").removeClass("white_nonexpanded_close").addClass("expanded_close");
}
}
});
clusterName.data("jsonObj", json);
}
function hostJSONToTreeNode(json, $node) {