From: Jan Provaznik <[email protected]>

---
 src/app/controllers/quota_controller.rb  |  104 ------------------------------
 src/app/controllers/quotas_controller.rb |  104 ++++++++++++++++++++++++++++++
 src/app/views/pools/show.haml            |    2 +-
 src/app/views/quota/edit.haml            |   13 ----
 src/app/views/quota/show.haml            |   21 ------
 src/app/views/quotas/edit.haml           |   13 ++++
 src/app/views/quotas/show.haml           |   21 ++++++
 7 files changed, 139 insertions(+), 139 deletions(-)
 delete mode 100644 src/app/controllers/quota_controller.rb
 create mode 100644 src/app/controllers/quotas_controller.rb
 delete mode 100644 src/app/views/quota/edit.haml
 delete mode 100644 src/app/views/quota/show.haml
 create mode 100644 src/app/views/quotas/edit.haml
 create mode 100644 src/app/views/quotas/show.haml

diff --git a/src/app/controllers/quota_controller.rb 
b/src/app/controllers/quota_controller.rb
deleted file mode 100644
index 04537ac..0000000
--- a/src/app/controllers/quota_controller.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# Copyright (C) 2009 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA  02110-1301, USA.  A copy of the GNU General Public License is
-# also available at http://www.gnu.org/copyleft/gpl.html.
-
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
-
-class QuotaController < ApplicationController
-  before_filter :require_user
-
-  def show
-    @parent = get_parent_object(params)
-    @parent_type = params[:parent_type]
-    @quota = @parent.quota
-
-    require_privilege(Privilege::QUOTA_VIEW, @parent)
-  end
-
-  def edit
-    @parent = get_parent_object(params)
-    @parent_type = params[:parent_type]
-    @name = get_parent_name(@parent, @parent_type)
-
-    @quota = @parent.quota
-
-    require_privilege(Privilege::QUOTA_MODIFY, @parent)
-  end
-
-  def update
-    @parent = @parent = get_parent_object(params)
-    @parent_type = params[:parent_type]
-    require_privilege(Privilege::QUOTA_MODIFY, @parent)
-
-    @quota = @parent.quota
-    @name = get_parent_name(@parent, @parent_type)
-    if @quota.update_attributes(params[:quota])
-      flash[:notice] = "Quota updated!"
-      redirect_to :action => 'show', :id => @parent, :parent_type => 
@parent_type
-    else
-      flash[:notice] = "Could not update quota, please check you have entered 
valid values"
-      render :action => "edit"
-    end
-  end
-
-  def reset
-    @parent = @parent = get_parent_object(params)
-    @parent_type = params[:parent_type]
-    require_privilege(Privilege::QUOTA_MODIFY, @parent)
-
-    @quota = @parent.quota
-    @quota.maximum_running_instances = Quota::NO_LIMIT
-    @quota.maximum_total_instances = Quota::NO_LIMIT
-
-    if @quota.save!
-      flash[:notice] = "Quota updated!"
-    end
-      redirect_to :action => 'show', :id => @parent, :parent_type => 
@parent_type
-  end
-
-  private
-  def get_parent_object(params)
-    if params[:parent_type] == "pool"
-      return Pool.find(params[:id])
-    elsif params[:parent_type] == "cloud_account"
-      return CloudAccount.find(params[:id])
-    end
-    #TODO Throw no match to pool or cloud account exception
-  end
-
-  def get_parent_name(parent, parent_type)
-    if parent_type == "pool"
-      return parent.name
-    elsif parent_type == "cloud_account"
-      return parent.username
-    end
-    #TODO Throw no match to pool or cloud account exception
-  end
-
-  def check_params_infinite_limits(params)
-    params.each_pair do |key, value|
-      if value == ""
-        params[key] = Quota::NO_LIMIT
-      end
-    end
-    return params
-  end
-
-
-end
diff --git a/src/app/controllers/quotas_controller.rb 
b/src/app/controllers/quotas_controller.rb
new file mode 100644
index 0000000..e9937fb
--- /dev/null
+++ b/src/app/controllers/quotas_controller.rb
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2009 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+# Filters added to this controller apply to all controllers in the application.
+# Likewise, all the methods added will be available for all controllers.
+
+
+class QuotasController < ApplicationController
+  before_filter :require_user
+
+  def show
+    @parent = get_parent_object(params)
+    @parent_type = params[:parent_type]
+    @quota = @parent.quota
+
+    require_privilege(Privilege::QUOTA_VIEW, @parent)
+  end
+
+  def edit
+    @parent = get_parent_object(params)
+    @parent_type = params[:parent_type]
+    @name = get_parent_name(@parent, @parent_type)
+
+    @quota = @parent.quota
+
+    require_privilege(Privilege::QUOTA_MODIFY, @parent)
+  end
+
+  def update
+    @parent = @parent = get_parent_object(params)
+    @parent_type = params[:parent_type]
+    require_privilege(Privilege::QUOTA_MODIFY, @parent)
+
+    @quota = @parent.quota
+    @name = get_parent_name(@parent, @parent_type)
+    if @quota.update_attributes(params[:quota])
+      flash[:notice] = "Quota updated!"
+      redirect_to :action => 'show', :id => @parent, :parent_type => 
@parent_type
+    else
+      flash[:notice] = "Could not update quota, please check you have entered 
valid values"
+      render :action => "edit"
+    end
+  end
+
+  def reset
+    @parent = @parent = get_parent_object(params)
+    @parent_type = params[:parent_type]
+    require_privilege(Privilege::QUOTA_MODIFY, @parent)
+
+    @quota = @parent.quota
+    @quota.maximum_running_instances = Quota::NO_LIMIT
+    @quota.maximum_total_instances = Quota::NO_LIMIT
+
+    if @quota.save!
+      flash[:notice] = "Quota updated!"
+    end
+      redirect_to :action => 'show', :id => @parent, :parent_type => 
@parent_type
+  end
+
+  private
+  def get_parent_object(params)
+    if params[:parent_type] == "pool"
+      return Pool.find(params[:id])
+    elsif params[:parent_type] == "cloud_account"
+      return CloudAccount.find(params[:id])
+    end
+    #TODO Throw no match to pool or cloud account exception
+  end
+
+  def get_parent_name(parent, parent_type)
+    if parent_type == "pool"
+      return parent.name
+    elsif parent_type == "cloud_account"
+      return parent.username
+    end
+    #TODO Throw no match to pool or cloud account exception
+  end
+
+  def check_params_infinite_limits(params)
+    params.each_pair do |key, value|
+      if value == ""
+        params[key] = Quota::NO_LIMIT
+      end
+    end
+    return params
+  end
+
+
+end
diff --git a/src/app/views/pools/show.haml b/src/app/views/pools/show.haml
index 8f066d9..229f3e2 100644
--- a/src/app/views/pools/show.haml
+++ b/src/app/views/pools/show.haml
@@ -9,4 +9,4 @@
       %li= link_to "User access",  {:controller => "permissions", :action => 
"list", :pool_id => @pool.id, :ajax => true}
     %li= link_to "Hardware Profiles",  {:action => "hardware_profiles", :id => 
@pool.id, :ajax => true}
     %li= link_to "Realms",  {:action => "realms", :id => @pool.id, :ajax => 
true}
-    %li= link_to "Quota",  {:controller => "quota", :action => "show", :id => 
@pool, :parent_type => "pool", :ajax => true}
+    %li= link_to "Quota",  {:controller => "quotas", :action => "show", :id => 
@pool, :parent_type => "pool", :ajax => true}
diff --git a/src/app/views/quota/edit.haml b/src/app/views/quota/edit.haml
deleted file mode 100644
index 87ab25d..0000000
--- a/src/app/views/quota/edit.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-.dcloud_form
-  %h2
-    Edit Quota for #...@parent_type + ": " + @name}
-  %br/
-  - form_for @quota, :url => {:controller => :quota, :action => "update", 
:parent_type => @parent_type}, :class => "dcloud_form" do |f|
-    = hidden_field_tag 'id', @parent.id
-    = hidden_field_tag 'parent_type', @parent_type
-    %ul
-      %li
-        %label Max Running Instances
-        = f.error_message_on :maximum_running_instances, 
'maximum_running_instances'
-        = f.text_field :maximum_running_instances
-    = submit_tag "Save", :class => "submit"
diff --git a/src/app/views/quota/show.haml b/src/app/views/quota/show.haml
deleted file mode 100644
index 1c229a8..0000000
--- a/src/app/views/quota/show.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-- if !...@quota
-  %h1
-    There is no Quota on this #...@parent_type}
-- else
-  %table
-    %thead
-      %tr
-        %th{:scope => "col"} Resource
-        %th{:scope => "col"} Max Capacity
-        %th{:scope => "col"} Used
-        %th{:scope => "col"} Available
-    %tbody
-      - quota_resources = @quota.quota_resources
-      - quota_resources.each_value do |quota_resource|
-        %tr
-          %td= quota_resource.name + " " + quota_resource.unit
-          %td= quota_resource.max
-          %td= quota_resource.used
-          %td= quota_resource.available
-  = link_to "Edit", {:action => "edit", :id => @parent, :parent_type => 
@parent_type}, :class=>"actionlink"
-  = link_to "Reset", {:action => "reset", :id => @parent, :parent_type => 
@parent_type}, :class=>"actionlink"
diff --git a/src/app/views/quotas/edit.haml b/src/app/views/quotas/edit.haml
new file mode 100644
index 0000000..2293b43
--- /dev/null
+++ b/src/app/views/quotas/edit.haml
@@ -0,0 +1,13 @@
+.dcloud_form
+  %h2
+    Edit Quota for #...@parent_type + ": " + @name}
+  %br/
+  - form_for @quota, :url => {:controller => :quotas, :action => "update", 
:parent_type => @parent_type}, :class => "dcloud_form" do |f|
+    = hidden_field_tag 'id', @parent.id
+    = hidden_field_tag 'parent_type', @parent_type
+    %ul
+      %li
+        %label Max Running Instances
+        = f.error_message_on :maximum_running_instances, 
'maximum_running_instances'
+        = f.text_field :maximum_running_instances
+    = submit_tag "Save", :class => "submit"
diff --git a/src/app/views/quotas/show.haml b/src/app/views/quotas/show.haml
new file mode 100644
index 0000000..1c229a8
--- /dev/null
+++ b/src/app/views/quotas/show.haml
@@ -0,0 +1,21 @@
+- if !...@quota
+  %h1
+    There is no Quota on this #...@parent_type}
+- else
+  %table
+    %thead
+      %tr
+        %th{:scope => "col"} Resource
+        %th{:scope => "col"} Max Capacity
+        %th{:scope => "col"} Used
+        %th{:scope => "col"} Available
+    %tbody
+      - quota_resources = @quota.quota_resources
+      - quota_resources.each_value do |quota_resource|
+        %tr
+          %td= quota_resource.name + " " + quota_resource.unit
+          %td= quota_resource.max
+          %td= quota_resource.used
+          %td= quota_resource.available
+  = link_to "Edit", {:action => "edit", :id => @parent, :parent_type => 
@parent_type}, :class=>"actionlink"
+  = link_to "Reset", {:action => "reset", :id => @parent, :parent_type => 
@parent_type}, :class=>"actionlink"
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to