[Ovirt-devel] [Patch] VM pool quota add/edit

Hugh O. Brock hbrock at redhat.com
Fri May 30 17:25:29 UTC 2008


On Fri, May 30, 2008 at 01:11:49PM -0400, Scott Seago wrote:
>

> >From ac4b03baf95f12f19b29893266ab469e8500617e Mon Sep 17 00:00:00 2001
> From: Scott Seago <sseago at redhat.com>
> Date: Fri, 30 May 2008 13:10:15 -0400
> Subject: [PATCH] working action links for VM quotas
> 
> 
> Signed-off-by: Scott Seago <sseago at redhat.com>
> ---
>  wui/src/app/views/hardware/show_vms.rhtml       |    9 +++---
>  wui/src/app/views/resources/quick_summary.rhtml |   33 +++++++++++++++++++++++
>  2 files changed, 38 insertions(+), 4 deletions(-)
> 
> diff --git a/wui/src/app/views/hardware/show_vms.rhtml b/wui/src/app/views/hardware/show_vms.rhtml
> index 285f2c2..f88f0d3 100644
> --- a/wui/src/app/views/hardware/show_vms.rhtml
> +++ b/wui/src/app/views/hardware/show_vms.rhtml
> @@ -31,9 +31,10 @@
>      }
>      if (selected_ids.length == 1)
>      {
> -      $('#vmpools_selection').load('<%= url_for :controller => "resources", 
> -                                                :action => "quick_summary" %>',
> -                { id: parseInt(selected_ids[0].substring(3))})
> +      refresh_summary('vmpool_selection', 
> +                      '<%= url_for :controller => "resources", 
> +                                   :action => "quick_summary" %>',
> +                      parseInt(selected_ids[0].substring(3)))
>      }
>    }
>  </script>
> @@ -45,6 +46,6 @@
>                                                           :pool_id => @pool.id,
>                                                           :on_select => "vmpools_select" } %>
>  </div>
> -<div class="selection_detail" id="vmpools_selection">
> +<div class="selection_detail" id="vmpool_selection">
>    <div>Select a VM pool above.</div>
>  </div>
> diff --git a/wui/src/app/views/resources/quick_summary.rhtml b/wui/src/app/views/resources/quick_summary.rhtml
> index e71d9c9..8632b30 100644
> --- a/wui/src/app/views/resources/quick_summary.rhtml
> +++ b/wui/src/app/views/resources/quick_summary.rhtml
> @@ -1,6 +1,39 @@
>  <%- content_for :title do -%>
>    <%=h @vm_resource_pool.name %> quota
>  <%- end -%>
> +<%- content_for :action_links do -%>
> +  <%if @is_hwpool_admin -%>
> +    <%if @vm_resource_pool.quota -%>
> +      <%= link_to image_tag("icon_edit.png") + " Edit Quota",
> +                            {:controller => 'quota', :action => 'edit', :id => @vm_resource_pool.quota},
> +                            :rel=>"facebox[.bolder]" %>
> +      <a href="#" onClick="delete_vm_quota()">
> +        <%= image_tag "icon_x.png" %> Revert to Default Quota
> +      </a> 
> +    <% else -%>
> +      <%= link_to image_tag("icon_edit.png") + " Edit Quota",
> +                            {:controller => 'quota', :action => 'new', :pool_id => @vm_resource_pool },
> +                            :rel=>"facebox[.bolder]" %>
> +    <% end -%>
> +  <% end -%>
> +<% end -%>
> +<script type="text/javascript">
> +  function delete_vm_quota()
> +  {
> +    if(confirm("Are you sure?")){
> +      $.post('<%= url_for :controller => "quota", :action => "destroy", :id => @vm_resource_pool.quota %>',
> +              function(data,status){
> +                refresh_summary('vmpool_selection', 
> +                            '<%= url_for :controller => "resources", 
> +                                         :action => "quick_summary" %>',
> +                            <%= @vm_resource_pool.id %>)
> +		if (data.alert) {
> +		  alert(data.alert);
> +                }
> +               }, 'json');
> +    }
> +  }
> +</script>
>  
>      <% resources = @vm_resource_pool.full_resources %>
>      <div class="selection_key">
> -- 
> 1.5.4.1
> 

ACK

I have committed this.

--H




More information about the ovirt-devel mailing list