Fix tree graph when there are many branches and they do not have a common root node. Also adds a test repo to check this case
This commit is contained in:
parent
0bfa172543
commit
4054ead45d
2 changed files with 24 additions and 3 deletions
23
initdb.py
23
initdb.py
|
@ -104,7 +104,11 @@ def __generate_repository(user, name, description, is_public, permissions,
|
|||
model.set_user_repo_permission(delegate.username, user.username, name,
|
||||
role)
|
||||
|
||||
__create_subtree(repo, structure, None)
|
||||
if isinstance(structure, list):
|
||||
for s in structure:
|
||||
__create_subtree(repo, s, None)
|
||||
else:
|
||||
__create_subtree(repo, structure, None)
|
||||
|
||||
return repo
|
||||
|
||||
|
@ -216,6 +220,23 @@ def populate_database():
|
|||
(1, [(1, [], 'v5.0'), (1, [], 'v6.0')], None)],
|
||||
None))
|
||||
|
||||
__generate_repository(new_user_1, 'superwide', None, False, [],
|
||||
[(10, [], 'latest2'),
|
||||
(10, [], 'latest3'),
|
||||
(6, [(2, [], 'latest11'), (4, [], 'latest12')], 'latest4'),
|
||||
(10, [], 'latest5'),
|
||||
(10, [], 'latest6'),
|
||||
(10, [], 'latest7'),
|
||||
(10, [], 'latest8'),
|
||||
(10, [], 'latest9'),
|
||||
(10, [], 'latest10'),
|
||||
(10, [], 'latest13'),
|
||||
(10, [], 'latest14'),
|
||||
(10, [], 'latest15'),
|
||||
(10, [], 'latest16'),
|
||||
(10, [], 'latest17'),
|
||||
(10, [], 'latest18'),])
|
||||
|
||||
__generate_repository(new_user_2, 'publicrepo',
|
||||
'Public repository pullable by the world.', True,
|
||||
[], (10, [], 'latest'))
|
||||
|
|
|
@ -26,7 +26,7 @@ if (!Function.prototype.bind) {
|
|||
}
|
||||
|
||||
var DEPTH_HEIGHT = 100;
|
||||
var DEPTH_WIDTH = 132;
|
||||
var DEPTH_WIDTH = 140;
|
||||
|
||||
/**
|
||||
* Based off of http://mbostock.github.io/d3/talk/20111018/tree.html by Mike Bostock (@mbostock)
|
||||
|
@ -387,7 +387,7 @@ ImageHistoryTree.prototype.buildRoot_ = function() {
|
|||
|
||||
// Determine the maximum number of nodes at a particular level. This is used to size
|
||||
// the width of the tree properly.
|
||||
var maxChildCount = 0;
|
||||
var maxChildCount = roots.length;
|
||||
for (var i = 0; i < this.images_.length; ++i) {
|
||||
var image = this.images_[i];
|
||||
var imageNode = imageByDBID[image.dbid];
|
||||
|
|
Reference in a new issue