[Ovirt-devel] [PATCH server] REBASE Cloud UI V1 (readonly).

Scott Seago sseago at redhat.com
Tue May 19 18:49:06 UTC 2009


Jason Guiditta wrote:
> This patch creates the shell for much of what the cloud ui will
> become.  It is focused on layout (lightly fedora themed), accessibility,
> and 'bookmarkability'.  This layout uses no javascript (that will be
> used to enhance interactivity in a future patch).  It also introduces
> the idea of using a simple table rather than the more conplex js/json
> we use in the admin side.  Plan here is to gradually enhance this as
> needed to make more interactive.
>
> CSS was kept separate from admin CSS to facilitate theming by
> users/deployments.
>
> Controllers are designed (even though large parts are stubbed) to be
> 'skinny' and leverage as much as possible the new service api.  There
> are a few readonly AR calls that in near future could easily be moved to
> service layer to be even simpler calls.  They are kept separate from admin
> things so they can be as simple as possible as well a making it conceivable
> that one could deploy the cloud part of the app without also deplying admin
> (perhaps one wants to deply that elsewhere).  For now this would have to be
> done manually, but perhaps in future we can setup the service layer/ar classes
> to be a separate rpm that two different wuis (admin/cloud) could call into,
> enhancing modularity.
>
> Signed-off-by: Jason Guiditta <jguiditt at redhat.com>
> ---
> diff --git a/src/app/controllers/cloud/cloud_controller.rb b/src/app/controllers/cloud/cloud_controller.rb
> new file mode 100644
> index 0000000..154d15d
> --- /dev/null
> +++ b/src/app/controllers/cloud/cloud_controller.rb
> @@ -0,0 +1,35 @@
> +
> +class Cloud::CloudController < ApplicationController
> +  include VmService
> +
> +  layout 'cloud/cloud'
> +
> +  before_filter :set_vars
> +
> +  protected
> +
> +
> +  # NOTE: This probably will/should be moved to use set_perms in
> +  # ApplicationService once that is ready to go.
> +  def set_vars
> +    @user = get_login_user
> +  end
>   
Yes, the above shouldn't be needed since get_login_user will be called 
by all of the service methods.
> diff --git a/src/app/controllers/cloud/instance_controller.rb b/src/app/controllers/cloud/instance_controller.rb
> new file mode 100644
> index 0000000..a4d0fd8
> --- /dev/null
> +++ b/src/app/controllers/cloud/instance_controller.rb
> @@ -0,0 +1,95 @@
> +
> +class Cloud::InstanceController < Cloud::CloudController
> +
> +  before_filter :handle_form
> +
> +  def index
> +    list
> +  end
> +
> +  def list
> +    page = find_in_params_or_default(:page, 1)
> +    order = find_in_params_or_default(:sort,"vms.id")
> +    @vms = Vm.paged_with_perms(@user,
> +                            Privilege::VIEW,
> +                            # NOTE: maybe this ^^ part could be taken care of behind the scenes?
> +                            # Also, needs to be changed to a cloud priv
> +                            page, order)
> +    @actions = VmTask.get_vm_actions
> +    show
> +  end
> +
>   
This can probably be refactored to use the same logic as 
VmController.list -- maybe both could call a VmService method.
> +  def show
> +    ids = params[:ids]
> +    task_page = find_in_params_or_default(:task_page, 1)
> +    task_order = find_in_params_or_default(:task_order, "tasks.id")
> +    @vm_details = Vm.find(ids) if ids
> +    if @vm_details
> +      @tasks = VmTask.paginate(:conditions => ["task_target_id in (:ids)",{:ids => ids}],
> +                             :per_page => 5, :page => task_page, :order => task_order)
> +    end
> +  end
> +
>   
VmService.svc_show only works on a single VM. We may need to modify it 
to work with multiple IDs as well as a single ID -- or use parallel 
methods for multiple and single IDs.

The above comments shouldn't affect this patch, though, as they're more 
related to the service layer integrations,  this works for me.

ACK

Scott




More information about the ovirt-devel mailing list