host page - clear right panel when clicking different cluster node.

This commit is contained in:
Jessica Wang 2010-12-20 15:59:01 -08:00
parent 57de81983f
commit 41ef0fdc73
2 changed files with 46 additions and 3 deletions

View File

@ -259,6 +259,11 @@ function hostJsonToPrimaryStorageTab() {
});
}
function hostJsonClearPrimaryStorageTab() {
var $thisTab = $("#right_panel_content").find("#tab_content_primarystorage");
$thisTab.find("#tab_container").empty();
}
function hostPrimaryStorageJSONToTemplate(jsonObj, $template) {
$template.data("jsonObj", jsonObj);
$template.attr("id", "host_primarystorage_"+jsonObj.id).data("hostPrimarystorageId", jsonObj.id);
@ -422,6 +427,11 @@ function hostJsonToInstanceTab() {
});
}
function hostJsonClearInstanceTab() {
var $thisTab = $("#right_panel_content").find("#tab_content_instance");
$thisTab.find("#tab_container").empty();
}
function hostInstanceJSONToTemplate(jsonObj, template) {
template.data("jsonObj", jsonObj);
template.attr("id", "host_instance_"+jsonObj.id).data("hostInstanceId", jsonObj.id);
@ -469,6 +479,11 @@ function hostJsonToRouterTab() {
});
}
function hostJsonClearRouterTab() {
var $thisTab = $("#right_panel_content").find("#tab_content_router");
$thisTab.find("#tab_container").empty();
}
function hostJsonToStatisticsTab() {
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
if($midmenuItem1 == null)
@ -517,6 +532,21 @@ function hostJsonToStatisticsTab() {
$thisTab.find("#tab_container").show();
}
function hostJsonClearStatisticsTab() {
var $thisTab = $("#right_panel_content").find("#tab_content_statistics");
var $barChartContainer = $thisTab.find("#cpu_barchart");
$barChartContainer.find("#cpunumber").text("");
$barChartContainer.find("#cpuspeed").text("");
$barChartContainer.find("#bar_chart").removeClass().addClass("db_barbox").css("width", "0%");
$barChartContainer.find("#percentused").text("");
$thisTab.find("#cpuallocated").text("");
$thisTab.find("#memorytotal").text("");
$thisTab.find("#memoryallocated").text("");
$thisTab.find("#memoryused").text("");
$thisTab.find("#networkkbsread").text("");
$thisTab.find("#networkkbswrite").text("");
}
function hostRouterJSONToTemplate(jsonObj, template) {
template.data("jsonObj", jsonObj);
template.attr("id", "host_router_"+jsonObj.id).data("hostRouterId", jsonObj.id);
@ -565,6 +595,11 @@ function hostJsonToSystemvmTab() {
});
}
function hostJsonClearSystemvmTab() {
var $thisTab = $("#right_panel_content").find("#tab_content_systemvm");
$thisTab.find("#tab_container").empty();
}
function hostSystemvmJSONToTemplate(jsonObj, template) {
template.data("jsonObj", jsonObj);
template.attr("id", "host_systemvm_"+jsonObj.id).data("hostSystemvmId", jsonObj.id);
@ -579,13 +614,20 @@ function hostSystemvmJSONToTemplate(jsonObj, template) {
function hostClearRightPanel() {
hostClearDetailsTab();
hostJsonClearPrimaryStorageTab();
hostJsonClearInstanceTab();
hostJsonClearRouterTab();
hostJsonClearSystemvmTab();
hostJsonClearStatisticsTab();
}
function hostClearDetailsTab() {
var $thisTab = $("#right_panel_content").find("#tab_content_details");
$thisTab.find("#grid_header_title").text("");
$thisTab.find("#id").text("");
$thisTab.find("#name").text("");
$thisTab.find("#state").text("");
$thisTab.find("#state").text("");
$thisTab.find("#type").text("");
$thisTab.find("#zonename").text("");
$thisTab.find("#podname").text("");
$thisTab.find("#clustername").text("");

View File

@ -179,10 +179,11 @@ function buildZoneTree() {
$("#leftmenu_cluster_node_template").unbind("click").bind("click", function(event) {
selectRowInZoneTree($(this).find("#cluster_header"));
hostClearRightPanel();
var objCluster = $(this).data("jsonObj");
listMidMenuItems(("listHosts&type=Routing&clusterid="+objCluster.id), hostGetSearchParams, "listhostsresponse", "host", "jsp/host.jsp", afterLoadHostJSP, hostToMidmenu, hostToRightPanel, getMidmenuId, false, ("cluster_"+objCluster.id));
return false;
});
}