From fa9be5a651e2badcbe3ebb6583ef90ff2be3f2a6 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Fri, 13 Jul 2012 16:15:34 +0200 Subject: [PATCH] Ozones: Small improvements to Ozones Added new columns to resource lists, so that they match what is shown in Sunstone. Added column visibility plugin. Small changes to make VDC creation/update dialogs neater. Small fixes here and there. (cherry picked from commit 2240f60ca9b3fa6193e13eedc2e638da080d1a82) --- src/ozones/Server/public/css/application.css | 16 ++- src/ozones/Server/public/js/ozones-util.js | 89 ++++++++++++++--- .../public/js/plugins/aggregated-tab.js | 66 ++++++++++--- .../Server/public/js/plugins/vdcs-tab.js | 97 +++++++++++++------ .../Server/public/js/plugins/zones-tab.js | 64 +++++++++--- src/ozones/Server/templates/index.html | 2 + 6 files changed, 259 insertions(+), 75 deletions(-) diff --git a/src/ozones/Server/public/css/application.css b/src/ozones/Server/public/css/application.css index 764fa310de..0d441b2f98 100644 --- a/src/ozones/Server/public/css/application.css +++ b/src/ozones/Server/public/css/application.css @@ -568,7 +568,7 @@ ul.action_list li a:hover{ .dd_lists{ width:250px; display:inline-block; - height:200px; + height:100px; margin-left:2px; margin-bottom: 10px; } @@ -605,4 +605,18 @@ ul.dd_left{ .ui-layout-resizer-open-hover, /* hover-color to 'resize' */ .ui-layout-resizer-dragging { background: #EEE; +} + +.dataTables_length { + width: auto; +} + +.ColVis { + margin: 0 10px 0 10px; + float: left; +} + +.ColVis_Button { + padding: 5px; + font-size: 1em; } \ No newline at end of file diff --git a/src/ozones/Server/public/js/ozones-util.js b/src/ozones/Server/public/js/ozones-util.js index b8f8e16547..060292b799 100644 --- a/src/ozones/Server/public/js/ozones-util.js +++ b/src/ozones/Server/public/js/ozones-util.js @@ -178,12 +178,19 @@ function updateUsersList(req,list,tag, zone_id,zone_name){ $.each(list,function(){ var user = this.USER; - var name = ""; - var group_str = ""; - if (user.NAME && user.NAME != {}){ - name = user.NAME; + //var group_str = ""; + + var vms = "-"; + var memory = "-"; + var cpu = "-"; + + if (!$.isEmptyObject(user.VM_QUOTA)){ + vms = user.VM_QUOTA.VM.VMS_USED; + memory = user.VM_QUOTA.VM.MEMORY_USED+' MB'; + cpu = user.VM_QUOTA.VM.CPU_USED; } + // if (user.GROUPS.ID){ // $.each(user.GROUPS.ID,function() { // groups_str += this +", "; @@ -194,12 +201,24 @@ function updateUsersList(req,list,tag, zone_id,zone_name){ zone_id, zone_name, user.ID, - name + user.NAME, + user.GNAME, + user.AUTH_DRIVER, + vms, + memory, + cpu, + user.GID ]); } else { user_array.push([ user.ID, - name + user.NAME, + user.GNAME, + user.AUTH_DRIVER, + vms, + memory, + cpu, + user.GID ]); } @@ -223,11 +242,14 @@ function updateImagesList(req,list,tag,zone_id,zone_name){ image.UNAME, image.GNAME, image.NAME, + image.DATASTORE, + image.SIZE, oZones.Helper.image_type(image.TYPE), pretty_time(image.REGTIME), parseInt(image.PERSISTENT) ? "yes" : "no", oZones.Helper.resource_state("image",image.STATE), - image.RUNNING_VMS + image.RUNNING_VMS, + image.TEMPLATE.TARGET ? image.TEMPLATE.TARGET : '--' ]); } else { image_array.push([ @@ -235,11 +257,14 @@ function updateImagesList(req,list,tag,zone_id,zone_name){ image.UNAME, image.GNAME, image.NAME, + image.DATASTORE, + image.SIZE, oZones.Helper.image_type(image.TYPE), pretty_time(image.REGTIME), parseInt(image.PERSISTENT) ? "yes" : "no", oZones.Helper.resource_state("image",image.STATE), - image.RUNNING_VMS + image.RUNNING_VMS, + image.TEMPLATE.TARGET ? image.TEMPLATE.TARGET : '--' ]); }; }); @@ -300,7 +325,11 @@ function hostElementArray(host,zone_id,zone_name){ host.HOST_SHARE.RUNNING_VMS, //rvm pb_cpu, pb_mem, - oZones.Helper.resource_state("host_simple",host.STATE) ]; + oZones.Helper.resource_state("host_simple",host.STATE), + host.IM_MAD, + host.VM_MAD, + pretty_time(host.LAST_MON_TIME) + ]; }; return [ @@ -310,7 +339,11 @@ function hostElementArray(host,zone_id,zone_name){ host.HOST_SHARE.RUNNING_VMS, //rvm pb_cpu, pb_mem, - oZones.Helper.resource_state("host_simple",host.STATE) ]; + oZones.Helper.resource_state("host_simple",host.STATE), + host.IM_MAD, + host.VM_MAD, + pretty_time(host.LAST_MON_TIME) + ]; }; @@ -321,17 +354,41 @@ function updateClustersList(req,list,tag, zone_id,zone_name){ $.each(list,function(){ var cluster = this.CLUSTER; + var hosts = 0; + if ($.isArray(cluster.HOSTS.ID)) + hosts = cluster.HOSTS.ID.length; + else if (!$.isEmptyObject(cluster.HOSTS.ID)) + hosts = 1; + + var vnets = 0; + if ($.isArray(cluster.VNETS.ID)) + vnets = cluster.VNETS.ID.length; + else if (!$.isEmptyObject(cluster.VNETS.ID)) + vnets = 1; + + var dss = 0; + if ($.isArray(cluster.DATASTORES.ID)) + dss = cluster.DATASTORES.ID.length; + else if (!$.isEmptyObject(cluster.DATASTORES.ID)) + dss = 1; + if (zone_id){ array.push([ zone_id, zone_name, cluster.ID, - cluster.NAME + cluster.NAME, + hosts, + vnets, + dss ]); } else { array.push([ cluster.ID, - cluster.NAME + cluster.NAME, + hosts, + vnets, + dss ]); }; @@ -356,6 +413,10 @@ function updateDatastoresList(req,list,tag, zone_id,zone_name){ ds.GNAME, ds.NAME, ds.CLUSTER.length ? ds.CLUSTER : "-", + ds.BASE_PATH, + ds.TM_MAD, + ds.DS_MAD, + ds.SYSTEM == '1' ? 'Yes' : 'No' ]); } else { array.push([ @@ -364,6 +425,10 @@ function updateDatastoresList(req,list,tag, zone_id,zone_name){ ds.GNAME, ds.NAME, ds.CLUSTER.length ? ds.CLUSTER : "-", + ds.BASE_PATH, + ds.TM_MAD, + ds.DS_MAD, + ds.SYSTEM == '1' ? 'Yes' : 'No' ]); }; diff --git a/src/ozones/Server/public/js/plugins/aggregated-tab.js b/src/ozones/Server/public/js/plugins/aggregated-tab.js index 5cfa335e72..bc53615a57 100644 --- a/src/ozones/Server/public/js/plugins/aggregated-tab.js +++ b/src/ozones/Server/public/js/plugins/aggregated-tab.js @@ -30,6 +30,9 @@ var aggregated_hosts_tab_content = CPU Use\ Memory use\ Status\ + IM MAD\ + VM MAD\ + Last monitored on\ \ \ \ @@ -48,9 +51,10 @@ var aggregated_vms_tab_content = Group\ Name\ Status\ - CPU\ - Memory\ - Hostname\ + Used CPU\ + Used Memory\ + Host\ + IPs\ Start Time\ \ \ @@ -78,8 +82,9 @@ var aggregated_vns_tab_content = \ \ '; -var aggregated_images_tab_content = -'
\ + +var aggregated_images_tab_content = '\ +
\
\ \ \ @@ -90,11 +95,14 @@ var aggregated_images_tab_content = \ \ \ + \ + \ \ \ \ \ \ + \ \ \ \ @@ -110,6 +118,12 @@ var aggregated_users_tab_content = \ \ \ + \ + \ + \ + \ + \ + \ \ \ \ @@ -144,6 +158,9 @@ var aggregated_clusters_tab_content = \ \ \ + \ + \ + \ \ \ \ @@ -163,6 +180,10 @@ var aggregated_datastores_tab_content = \ \ \ + \ + \ + \ + \ \ \ \ @@ -725,12 +746,14 @@ $(document).ready(function(){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ { "sWidth": "60px", "aTargets": [5,8] }, { "sWidth": "35px", "aTargets": [0,2] }, { "sWidth": "160px", "aTargets": [6,7] }, - { "sWidth": "100px", "aTargets": [1,4] } + { "sWidth": "100px", "aTargets": [1,4,9,10,11] }, + { "bVisible" : false, "aTargets": [9,10,11] } ] }); @@ -739,10 +762,12 @@ $(document).ready(function(){ "bSortClasses": false, "sPaginationType": "full_numbers", "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0,2] }, { "sWidth": "60px", "aTargets": [7,8] }, - { "sWidth": "100px", "aTargets": [1,3,4,6,10] } + { "sWidth": "100px", "aTargets": [1,3,4,6,10] }, + { "bVisible" : false, "aTargets": [7,8,11] } ] }); @@ -751,10 +776,12 @@ $(document).ready(function(){ "bSortClasses": false, "bAutoWidth":false, "sPaginationType": "full_numbers", + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ { "sWidth": "60px", "aTargets": [7,8,9] }, { "sWidth": "35px", "aTargets": [0,2] }, - { "sWidth": "100px", "aTargets": [1,3,4,6] } + { "sWidth": "100px", "aTargets": [1,3,4,6] }, + { "bVisible" : false, "aTargets": [8] } ] }); @@ -762,11 +789,13 @@ $(document).ready(function(){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "60px", "aTargets": [9] }, - { "sWidth": "35px", "aTargets": [0,2,8,10] }, - { "sWidth": "100px", "aTargets": [1,3,4,6,7] } + { "sWidth": "60px", "aTargets": [11] }, + { "sWidth": "35px", "aTargets": [0,2,7,10,12,13] }, + { "sWidth": "100px", "aTargets": [1,3,4,6,8,9] }, + { "bVisible" : false, "aTargets": [7,9,13] } ] }); @@ -774,6 +803,7 @@ $(document).ready(function(){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0,2] }, @@ -786,9 +816,12 @@ $(document).ready(function(){ "bSortClasses": false, "sPaginationType": "full_numbers", "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ - { "sWidth": "35px", "aTargets": [0,2] }, - { "sWidth": "100px", "aTargets": [1] } + { "sWidth": "35px", "aTargets": [0,2,6,7,8,9] }, + { "sWidth": "100px", "aTargets": [1] }, + { "sWidth": "150px", "aTargets": [5] }, + { "bVisible" : false, "aTargets": [9] } ] }); @@ -797,8 +830,9 @@ $(document).ready(function(){ "bSortClasses": false, "sPaginationType": "full_numbers", "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ - { "sWidth": "35px", "aTargets": [0,2] }, + { "sWidth": "35px", "aTargets": [0,2,4,5,6] }, { "sWidth": "100px", "aTargets": [1] } ] }); @@ -808,9 +842,11 @@ $(document).ready(function(){ "bSortClasses": false, "sPaginationType": "full_numbers", "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0,2] }, - { "sWidth": "100px", "aTargets": [1,3,4,6] } + { "sWidth": "100px", "aTargets": [1,3,4,6,8,9,10] }, + { "bVisible" : false, "aTargets": [7,8,9,10] } ] }); diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js index e4c5ea9780..01eb9dc6dd 100644 --- a/src/ozones/Server/public/js/plugins/vdcs-tab.js +++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js @@ -26,9 +26,9 @@ var vdcs_tab_content = \ \ \ - \ - \ - \ + \ + \ + \ \ \ \ @@ -57,31 +57,31 @@ var create_vdc_tmpl = \
Allows hosts, Vnets, datastores belonging to other VDCs to be re-added to this one. They will appear greyed-out in the lists.
\
\ - \ - \ +

