zonetree - hide storage node if there is no primary storage under a cluster.

This commit is contained in:
Jessica Wang 2010-12-29 21:21:37 -08:00
parent de6b9eb0e2
commit e6cdb1a93b
3 changed files with 13 additions and 63 deletions

View File

@ -848,7 +848,7 @@
</div> </div>
</div> </div>
<div id="cluster_content" style="display: none"> <div id="cluster_content" style="display: none">
<div class="leftmenu_expandedlist" id="leftmenu_host_node_template" style="display:block"> <div class="leftmenu_expandedlist" id="leftmenu_host_node_template" style="display:none">
<div id="host_header" class="leftmenu_content"> <div id="host_header" class="leftmenu_content">
<div class="leftmenu_sixthindent"> <div class="leftmenu_sixthindent">
<div class="leftmenu_arrowloader" id="host_loading_container" style="display:none;"></div> <div class="leftmenu_arrowloader" id="host_loading_container" style="display:none;"></div>
@ -857,14 +857,8 @@
<span>Host</span> <span>Host</span>
</div> </div>
</div> </div>
</div> </div>
<div class="leftmenu_expandedlist" id="leftmenu_primarystorage_node_template" style="display:none">
<!--
<div id="hosts_container">
</div>
-->
<div class="leftmenu_expandedlist" id="leftmenu_primarystorage_node_template" style="display:block">
<div id="primarystorage_header" class="leftmenu_content"> <div id="primarystorage_header" class="leftmenu_content">
<div class="leftmenu_sixthindent"> <div class="leftmenu_sixthindent">
<div class="leftmenu_arrowloader" id="primarystorage_loading_container" style="display:none;"></div> <div class="leftmenu_arrowloader" id="primarystorage_loading_container" style="display:none;"></div>
@ -873,43 +867,10 @@
<span>Storage</span> <span>Storage</span>
</div> </div>
</div> </div>
</div> </div>
<!--
<div id="primarystorages_container">
</div>
-->
</div> </div>
</div> </div>
<!-- cluster Template (end) --> <!-- cluster Template (end) -->
<!-- host Template (begin) -->
<div class="leftmenu_expandedlist" id="leftmenu_host_node_template" style="display:none">
<div id="host_header" class="leftmenu_content">
<div class="leftmenu_sixthindent">
<div class="leftmenu_arrowloader" id="host_loading_container" style="display:none;"></div>
<div class="leftmenu_arrows white_nonexpanded_close" id="host_arrow">
</div>
<span id="host_name_label">host: </span>
<span id="host_name"></span>
</div>
</div>
</div>
<!-- host Template (end) -->
<!-- primarystorage Template (begin) -->
<div class="leftmenu_expandedlist" id="leftmenu_primarystorage_node_template" style="display:none">
<div id="primarystorage_header" class="leftmenu_content">
<div class="leftmenu_sixthindent">
<div class="leftmenu_arrowloader" id="primarystorage_loading_container" style="display:none;"></div>
<div class="leftmenu_arrows white_nonexpanded_close" id="primarystorage_arrow">
</div>
<span id="primarystorage_name_label">Storage: </span>
<span id="primarystorage_name"></span>
</div>
</div>
</div>
<!-- primarystorage Template (end) -->
<!-- domain tree node template (begin) --> <!-- domain tree node template (begin) -->
<div id="domain_tree_node_template" style="display:none"> <div id="domain_tree_node_template" style="display:none">

View File

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

View File

@ -238,8 +238,7 @@ function buildZoneTree() {
switch (targetId) { switch (targetId) {
case "cluster_arrow" : case "cluster_arrow" :
var $loadingContainer = $thisNode.find("#cluster_loading_container").show(); var $loadingContainer = $thisNode.find("#cluster_loading_container").show();
var $clusterArrow = $thisNode.find("#cluster_arrow").hide(); var $clusterArrow = $thisNode.find("#cluster_arrow").hide();
var clusterObj = $thisNode.data("jsonObj"); var clusterObj = $thisNode.data("jsonObj");
var $clusterContent = $thisNode.find("#cluster_content"); var $clusterContent = $thisNode.find("#cluster_content");
if($target.hasClass("expanded_close")) { if($target.hasClass("expanded_close")) {
@ -248,31 +247,21 @@ function buildZoneTree() {
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
var items = json.listhostsresponse.host; var items = json.listhostsresponse.host;
var $container = $clusterContent.find("#hosts_container").empty();
if (items != null && items.length > 0) { if (items != null && items.length > 0) {
for (var i = 0; i < items.length; i++) { $clusterContent.find("#cluster_"+clusterObj.id+"_host").show();
var $hostNode = $("#leftmenu_host_node_template").clone(true);
hostJSONToTreeNode(items[i], $hostNode);
$container.append($hostNode.show());
}
} }
} }
}); });
$.ajax({ $.ajax({
data: createURL("command=listStoragePools&clusterid="+clusterObj.id), data: createURL("command=listStoragePools&clusterid="+clusterObj.id),
dataType: "json", dataType: "json",
async: false,
success: function(json) { success: function(json) {
var items = json.liststoragepoolsresponse.storagepool; var items = json.liststoragepoolsresponse.storagepool;
var $container = $clusterContent.find("#primarystorages_container").empty();
if(items != null && items.length > 0) { if(items != null && items.length > 0) {
var $template = $("#leftmenu_primarystorage_node_template"); $clusterContent.find("#cluster_"+clusterObj.id+"_primarystorage").show();
for(var i=0; i<items.length;i++) {
var $primarystorageNode = $template.clone(true);
primarystorageJSONToTreeNode(items[i], $primarystorageNode);
$container.append($primarystorageNode.show());
}
} }
} }
}); });