They were not updating when you added a new one because We were
only recursing down through children if an element was not changed,
rather than always if there were children. If I recall correctly,
this was originally to save processing time, but with recent
changes, it is no longer accurate.
Also realized that tree_controller was not splitting properly based
on name, so if you had a name with '-'s in it, it would always return
as 'changed'. In addition, the 'smart root' never changes (at
least by
the user) so make state='unchanged'.
Signed-off-by: Jason Guiditta <jguiditt at redhat.com>
---
src/app/controllers/tree_controller.rb | 3 ++-
src/public/javascripts/ovirt.tree.js | 8 +++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/tree_controller.rb
b/src/app/controllers/tree_controller.rb
index 2bd2928..b6e7404 100644
--- a/src/app/controllers/tree_controller.rb
+++ b/src/app/controllers/tree_controller.rb
@@ -21,7 +21,7 @@ class TreeController < ApplicationController
@clientHash = {}
if (params[:item])
params[:item].each { |item|
- tempItem = item.split("-")
+ tempItem = item.split("-",2)
itemHash = {
:id => tempItem[0].to_s,
:name =>tempItem[1]
@@ -81,6 +81,7 @@ class TreeController < ApplicationController
smart_root = list[0]
smart_root[:name] = "Smart Pools"
smart_root[:type] = "SmartPoolRoot"
+ smart_root[:state] = "unchanged"
mySmartPools = Array.new
otherSmartPools = Array.new
if smart_root.has_key?(:children)
diff --git a/src/public/javascripts/ovirt.tree.js
b/src/public/javascripts/ovirt.tree.js
index 77d6c55..b7f95f0 100644
--- a/src/public/javascripts/ovirt.tree.js
+++ b/src/public/javascripts/ovirt.tree.js
@@ -58,11 +58,9 @@ function processChildren(list, templateObj){
$('#' + data.parent_id).parent().append('<ul>' +
result + '</ul>');
$('#' +
data.parent_id).siblings('span').addClass('expanded');
}
- }
- else {
- if (data.children) {
- processChildren(data.children, templateObj);
- }
+ }
+ if (data.children) {
+ processChildren(data.children, templateObj);
}
});
}
--
1.5.6.6