add cluster page.

This commit is contained in:
Jessica Wang 2010-12-29 11:21:38 -08:00
parent bce5dfb0d4
commit e794bf7934
5 changed files with 184 additions and 40 deletions

View File

@ -46,7 +46,8 @@
<script type="text/javascript" src="scripts/cloud.core.resource.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.zone.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.network.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.pod.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.pod.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.cluster.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.host.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/cloud.core.systemvm.js?t=<%=now%>"></script>

81
ui/jsp/cluster.jsp Normal file
View File

@ -0,0 +1,81 @@
<%@ page import="java.util.*" %>
<%@ page import="com.cloud.utils.*" %>
<%
Locale browserLocale = request.getLocale();
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
%>
<div class="main_title" id="right_panel_header">
<div class="main_titleicon">
<img src="images/title_clustericon.gif"/></div>
<h1>Cluster
</h1>
</div>
<div class="contentbox" id="right_panel_content">
<div class="info_detailbox errorbox" id="after_action_info_container_on_top" style="display: none">
<p id="after_action_info">
</p>
</div>
<div class="tabbox" style="margin-top:15px;">
<div class="content_tabs on">
<%=t.t("Details")%></div>
</div>
<div id="tab_content_details">
<div id="tab_spinning_wheel" class="rightpanel_mainloader_panel" style="display: none;">
<div class="rightpanel_mainloaderbox">
<div class="rightpanel_mainloader_animatedicon">
</div>
<p>
Loading &hellip;</p>
</div>
</div>
<div id="tab_container">
<div class="grid_container">
<div class="grid_rows odd">
<div class="grid_row_cell" style="width: 20%;">
<div class="row_celltitles">
<%=t.t("ID")%>:</div>
</div>
<div class="grid_row_cell" style="width: 79%;">
<div class="row_celltitles" id="id">
</div>
</div>
</div>
<div class="grid_rows even">
<div class="grid_row_cell" style="width: 20%;">
<div class="row_celltitles">
<%=t.t("name")%>:</div>
</div>
<div class="grid_row_cell" style="width: 79%;">
<div class="row_celltitles" id="name">
</div>
</div>
</div>
<div class="grid_rows odd">
<div class="grid_row_cell" style="width: 20%;">
<div class="row_celltitles">
<%=t.t("zone")%>:</div>
</div>
<div class="grid_row_cell" style="width: 79%;">
<div class="row_celltitles" id="zonename">
</div>
</div>
</div>
<div class="grid_rows even">
<div class="grid_row_cell" style="width: 20%;">
<div class="row_celltitles">
<%=t.t("pod")%>:</div>
</div>
<div class="grid_row_cell" style="width: 79%;">
<div class="row_celltitles" id="podname">
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,83 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
function afterLoadClusterJSP($midmenuItem1) {
/*
var objCluster = $midmenuItem1.data("jsonObj");
listMidMenuItems(("listHosts&type=Routing&clusterid="+objCluster.id), hostGetSearchParams, "listhostsresponse", "host", "jsp/host.jsp", afterLoadHostJSP, hostToMidmenu, hostToRightPanel, getMidmenuId, false, ("cluster_"+objCluster.id));
clearButtonsOnTop();
initDialog("dialog_add_host");
initDialog("dialog_add_pool");
bindEventHandlerToDialogAddPool($("#dialog_add_pool"));
clusterToRightPanel($midmenuItem1);
*/
}
function clusterToRightPanel($midmenuItem1) {
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
clusterJsonToDetailsTab();
/*
var objCluster = $midmenuItem1.data("jsonObj");
clearButtonsOnTop();
initAddHostButton($("#midmenu_add_host_button"), "cluster_page", $midmenuItem1);
initAddPrimaryStorageButton($("#midmenu_add_primarystorage_button"), "cluster_page", $midmenuItem1);
listMidMenuItems(("listHosts&type=Routing&clusterid="+objCluster.id), hostGetSearchParams, "listhostsresponse", "host", "jsp/host.jsp", afterLoadHostJSP, hostToMidmenu, hostToRightPanel, getMidmenuId, false, ("cluster_"+objCluster.id));
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
clusterJsonToDetailsTab();
*/
}
function clusterJsonToDetailsTab() {
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
if($midmenuItem1 == null)
return;
var jsonObj = $midmenuItem1.data("jsonObj");
if(jsonObj == null)
return;
$.ajax({
data: createURL("command=listClusters&id="+jsonObj.id),
dataType: "json",
async: false,
success: function(json) {
var items = json.listclustersresponse.cluster;
if(items != null && items.length > 0) {
jsonObj = items[0];
$midmenuItem1.data("jsonObj", jsonObj);
}
}
});
var $detailsTab = $("#right_panel_content").find("#tab_content_details");
$detailsTab.find("#id").text(fromdb(jsonObj.id));
$detailsTab.find("#name").text(fromdb(jsonObj.name));
$detailsTab.find("#zonename").text(fromdb(jsonObj.zonename));
$detailsTab.find("#podname").text(fromdb(jsonObj.podname));
}

View File

@ -69,29 +69,7 @@ function hostToMidmenu(jsonObj, $midmenuItem1) {
function hostToRightPanel($midmenuItem1) {
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
hostJsonToDetailsTab();
/*
if(currentRightPanelJSP != "jsp/host.jsp") {
removeDialogs();
$("#right_panel").load("jsp/host.jsp", function(){
currentRightPanelJSP = "jsp/host.jsp";
$(this).data("onRefreshFn", function() {
hostJsonToDetailsTab();
});
afterLoadHostJSP($midmenuItem1);
copyActionInfoFromMidMenuToRightPanel($midmenuItem1);
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
$("#tab_details").click();
});
}
else {
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
hostJsonToDetailsTab();
}
*/
hostJsonToDetailsTab();
}
function afterLoadHostJSP() {

View File

@ -211,17 +211,17 @@ function buildZoneTree() {
*/
$("#leftmenu_cluster_node_template").unbind("click").bind("click", function(event) {
var $clusterNode = $(this);
var $thisNode = $(this);
var $target = $(event.target);
var targetId = $target.attr("id");
switch (targetId) {
case "cluster_arrow" :
var $loadingContainer = $clusterNode.find("#cluster_loading_container").show();
var $clusterArrow = $clusterNode.find("#cluster_arrow").hide();
var $loadingContainer = $thisNode.find("#cluster_loading_container").show();
var $clusterArrow = $thisNode.find("#cluster_arrow").hide();
var clusterObj = $clusterNode.data("jsonObj");
var $clusterContent = $clusterNode.find("#cluster_content");
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),
@ -253,28 +253,29 @@ function buildZoneTree() {
break;
default:
/*
selectRowInZoneTree($(this).find("#cluster_header"));
default:
selectRowInZoneTree($thisNode.find("#cluster_header"));
if(currentRightPanelJSP != "jsp/cluster.jsp") {
removeDialogs();
var $thisNode = $(this);
$("#right_panel").load("jsp/cluster.jsp", function(){
$("#right_panel").load("jsp/cluster.jsp", function(){
currentRightPanelJSP = "jsp/cluster.jsp";
var $topButtonContainer = clearButtonsOnTop();
$("#top_buttons").appendTo($topButtonContainer);
$(this).data("onRefreshFn", function() {
$thisNode.data("onRefreshFn", function() {
clusterJsonToDetailsTab();
});
afterLoadclusterJSP($thisNode);
afterLoadClusterJSP($thisNode);
clusterToRightPanel($thisNode);
});
}
else {
clusterJsonToRightPanel($(this));
}
*/
clusterToRightPanel($thisNode);
}
break;
}