new UI - resources page - add host and primary storage under each cluster node in tree.

This commit is contained in:
Jessica Wang 2010-10-11 11:18:20 -07:00
parent e43608c02f
commit a81077c3be
3 changed files with 55 additions and 5 deletions

View File

@ -3367,7 +3367,7 @@ a:hover.search_button {
width:345px;
height:25px;
float:left;
margin:0 0 5px 110px;
margin:0 0 5px 165px;
display:inline;
padding:0;
}
@ -3376,7 +3376,7 @@ a:hover.search_button {
width:345px;
height:25px;
float:left;
margin:0 0 5px 110px;
margin:0 0 5px 165px;
background:#eaf3f5 repeat top left;
padding:0;
}
@ -3459,7 +3459,7 @@ a:hover.search_button {
width:22px;
height:18px;
float:left;
background:url(../images/zone__primarystorageicon.png) no-repeat top left;
background:url(../images/zone_primarystorageicon.png) no-repeat top left;
font-weight:bold;
margin:3px 0 0 5px;
padding:0;

View File

@ -347,7 +347,13 @@
<div class="zonetree_thirdlevel">
<div class="zonetree_clustericon"></div>
<p>Cluster:<div class="zonetree_links" id="cluster_name">(Name of the Cluster)</div></p>
</div>
</div>
<div id="cluster_content">
<div id="hosts_container">
</div>
<div id="primarystorages_container">
</div>
</div>
</div>
</div>
<!-- Cluster Template (end) -->
@ -376,7 +382,7 @@
<div id="row_container">
<div class="zonetree_forthlevel">
<div class="zonetree_primarystorageicon"></div>
<p>Primary Storage:<div class="zonetree_links" id="primary_storage_name">(Name of the Primary Storage)</div></p>
<p>Primary:<div class="zonetree_links" id="primary_storage_name">(Name of the Primary Storage)</div></p>
</div>
</div>
</div>

View File

@ -126,6 +126,50 @@ function afterLoadResourceJSP() {
template.data("id", json.id).data("name", fromdb(json.name));
var systeymvmName = template.find("#cluster_name").text(fromdb(json.name));
$.ajax({
data: createURL("command=listHosts&clusterid="+json.id+maxPageSize),
dataType: "json",
success: function(json) {
var items = json.listhostsresponse.host;
var container = template.find("#hosts_container").empty();
if (items != null && items.length > 0) {
for (var i = 0; i < items.length; i++) {
var hostTemplate = $("#host_template").clone(true).attr("id", "host_"+items[i].id);
hostJSONToTemplate(items[i], hostTemplate);
container.append(hostTemplate.show());
}
}
}
});
$.ajax({
data: createURL("command=listStoragePools&clusterid="+json.id+maxPageSize),
dataType: "json",
success: function(json) {
var items = json.liststoragepoolsresponse.storagepool;
var container = template.find("#primarystorages_container").empty();
if (items != null && items.length > 0) {
for (var i = 0; i < items.length; i++) {
var primaryStorageTemplate = $("#primary_storage_template").clone(true).attr("id", "primary_storage_"+items[i].id);
primaryStorageJSONToTemplate(items[i], primaryStorageTemplate);
container.append(primaryStorageTemplate.show());
}
}
}
});
}
function hostJSONToTemplate(json, template) {
template.data("id", json.id).data("name", fromdb(json.name));
var hostName = template.find("#host_name").text(fromdb(json.name));
}
function primaryStorageJSONToTemplate(json, template) {
template.data("id", json.id).data("name", fromdb(json.name));
var primaryStorageName = template.find("#primary_storage_name").text(fromdb(json.name));
}
$("#zone_template").bind("click", function(event) {