Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WEBUI JS: idnode - fix the tree updating, expanding and selection (TV…
… adapters)
  • Loading branch information
perexg committed Oct 21, 2014
1 parent 43e805d commit 55d410c
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/webui/static/app/idnode.js
Expand Up @@ -1843,13 +1843,17 @@ tvheadend.idnode_tree = function(panel, conf)
var events = {};

function update(o) {
if (tree && o.reload)
if (tree && o.reload) {
tree.getRootNode().reload();
tree.expandAll();
}
}

function updatenode(o) {
if (o.uuid)
if (o.uuid) {
tree.getRootNode().reload();
tree.expandAll();
}
}

function updatetitle(o) {
Expand All @@ -1868,8 +1872,9 @@ tvheadend.idnode_tree = function(panel, conf)
if (conf.builder)
conf.builder(conf);

var current = null;
var first = true;
var current = null;
var uuid = null;
var params = conf.params || {};
var loader = new Ext.tree.TreeLoader({
dataUrl: conf.url,
Expand All @@ -1878,12 +1883,20 @@ tvheadend.idnode_tree = function(panel, conf)
nodeParameter: 'uuid'
});

loader.on('load', function(l, n, r) {
var node_added = function(n) {
var event = n.attributes.event;
if (n.attributes.uuid && event && !(event in events)) {
events[event] = 1;
tvheadend.comet.on(event, updatenode);
}
if (n.attributes.uuid === uuid)
n.select();
}

loader.on('load', function(l, n, r) {
node_added(n);
for (var i = 0; i < n.childNodes.length; i++)
node_added(n.childNodes[i]);
if (first) { /* hack */
dpanel.doLayout();
first = false;
Expand All @@ -1906,8 +1919,10 @@ tvheadend.idnode_tree = function(panel, conf)
if (current) {
mpanel.remove(current);
current = null;
uuid = null;
}
if (!n.isRoot) {
uuid = n.attributes.uuid;
current = new tvheadend.idnode_editor(n.attributes, {
title: 'Parameters',
width: 550,
Expand Down

0 comments on commit 55d410c

Please sign in to comment.