---
src/app/models/pool_family.rb | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/app/models/pool_family.rb b/src/app/models/pool_family.rb
index 1598640..7201668 100644
--- a/src/app/models/pool_family.rb
+++ b/src/app/models/pool_family.rb
@@ -33,6 +33,8 @@
class PoolFamily < ActiveRecord::Base
include PermissionedObject
+ include ActionView::Helpers::NumberHelper
+
DEFAULT_POOL_FAMILY_KEY = "default_pool_family"
has_many :pools, :dependent => :destroy
@@ -66,4 +68,19 @@ class PoolFamily < ActiveRecord::Base
def all_providers_disabled?
!provider_accounts.empty? and !provider_accounts.any? {|acc| acc.provider.enabled?}
end
+
+ def statistics
+ used_quota = pools.collect{|p| p.statistics[:used_quota]}.sum;
+ available_quota = pools.collect{|p| p.statistics[:available_quota]}.sum;
+
+ statistics = {
+ :deployments => pools.collect{|p| p.statistics[:deployments]}.sum,
+ :total_instances => pools.collect{|p| p.statistics[:total_instances]}.sum,
+ :instances_pending => pools.collect{|p| p.statistics[:instances_pending]}.sum,
+ :instances_failed => pools.collect{|p| p.statistics[:instances_failed]}.sum,
+ :used_quota => used_quota,
+ :quota_percent => number_to_percentage(100 * used_quota / (used_quota +
available_quota), :precision => 0),
+ :available_quota => available_quota,
+ }
+ end
end
--
1.7.6.5
Show replies by date
---
src/config/locales/cs.yml | 1 +
src/config/locales/en.yml | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/config/locales/cs.yml b/src/config/locales/cs.yml
index 30f2155..7785914 100644
--- a/src/config/locales/cs.yml
+++ b/src/config/locales/cs.yml
@@ -774,6 +774,7 @@ cs:
active_instances: oammgh onbil
quota_limit: njfli lmbld
available_instances: abbhknfga focak
+ total_statistics: kwerqw
pool_family: jame eiolml
flash:
notice:
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index b1feea1..8b6b1fc 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -582,6 +582,7 @@ en:
yes: Yes
no: No
catalog: "Catalog"
+ total_statistics: TOTAL
new:
environments: Environments
edit:
--
1.7.6.5
---
src/app/views/pool_families/_list.html.haml | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/app/views/pool_families/_list.html.haml
b/src/app/views/pool_families/_list.html.haml
index 422a678..b827a9d 100644
--- a/src/app/views/pool_families/_list.html.haml
+++ b/src/app/views/pool_families/_list.html.haml
@@ -42,3 +42,15 @@
%td= pool.enabled? ? t("pool_families.index.yes") :
t("pool_families.index.no")
%td= link_to pool.catalogs.first.name, catalog_path(pool.catalogs.first) if
pool.catalogs.any?
%td= link_to t(:edit), edit_pool_path(pool), :class =>
'pool_family_button'
+ %tr
+ %td= t("pool_families.index.total_statistics")
+ %td= pool_family.statistics[:deployments]
+ %td= pool_family.statistics[:total_instances]
+ %td= pool_family.statistics[:instances_pending]
+ %td= pool_family.statistics[:instances_failed]
+ %td= pool_family.statistics[:quota_percent]
+ %td= pool_family.statistics[:used_quota]
+ %td= pool_family.statistics[:available_quota].nil? ? raw('∞')
: pool_family.statistics[:available_quota]
+ %td
+ %td
+ %td
--
1.7.6.5