You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:52:27 UTC
[43/50] [abbrv] brooklyn-ui git commit: fix so tree updates when new
children come online
fix so tree updates when new children come online
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/beff96cd
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/beff96cd
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/beff96cd
Branch: refs/heads/0.6.0
Commit: beff96cdc65c00921ed01f9daba93e52ee2c38f9
Parents: e1351b9
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Oct 14 11:28:21 2013 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Oct 14 11:44:31 2013 +0100
----------------------------------------------------------------------
.../main/webapp/assets/js/view/application-tree.js | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/beff96cd/usage/jsgui/src/main/webapp/assets/js/view/application-tree.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/application-tree.js b/usage/jsgui/src/main/webapp/assets/js/view/application-tree.js
index db64c01..ed09a6e 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/application-tree.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/application-tree.js
@@ -156,8 +156,22 @@ define([
var $node = $(node), $newNode = $(newNode);
// preserve old display status (just chevron direction at present)
- if ($node.find('.tree-node-state').hasClass('icon-chevron-down'))
+ if ($node.find('.tree-node-state').hasClass('icon-chevron-down')) {
$newNode.find('.tree-node-state').removeClass('icon-chevron-right').addClass('icon-chevron-down')
+ // and if visible, see if any children have been added
+ var children = nModel.get("childrenIds")
+ var newChildren = []
+ _.each(children, function(childId) {
+ if (!that.collection.get(childId)) {
+ newChildren.push(childId);
+ }
+ })
+ if (newChildren.length) {
+ // reload if new child ID we don't recognise
+ this.collection.includeEntities(newChildren);
+ this.collection.fetch()
+ }
+ }
$(node).html($newNode)
this.addEventsToNode($(node))