From 8ae52d528a4dd91ae1c44d50027ccbfd44be27bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 13 Jan 2015 18:42:40 +0100 Subject: [PATCH] Feature #3471: Add VDC info to individual panel --- src/sunstone/etc/sunstone-views/admin.yaml | 2 + src/sunstone/public/js/plugins/vdcs-tab.js | 211 +++++++++++++++++++++ 2 files changed, 213 insertions(+) diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 7c60956313..7c582db228 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -101,6 +101,8 @@ tabs: vdcs-tab: panel_tabs: vdc_info_tab: true + vdc_groups_tab: true + vdc_resources_tab: true table_columns: - 0 # Checkbox - 1 # ID diff --git a/src/sunstone/public/js/plugins/vdcs-tab.js b/src/sunstone/public/js/plugins/vdcs-tab.js index 0e57a0fd3f..873f51533b 100644 --- a/src/sunstone/public/js/plugins/vdcs-tab.js +++ b/src/sunstone/public/js/plugins/vdcs-tab.js @@ -397,6 +397,14 @@ var vdc_info_panel = { "vdc_info_tab" : { title: tr("Virtual Data Center information"), content: "" + }, + "vdc_groups_tab" : { + title: tr("Groups"), + content: "" + }, + "vdc_resources_tab" : { + title: tr("Resources"), + content: "" } } @@ -533,9 +541,212 @@ function updateVdcInfo(request,vdc){ content: info_tab_content }; + var groups_tab = { + title : tr("Groups"), + icon: "fa-users", + content: vdc_group_tab_content(vdc_info) + }; + + var resources_tab = { + title : tr("Resources"), + icon: "fa-th", + content : vdc_resources_tab_content(vdc_info) + }; + Sunstone.updateInfoPanelTab("vdc_info_panel","vdc_info_tab",info_tab); + Sunstone.updateInfoPanelTab("vdc_info_panel","vdc_groups_tab",groups_tab); + Sunstone.updateInfoPanelTab("vdc_info_panel","vdc_resources_tab",resources_tab); Sunstone.popUpInfoPanel("vdc_info_panel", "vdcs-tab"); + + setup_vdc_group_tab_content(vdc_info); + setup_vdc_resources_tab_content(vdc_info); +} + +function vdc_group_tab_content(vdc_info){ + + var html = + '
'; + + html += + '
\ +
'; + + html += ''; + + html += '
'; + + html += '
\ + '+generateGroupTableSelect("vdc_group_list")+'\ +
\ +
'; + + return html; +} + +function setup_vdc_group_tab_content(vdc_info){ + + var groups = []; + + if (vdc_info.GROUPS.ID != undefined){ + var groups = vdc_info.GROUPS.ID; + + if (!$.isArray(groups)){ + groups = [groups]; + } + } + + var opts = { + read_only: true, + fixed_ids: groups + } + + setupGroupTableSelect($("#vdc_info_panel"), "vdc_group_list", opts); + + refreshGroupTableSelect($("#vdc_info_panel"), "vdc_group_list"); +} + +function vdc_resources_tab_content(vdc_info){ + + var clusters_array = []; + var hosts_array = []; + var vnets_array = []; + var datastores_array = []; + + if (vdc_info.CLUSTERS.CLUSTER){ + clusters_array = vdc_info.CLUSTERS.CLUSTER; + + if (!$.isArray(clusters_array)){ + clusters_array = [clusters_array]; + } + } + + if (vdc_info.HOSTS.HOST){ + hosts_array = vdc_info.HOSTS.HOST; + + if (!$.isArray(hosts_array)){ + hosts_array = [hosts_array]; + } + } + + if (vdc_info.VNETS.VNET){ + vnets_array = vdc_info.VNETS.VNET; + + if (!$.isArray(vnets_array)){ + vnets_array = [vnets_array]; + } + } + + if (vdc_info.DATASTORES.DATASTORE){ + datastores_array = vdc_info.DATASTORES.DATASTORE; + + if (!$.isArray(datastores_array)){ + datastores_array = [datastores_array]; + } + } + + var html = + '
\ +
\ + \ + \ + \ + \ + \ + \ + \ + '; + + $.each(clusters_array, function(i,e){ + html += + '\ + \ + \ + '; + }); + + html += + '\ +
' + tr("Zone ID") + '' + tr("Cluster ID") + '
' + e.ZONE_ID + '' + e.CLUSTER_ID + '
\ +
\ +
\ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + '; + + $.each(hosts_array, function(i,e){ + html += + '\ + \ + \ + '; + }); + + html += + '\ +
' + tr("Zone ID") + '' + tr("Host ID") + '
' + e.ZONE_ID + '' + e.HOST_ID + '
\ +
\ +
\ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + '; + + $.each(vnets_array, function(i,e){ + html += + '\ + \ + \ + '; + }); + + html += + '\ +
' + tr("Zone ID") + '' + tr("VNet ID") + '
' + e.ZONE_ID + '' + e.VNET_ID + '
\ +
\ +
\ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + '; + + $.each(datastores_array, function(i,e){ + html += + '\ + \ + \ + '; + }); + + html += + '\ +
' + tr("Zone ID") + '' + tr("Datastore ID") + '
' + e.ZONE_ID + '' + e.DATASTORE_ID + '
\ +
\ +
' + + return html; +} + +function setup_vdc_resources_tab_content(vdc_info){ } function initialize_create_vdc_dialog(dialog) {