[Ovirt-devel] [PATCH] fixed a couple random smart pool UI bugs:
Scott Seago
sseago at redhat.com
Thu Jan 29 14:35:09 UTC 2009
1. the 'add storage' flexigrid for smart pools was broken due to an error in generating the :conditions block
2. the pulldown list for smart pools was showing the DirectoryPools for each user rather than the smart pools themselves.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
src/app/controllers/smart_pools_controller.rb | 7 ++++++-
src/app/models/smart_pool.rb | 22 ++++++++++++----------
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/src/app/controllers/smart_pools_controller.rb b/src/app/controllers/smart_pools_controller.rb
index cbfbd1c..f5f3c9d 100644
--- a/src/app/controllers/smart_pools_controller.rb
+++ b/src/app/controllers/smart_pools_controller.rb
@@ -76,7 +76,12 @@ class SmartPoolsController < PoolController
def storage_pools_json
args = items_json_internal(StoragePool, :tagged_storage_pools)
conditions = args[:find_opts][:conditions]
- conditions[0] = "(storage_pools.type != 'LvmStoragePool') and (#{conditions[0]})"
+ storage_conditions = "storage_pools.type != 'LvmStoragePool'"
+ if conditions[0]
+ conditions[0] = "(#{storage_conditions}) and (#{conditions[0]})"
+ else
+ conditions[0] = storage_conditions
+ end
super(args)
end
diff --git a/src/app/models/smart_pool.rb b/src/app/models/smart_pool.rb
index 7df26fa..ca55a2e 100644
--- a/src/app/models/smart_pool.rb
+++ b/src/app/models/smart_pool.rb
@@ -75,22 +75,24 @@ class SmartPool < Pool
def self.smart_pools_for_user(user)
nested_pools = DirectoryPool.get_smart_root.full_set_nested(
:privilege => Permission::PRIV_MODIFY, :user => user,
- :smart_pool_set => true)
+ :smart_pool_set => true)[0][:children]
user_pools = []
other_pools = []
- nested_pools.each do |pool_element|
- pool = pool_element[:obj]
- if pool.hasChildren
- if pool.name == user
+ if nested_pools
+ nested_pools.each do |pool_element|
+ pool = pool_element[:obj]
+ if pool.hasChildren
+ if pool.name == user
pool_element[:children].each do |child_element|
child_pool = child_element[:obj]
user_pools <<[child_pool.name, child_pool.id]
end
- else
- if pool_element.has_key?(:children)
- pool_element[:children].each do |child_element|
- child_pool = child_element[:obj]
- other_pools << [pool.name + " > " + child_pool.name, child_pool.id]
+ else
+ if pool_element.has_key?(:children)
+ pool_element[:children].each do |child_element|
+ child_pool = child_element[:obj]
+ other_pools << [pool.name + " > " + child_pool.name, child_pool.id]
+ end
end
end
end
--
1.6.0.6
More information about the ovirt-devel
mailing list