[Patch] Re: [Ovirt-devel] oVirt testing

Hugh O. Brock hbrock at redhat.com
Thu Jun 5 19:37:51 UTC 2008


On Thu, Jun 05, 2008 at 12:56:02PM -0400, Scott Seago wrote:
> Scott Seago wrote:
>
> Patch attached for the above, as well as showing the new host state field.
> Scott

> >From 9f2ec899e628dd69a333f20f39f38a8b38911a85 Mon Sep 17 00:00:00 2001
> From: Scott Seago <sseago at redhat.com>
> Date: Thu, 5 Jun 2008 12:54:57 -0400
> Subject: [PATCH] misc ui bugs as reported by clalance
> 
> 
> Signed-off-by: Scott Seago <sseago at redhat.com>
> ---
>  wui/src/app/controllers/hardware_controller.rb |    2 +-
>  wui/src/app/models/host.rb                     |    8 ++------
>  wui/src/app/views/hardware/show_hosts.rhtml    |    4 +++-
>  wui/src/app/views/hardware/show_storage.rhtml  |    4 +++-
>  wui/src/app/views/host/_grid.rhtml             |    8 ++++----
>  wui/src/app/views/host/show.rhtml              |    9 +--------
>  6 files changed, 14 insertions(+), 21 deletions(-)
> 
> diff --git a/wui/src/app/controllers/hardware_controller.rb b/wui/src/app/controllers/hardware_controller.rb
> index 0338cd0..9718d60 100644
> --- a/wui/src/app/controllers/hardware_controller.rb
> +++ b/wui/src/app/controllers/hardware_controller.rb
> @@ -125,7 +125,7 @@ class HardwareController < ApplicationController
>          :conditions => ["pools.id != ?", id]}
>        include_pool = true
>      end
> -    attr_list = [:id, :hostname, :uuid, :hypervisor_type, :num_cpus, :cpu_speed, :arch, :memory_in_mb, :is_disabled_str, :id]
> +    attr_list = [:id, :hostname, :uuid, :hypervisor_type, :num_cpus, :cpu_speed, :arch, :memory_in_mb, :status_str, :id]
>      attr_list.insert(2, [:hardware_pool, :name]) if include_pool
>      json_list(hosts, attr_list, [:all], find_opts)
>    end
> diff --git a/wui/src/app/models/host.rb b/wui/src/app/models/host.rb
> index 5f5140f..efee14a 100644
> --- a/wui/src/app/models/host.rb
> +++ b/wui/src/app/models/host.rb
> @@ -32,11 +32,7 @@ class Host < ActiveRecord::Base
>    def memory_in_mb=(mem)
>      self[:memory]=(mb_to_kb(mem))
>    end
> -  def is_disabled_str
> -    if is_disabled.nil? or is_disabled == 0
> -      "No"
> -    else
> -      "Yes"
> -    end
> +  def status_str
> +    "#{state} (#{(is_disabled.nil? or is_disabled==0) ? 'enabled':'disabled'})"
>    end
>  end
> diff --git a/wui/src/app/views/hardware/show_hosts.rhtml b/wui/src/app/views/hardware/show_hosts.rhtml
> index a98055c..375905e 100644
> --- a/wui/src/app/views/hardware/show_hosts.rhtml
> +++ b/wui/src/app/views/hardware/show_hosts.rhtml
> @@ -5,7 +5,9 @@
>        <a id="move_link" href="#" onClick="return validate_for_move();"><%= image_tag "icon_move.png", :style=>"vertical-align:middle;" %>  Move</a>
>        <a id="move_link_hidden" href="<%= url_for :controller => 'hardware', :action => 'move', :id => @pool, :resource_type=>'hosts' %>" rel="facebox[.bolder]" style="display:none" ></a>
>      </li>
> -    <li><a href="#" onClick="remove_hosts()"><%= image_tag "icon_delete_white.png" %>  Delete</a></li>
> +    <% if @pool.id != HardwarePool.get_default_pool.id %>
> +      <li><a href="#" onClick="remove_hosts()"><%= image_tag "icon_delete_white.png" %>  Remove</a></li>
> +    <% end %>
>   </ul>
>  </div>
>  
> diff --git a/wui/src/app/views/hardware/show_storage.rhtml b/wui/src/app/views/hardware/show_storage.rhtml
> index 0d2b98d..73808ab 100644
> --- a/wui/src/app/views/hardware/show_storage.rhtml
> +++ b/wui/src/app/views/hardware/show_storage.rhtml
> @@ -7,7 +7,9 @@
>        <a id="move_link_hidden" href="<%= url_for :controller => 'hardware', :action => 'move', :id => @pool, :resource_type=>'storage' %>" rel="facebox[.bolder]"  style="display:none" ></a>
>      </li>
>      <li><a href="#" onClick="delete_storage()"><%= image_tag "icon_delete_white.png", :style => "vertical-align:middle;" %>  Delete</a></li>
> -    <li><a href="#" onClick="remove_storage()"><%= image_tag "icon_delete_white.png", :style => "vertical-align:middle;" %>  Remove</a></li>
> +    <% if @pool.id != HardwarePool.get_default_pool.id %>
> +      <li><a href="#" onClick="remove_storage()"><%= image_tag "icon_delete_white.png", :style => "vertical-align:middle;" %>  Remove</a></li>
> +    <% end %>
>    </ul>
>  </div>
>  
> diff --git a/wui/src/app/views/host/_grid.rhtml b/wui/src/app/views/host/_grid.rhtml
> index 0ce2a06..593f7d0 100644
> --- a/wui/src/app/views/host/_grid.rhtml
> +++ b/wui/src/app/views/host/_grid.rhtml
> @@ -17,12 +17,12 @@
>  		{display: 'Hostname', name : 'hostname', width : 60, align: 'left'},
>  		<%= "{display: 'Hardware Pool', name : 'pools.name', width : 100, align: 'left'}," if exclude_id %>
>  	        {display: 'UUID', name : 'uuid', width : 180, align: 'left'},
> -		{display: 'Hypervisor Type', name : 'hypervisor_type', width : 80, align: 'left'},
> -		{display: 'CPUs', name : 'num_cpus', width : 40, align: 'left'},
> -		{display: 'Speed (MHz)', name : 'cpu_speed', width : 60, align: 'right'},
> +		{display: 'Hypervisor', name : 'hypervisor_type', width : 60, align: 'left'},
> +		{display: 'CPUs', name : 'num_cpus', width : 30, align: 'left'},
> +		{display: 'Speed (MHz)', name : 'cpu_speed', width : 70, align: 'right'},
>  		{display: 'Arch', name : 'arch', width : 50, align: 'right'},
>  		{display: 'RAM (MB)', name : 'memory', width : 60, align: 'right'},
> -		{display: 'Disabled', name : 'is_disabled', width : 50, align: 'right'},
> +		{display: 'Status', name : 'is_disabled', width : 110, align: 'right'},
>          {display: 'Load', name : 'load', width: 180, sortable : false, align: 'left', process: <%= table_id %>_load_widget }
>  		],
>  	sortname: "hostname",
> diff --git a/wui/src/app/views/host/show.rhtml b/wui/src/app/views/host/show.rhtml
> index c668d2a..23d940a 100644
> --- a/wui/src/app/views/host/show.rhtml
> +++ b/wui/src/app/views/host/show.rhtml
> @@ -19,7 +19,6 @@
>    {
>      enable_url = '<%= url_for :controller => "host", :action => "enable", :id => @host %>'
>      disable_url = '<%= url_for :controller => "host", :action => "disable", :id => @host %>'
> -    if(confirm("Are you sure?")){
>        $.post(enable ? enable_url : disable_url,
>                function(data,status){
>                  refresh_summary('hosts_selection', 
> @@ -31,7 +30,6 @@
>  		  alert(data.alert);
>                  }
>                 }, 'json');
> -    }
>    }
>  </script>
>  
> @@ -51,12 +49,7 @@
>          <%=h @host.memory_in_mb %> MB<br/>
>          <%=h @host.arch %><br/>
>  	<%=h @host.hypervisor_type %><br/>
> -        <%if @host.is_disabled.nil? or @host.is_disabled == 0  -%>
> -          enabled
> -        <% else -%>
> -          disabled
> -        <% end -%>
> -        <br/>
> +	<%=h @host.status_str %><br/>
>  
>  <!-- FIXME: need styling
>  <h3>Network Interfaces</h3>
> -- 
> 1.5.4.1
> 

ACK

and I have committed and pushed this...

--Hugh




More information about the ovirt-devel mailing list