\
@@ -459,10 +457,17 @@ var cluster_host_actions = {
call: OpenNebula.Host.list,
callback: updateClusterHostsView,
error: onError
+ },
+
+ "ClusterHostInfo.list" : {
+ type: "list",
+ call: OpenNebula.Host.list,
+ callback: updateClusterHostsInfoView,
+ error: onError
}
}
-//callback to update the list of hosts.
+//callback to update the list of hosts for Create dialog
function updateClusterHostsView (request,host_list){
var host_list_array = [];
@@ -471,11 +476,22 @@ function updateClusterHostsView (request,host_list){
host_list_array.push(hostElementArray(this));
});
-
updateView(host_list_array,dataTable_cluster_hosts);
updateHostSelect();
}
+//callback to update the list of hosts for info panel
+function updateClusterHostsInfoView (request,host_list){
+ var host_list_array = [];
+
+ $.each(host_list,function(){
+ if(this.HOST.CLUSTER_ID == cluster_info.ID)
+ host_list_array.push(hostElementArray(this));
+ });
+
+ updateView(host_list_array,dataTable_cluster_hosts_panel);
+}
+
//updates the host select by refreshing the options in it
function updateHostSelect(){
hosts_select = makeSelectOptions(dataTable_cluster_hosts,
@@ -487,9 +503,6 @@ function updateHostSelect(){
}
-
-
-
/* -------- Virtual Networks datatable -------- */
//Setup actions
@@ -502,15 +515,15 @@ var cluster_vnet_actions = {
error: onError
},
- "ClusterVN.autorefresh" : {
- type: "custom",
- call: function() {
- OpenNebula.Network.list({timeout: true, success: updateVNetworksView, error: onError});
- }
+ "ClusterVNInfo.list" : {
+ type: "list",
+ call: OpenNebula.Network.list,
+ callback: updateClusterVNetworksInfoView,
+ error: onError
}
}
-//updates the list of virtual networks
+//updates the list of virtual networks for Create dialog
function updateVNetworksView(request, network_list){
var network_list_array = [];
@@ -521,6 +534,18 @@ function updateVNetworksView(request, network_list){
updateView(network_list_array,dataTable_cluster_vnets);
}
+//callback to update the list of vnets for info panel
+function updateClusterVNetworksInfoView (request,vnet_list){
+ var vnet_list_array = [];
+
+ $.each(vnet_list,function(){
+ if(this.VNET.CLUSTER_ID == cluster_info.ID)
+ vnet_list_array.push(vNetworkElementArray(this));
+ });
+
+ updateView(vnet_list_array,dataTable_cluster_vnets_panel);
+}
+
/* -------- Datastores datatable -------- */
@@ -534,15 +559,15 @@ var cluster_datastore_actions = {
error: onError
},
- "ClusterDS.autorefresh" : {
- type: "custom",
- call : function() {
- OpenNebula.Datastore.list({timeout: true, success: updateDatastoresView,error: onError});
- }
+ "ClusterDSInfo.list" : {
+ type: "list",
+ call: OpenNebula.Datastore.list,
+ callback: updateClusterDatastoresInfoView,
+ error: onError
}
}
-//updates the list of datastores
+//updates the list of datastores for Create dialog
function updateDatastoresView(request, list){
var list_array = [];
@@ -555,6 +580,18 @@ function updateDatastoresView(request, list){
updateInfraDashboard("datastores",list);
}
+//callback to update the list of datastores for info panel
+function updateClusterDatastoresInfoView (request,datastore_list){
+ var datastore_list_array = [];
+
+ $.each(datastore_list,function(){
+ if(this.DATASTORE.CLUSTER_ID == cluster_info.ID)
+ datastore_list_array.push(datastoreElementArray(this));
+ });
+
+ updateView(datastore_list_array,dataTable_cluster_datastores_panel);
+}
+
/* -------- End of datatables section -------- */
@@ -629,7 +666,14 @@ var cluster_actions = {
"Cluster.show" : {
type: "single",
call: OpenNebula.Cluster.show,
- callback: updateClusterElement,
+ callback: updateClusterInfo,
+ error: onError
+ },
+
+ "Cluster.showinfo" : {
+ type: "single",
+ call: OpenNebula.Cluster.show,
+ callback: updateClusterInfo,
error: onError
},
@@ -774,6 +818,27 @@ var clusters_tab = {
parentTab: "infra_tab"
};
+var cluster_info_panel = {
+ "cluster_info_tab" : {
+ title: tr("Cluster information"),
+ content:""
+ },
+
+ "cluster_host_tab" : {
+ title: tr("Cluster Hosts"),
+ content: ""
+ },
+ "cluster_vnet_tab" : {
+ title: tr("Cluster Virtual Networks"),
+ content: ""
+ },
+ "cluster_datastore_tab" : {
+ title: tr("Cluster Datastores"),
+ content: ""
+ }
+
+};
+
// Cluster monitoring configuration. This config controls the monitoring
// which is plotted in the cluster dashboards.
@@ -906,7 +971,7 @@ Sunstone.addActions(cluster_vnet_actions);
Sunstone.addActions(cluster_datastore_actions);
Sunstone.addActions(cluster_actions);
Sunstone.addMainTab('clusters_tab',clusters_tab);
-//Sunstone.addInfoPanel("host_info_panel",host_info_panel);
+Sunstone.addInfoPanel("cluster_info_panel",cluster_info_panel);
//return lists of selected elements in cluster list
function clusterElements(){
@@ -1001,6 +1066,160 @@ function updateClustersView (request,list){
updateInfraDashboard("clusters",list);
};
+// Updates the cluster info panel tab content and pops it up
+function updateClusterInfo(request,cluster){
+ cluster_info = cluster.CLUSTER;
+
+ //Information tab
+ var info_tab = {
+ title : tr("Cluster information"),
+ content :
+ '
\
+ \
+ | ' + tr("Cluster information") + ' - '+cluster_info.NAME+' |
\
+ \
+ \
+ \
+ | ' + tr("id") + ' | \
+ '+cluster_info.ID+' | \
+
\
+ \
+ | ' + tr("Name") + ' | \
+ '+cluster_info.NAME+' | \
+
\
+ \
+
\
+
\
+ | ' + tr("Cluster template") + ' |
'+
+ prettyPrintJSON(cluster_info.TEMPLATE)+
+ '
'
+ }
+
+ var cluster_host_tab = {
+ title: tr("Hosts"),
+ content : '
' + host_datatable_table_tmpl + '
'
+ }
+
+ var cluster_vnet_tab = {
+ title: tr("Virtual Networks"),
+ content : '
' + vnet_datatable_table_tmpl + '
'
+ }
+
+ var cluster_datastore_tab = {
+ title: tr("Datastores"),
+ content : '
' + datastore_datatable_table_tmpl + '
'
+ }
+
+ //Sunstone.updateInfoPanelTab(info_panel_name,tab_name, new tab object);
+ Sunstone.updateInfoPanelTab("cluster_info_panel","cluster_info_tab",info_tab);
+ Sunstone.updateInfoPanelTab("cluster_info_panel","cluster_host_tab",cluster_host_tab);
+ Sunstone.updateInfoPanelTab("cluster_info_panel","cluster_vnet_tab",cluster_vnet_tab);
+ Sunstone.updateInfoPanelTab("cluster_info_panel","cluster_datastore_tab",cluster_datastore_tab);
+
+ Sunstone.popUpInfoPanel("cluster_info_panel");
+
+ // Hosts datatable
+
+ dataTable_cluster_hosts_panel = $("#datatable_cluster_hosts_info_panel").dataTable({
+ "bJQueryUI": true,
+ "bSortClasses": false,
+ "sDom" : '<"H"lfrC>t<"F"ip>',
+ "oColVis": { //exclude checkbox column
+ "aiExclude": [ 0 ]
+ },
+ "bAutoWidth":false,
+ "sPaginationType": "full_numbers",
+ "aoColumnDefs": [
+ { "bSortable": false, "aTargets": ["check"] },
+ { "sWidth": "60px", "aTargets": [0,4] },
+ { "sWidth": "35px", "aTargets": [1] },
+ { "sWidth": "100px", "aTargets": [9,3,10,11,12] },
+ { "sWidth": "150", "aTargets": [5,6,7,8] },
+ { "bVisible": false, "aTargets": [0,3,5,6,7,8,10,11,12]}
+ ],
+ "oLanguage": (datatable_lang != "") ?
+ {
+ sUrl: "locale/"+lang+"/"+datatable_lang
+ } : ""
+ });
+
+ //preload it
+ dataTable_cluster_hosts_panel.fnClearTable();
+
+ addElement([
+ spinner,
+ '','','','','','','','','','','',''],dataTable_cluster_hosts_panel);
+
+ // Virtual networks datatable
+
+ dataTable_cluster_vnets_panel = $("#datatable_cluster_vnets_info_panel", dialog).dataTable({
+ "bJQueryUI": true,
+ "bSortClasses": false,
+ "bAutoWidth":false,
+ "sDom" : '<"H"lfrC>t<"F"ip>',
+ "oColVis": {
+ "aiExclude": [ 0 ]
+ },
+ "sPaginationType": "full_numbers",
+ "aoColumnDefs": [
+ { "bSortable": false, "aTargets": ["check"] },
+ { "sWidth": "60px", "aTargets": [0,6,7,8] },
+ { "sWidth": "35px", "aTargets": [1] },
+ { "sWidth": "100px", "aTargets": [2,3,5] },
+ { "bVisible": false, "aTargets": [0,5,7]}
+ ],
+ "oLanguage": (datatable_lang != "") ?
+ {
+ sUrl: "locale/"+lang+"/"+datatable_lang
+ } : ""
+ });
+
+
+ //preload it
+ dataTable_cluster_vnets_panel.fnClearTable();
+ addElement([
+ spinner,
+ '','','','','','','','','','','',''],dataTable_cluster_vnets_panel);
+
+ // Datastores datatable
+
+ dataTable_cluster_datastores_panel = $("#datatable_cluster_datastores_info_panel", dialog).dataTable({
+ "bJQueryUI": true,
+ "bSortClasses": false,
+ "sDom" : '<"H"lfrC>t<"F"ip>',
+ "oColVis": {
+ "aiExclude": [ 0 ]
+ },
+ "sPaginationType": "full_numbers",
+ "bAutoWidth":false,
+ "aoColumnDefs": [
+ { "bSortable": false, "aTargets": ["check"] },
+ { "sWidth": "60px", "aTargets": [0] },
+ { "sWidth": "35px", "aTargets": [1,9] },
+ { "sWidth": "100px", "aTargets": [2,3,5,7,8] },
+ { "bVisible": false, "aTargets": [0,5,6,7,8,9] }
+ ],
+ "oLanguage": (datatable_lang != "") ?
+ {
+ sUrl: "locale/"+lang+"/"+datatable_lang
+ } : ""
+ });
+
+
+ //preload it
+ dataTable_cluster_datastores_panel.fnClearTable();
+ addElement([
+ spinner,
+ '','','','','','','','','','','',''],dataTable_cluster_datastores_panel);
+
+ // initializa datatables values
+
+ Sunstone.runAction("ClusterHostInfo.list");
+ Sunstone.runAction("ClusterVNInfo.list");
+ Sunstone.runAction("ClusterDSInfo.list");
+}
+
+
//generates the HTML for the dashboard of a specific cluster
function clusterTabContent(cluster_json) {
var cluster = cluster_json.CLUSTER;
@@ -1415,6 +1634,6 @@ $(document).ready(function(){
initCheckAllBoxes(dataTable_clusters);
tableCheckboxesListener(dataTable_clusters);
- infoListener(dataTable_clusters);
+ infoListener(dataTable_clusters, "Cluster.showinfo");
});