\ +
\
\
\ - \ + \
\
    \
      \ -
      \ +

      \
      \ - \ + \
      \
        \
          \ -
          \ +

          \
          \ - \ + \
          \
            \
              \ -
              \ +

              \ \ \ -
              \ -
              \ +
              \ +
              \ \ \
              \ @@ -100,29 +100,29 @@ var update_vdc_tmpl = \
              Allows hosts, Vnets belonging to other VDCs to be re-added to this one. They will appear greyed-out in the list.
              \
              \ - \ - \ - \ +
              \ +
              \ + \
              \
                \
                  \ -
                  \ +


                  \
                  \ - \ + \
                  \
                    \
                      \ -
                      \ +

                      \
                      \ - \ + \
                      \
                        \
                          \ -
                          \ +

                          \ \
                          \ -
                          \ -
                          \ +
                          \ +
                          \ \ \
                          \ @@ -301,9 +301,9 @@ function vdcElementArray(vdc_json){ vdc.NAME, vdc.ZONES_ID, vdc.CLUSTER_ID, - vdc.RESOURCES.HOSTS.length ? vdc.RESOURCES.HOSTS.join() : "none", - vdc.RESOURCES.NETWORKS.length ? vdc.RESOURCES.NETWORKS.join() : "none", - vdc.RESOURCES.DATASTORES.length ? vdc.RESOURCES.DATASTORES.join() : "none", + vdc.RESOURCES.HOSTS.length ? vdc.RESOURCES.HOSTS.join(', ') : "none", + vdc.RESOURCES.NETWORKS.length ? vdc.RESOURCES.NETWORKS.join(', ') : "none", + vdc.RESOURCES.DATASTORES.length ? vdc.RESOURCES.DATASTORES.join(', ') : "none", ]; } @@ -562,21 +562,36 @@ function setupCreateVDCDialog(){ var dialog = $('div#create_vdc_dialog'); dialog.html(create_vdc_tmpl); - var height = Math.floor($(window).height()*0.8); - dialog.dialog({ autoOpen: false, modal: true, - height: height, width: 500 }); + + //Hide VDC resources selects $('div#vdc_hosts_lists,div#vdc_vnets_lists,div#vdc_datastores_lists',dialog).hide(); + + // Listen to labels of VDC resources $('.vdc_show_hide',dialog).click(function(){ + // Switch triangle icon $('span',this).toggleClass('ui-icon-triangle-1-s ui-icon-triangle-1-n'); - $(this).parent().next().toggle(); + + // The selects boxes' div + var list = $(this).parent().next(); + + // If visible, hide it. Otherwise hide all lists and show this one. + if (list.is(':visible')) list.fadeOut(); + else { + $('.dd_lists', list.parent()).hide(); + list.fadeIn(); + } + return false; }); + //Show hosts resources + $('.vdc_show_hide', dialog).first().trigger('click'); + $('button',dialog).button(); $('#vdc_available_hosts_list',dialog).sortable({ connectWith : '#vdc_selected_hosts_list', @@ -729,12 +744,30 @@ function setupUpdateVDCDialog(){ width: 500 }); - $('div#vdc_update_hosts_lists,div#vdc_update_vnets_lists,div#vdc_update_datastores_lists',dialog).hide(); + + //Hide VDC resources selects + $('div#vdc_hosts_lists,div#vdc_vnets_lists,div#vdc_datastores_lists',dialog).hide(); + + // Listen to labels of VDC resources $('.vdc_show_hide',dialog).click(function(){ + // Switch triangle icon $('span',this).toggleClass('ui-icon-triangle-1-s ui-icon-triangle-1-n'); - $(this).parent().next().toggle(); + + // The selects boxes' div + var list = $(this).parent().next(); + + // If visible, hide it. Otherwise hide all lists and show this one. + if (list.is(':visible')) list.fadeOut(); + else { + $('.dd_lists', list.parent()).hide(); + list.fadeIn(); + } + return false; }); + //Show hosts resources + $('.vdc_show_hide', dialog).first().trigger('click'); + $('button',dialog).button(); $('#vdc_update_available_hosts_list',dialog).sortable({ connectWith : '#vdc_update_selected_hosts_list', diff --git a/src/ozones/Server/public/js/plugins/zones-tab.js b/src/ozones/Server/public/js/plugins/zones-tab.js index c6011247f5..6eff8e5b8b 100644 --- a/src/ozones/Server/public/js/plugins/zones-tab.js +++ b/src/ozones/Server/public/js/plugins/zones-tab.js @@ -355,9 +355,12 @@ function updateZoneInfo(req,zone_json){
                          \ \ \ - \ - \ + \ + \ \ + \ + \ + \ \ \ \ @@ -396,9 +399,9 @@ function updateZoneInfo(req,zone_json){ \ \ \ - \ - \ - \ + \ + \ + \ \ \ \ @@ -441,11 +444,14 @@ function updateZoneInfo(req,zone_json){ \ \ \ + \ + \ \ \ \ \ \ + \ \ \ \ @@ -462,6 +468,12 @@ function updateZoneInfo(req,zone_json){ \ \ \ + \ + \ + \ + \ + \ + \ \ \ \ @@ -479,6 +491,9 @@ function updateZoneInfo(req,zone_json){ \ \ \ + \ + \ + \ \ \ \ @@ -499,6 +514,10 @@ function updateZoneInfo(req,zone_json){ \ \ \ + \ + \ + \ + \ \ \ \ @@ -526,12 +545,14 @@ function updateZoneInfo(req,zone_json){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ { "sWidth": "60px", "aTargets": [3,6] }, - { "sWidth": "100px", "aTargets": [2] }, + { "sWidth": "100px", "aTargets": [2,7,8,9] }, { "sWidth": "35px", "aTargets": [0] }, - { "sWidth": "200px", "aTargets": [4,5] } + { "sWidth": "200px", "aTargets": [4,5] }, + { "bVisible" : false, "aTargets": [7,8,9] } ] }); @@ -540,10 +561,12 @@ function updateZoneInfo(req,zone_json){ "bSortClasses": false, "sPaginationType": "full_numbers", "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0] }, { "sWidth": "60px", "aTargets": [5,6] }, - { "sWidth": "100px", "aTargets": [1,2,4,8] } + { "sWidth": "100px", "aTargets": [1,2,4,8] }, + { "bVisible" : false, "aTargets": [5,6,9] } ] }); @@ -553,10 +576,12 @@ function updateZoneInfo(req,zone_json){ "bSortClasses": false, "bAutoWidth":false, "sPaginationType": "full_numbers", + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ { "sWidth": "60px", "aTargets": [5,6,7] }, { "sWidth": "35px", "aTargets": [0] }, - { "sWidth": "100px", "aTargets": [1,2,4] } + { "sWidth": "100px", "aTargets": [1,2,4] }, + { "bVisible" : false, "aTargets": [6] } ] }); @@ -564,11 +589,13 @@ function updateZoneInfo(req,zone_json){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "60px", "aTargets": [7] }, - { "sWidth": "35px", "aTargets": [0,6,8] }, - { "sWidth": "100px", "aTargets": [1,2,4,5] } + { "sWidth": "60px", "aTargets": [9] }, + { "sWidth": "35px", "aTargets": [0,5,8,10,11] }, + { "sWidth": "100px", "aTargets": [1,2,4,6,7] }, + { "bVisible" : false, "aTargets": [5,7,11] } ] }); @@ -576,6 +603,7 @@ function updateZoneInfo(req,zone_json){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0] }, @@ -588,8 +616,11 @@ function updateZoneInfo(req,zone_json){ "bSortClasses": false, "sPaginationType": "full_numbers", "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "aoColumnDefs": [ - { "sWidth": "35px", "aTargets": [0] } + { "sWidth": "35px", "aTargets": [0,4,5,6,7] }, + { "sWidth": "150px", "aTargets": [3] }, + { "bVisible" : false, "aTargets": [7] } ] }); @@ -597,9 +628,10 @@ function updateZoneInfo(req,zone_json){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ - { "sWidth": "35px", "aTargets": [0] }, + { "sWidth": "35px", "aTargets": [0,2,3,4] }, ] }); @@ -607,10 +639,12 @@ function updateZoneInfo(req,zone_json){ "bJQueryUI": true, "bSortClasses": false, "bAutoWidth":false, + "sDom" : '<"H"lfrC>t<"F"ip>', "sPaginationType": "full_numbers", "aoColumnDefs": [ { "sWidth": "35px", "aTargets": [0] }, - { "sWidth": "100px", "aTargets": [1,2,4] } + { "sWidth": "100px", "aTargets": [1,2,4,6,7,8] }, + { "bVisible" : false, "aTargets": [5,6,7,8] } ] }); diff --git a/src/ozones/Server/templates/index.html b/src/ozones/Server/templates/index.html index 681fc93876..c5e01c0c1b 100644 --- a/src/ozones/Server/templates/index.html +++ b/src/ozones/Server/templates/index.html @@ -6,6 +6,7 @@ + @@ -16,6 +17,7 @@ +
                          OwnerGroupNameDatastoreSizeTypeRegistration timePersistentState#VMSTarget
                          Zone NameIDNameGroupAuth driverVMSMemoryCPUGID
                          Zone NameIDNameHostsVirtual NetworksDatastores
                          GroupNameClusterBasepathTM MADDS MADSystem
                          NameZone IDCluster IDHostsVirtual NetworksDatastoresHosts IDsVirtual Networks IDsDatastores IDs
                          NameClusterRunning VMsCPU UseMemory useUsed CPUUsed MemoryStatusIM MADVM MADLast monitored on
                          GroupNameStatusCPUMemoryHostnameUsed CPUUsed MemoryHostIPsStart Time
                          OwnerGroupNameDatastoreSizeTypeRegistration timePersistentState#VMSTarget
                          IDNameGroupAuth driverVMSMemoryCPUGID
                          IDNameHostsVirtual NetworksDatastores
                          GroupNameClusterBasepathTM MADDS MADSystem