Refresh nodes correctly when there is a single child that is updated. Fixes #2532

This commit is contained in:
Khushboo Vashi 2017-07-10 13:25:10 +01:00 committed by Dave Page
parent 55b1e7b186
commit ecd95141f3

View File

@ -826,6 +826,10 @@ define(
_o.d = null; _o.d = null;
_o.pI.push({coll: true, item: i, d: d}); _o.pI.push({coll: true, item: i, d: d});
// Set load to false when the current collection node's inode is false
if (!_o.t.isInode(i)) {
_o.load = false;
}
_o.b._findTreeChildNode(i, _d, _o); _o.b._findTreeChildNode(i, _d, _o);
return; return;
} }
@ -1502,27 +1506,39 @@ define(
} }
}); });
} else { } else {
ctx.t.append(ctx.i, { var _appendNode = function() {
itemData: _new, ctx.t.append(ctx.i, {
success: function() { itemData: _new,
var new_item = $(arguments[1].items[0]); success: function() {
ctx.t.openPath(new_item); var new_item = $(arguments[1].items[0]);
ctx.t.select(new_item); ctx.t.openPath(new_item);
if ( ctx.t.select(new_item);
ctx.o && ctx.o.success && typeof(ctx.o.success) == 'function' if (
) { ctx.o && ctx.o.success && typeof(ctx.o.success) == 'function'
ctx.o.success.apply(ctx.t, [ctx.i, _old, _new]); ) {
ctx.o.success.apply(ctx.t, [ctx.i, _old, _new]);
}
},
fail: function() {
console.log('Failed to append');
if (
ctx.o && ctx.o.fail && typeof(ctx.o.fail) == 'function'
) {
ctx.o.fail.apply(ctx.t, [ctx.i, _old, _new]);
}
} }
}, })
fail: function() { };
console.log('Failed to append');
if ( // If the current node's inode is false
ctx.o && ctx.o.fail && typeof(ctx.o.fail) == 'function' if (ctx.i && !ctx.t.isInode(ctx.i)) {
) { ctx.t.setInode(ctx.i, {success: _appendNode});
ctx.o.fail.apply(ctx.t, [ctx.i, _old, _new]); } else {
} // Handle case for node without parent i.e. server-group
} // or if parent node's inode is true.
}); _appendNode();
}
} }
}.bind(ctx); }.bind(ctx);