Merge branch 'orgs' of ssh://bitbucket.org/yackob03/quay into orgs
This commit is contained in:
commit
d6e35e061d
1 changed files with 24 additions and 4 deletions
|
@ -137,6 +137,10 @@ ImageHistoryTree.prototype.draw = function(container) {
|
|||
.direction('e')
|
||||
.html(function(d) {
|
||||
var html = '';
|
||||
if (d.virtual) {
|
||||
return d.name;
|
||||
}
|
||||
|
||||
if (d.collapsed) {
|
||||
for (var i = 1; i < d.encountered.length; ++i) {
|
||||
html += '<span>' + d.encountered[i].image.id.substr(0, 12) + '</span>';
|
||||
|
@ -272,6 +276,7 @@ ImageHistoryTree.prototype.buildRoot_ = function() {
|
|||
|
||||
// For each node, attach it to its immediate parent. If there is no immediate parent,
|
||||
// then the node is the root.
|
||||
var roots = [];
|
||||
for (var i = 0; i < this.images_.length; ++i) {
|
||||
var image = this.images_[i];
|
||||
var imageNode = imageByDBID[image.dbid];
|
||||
|
@ -283,10 +288,22 @@ ImageHistoryTree.prototype.buildRoot_ = function() {
|
|||
imageNode.parent = parent;
|
||||
parent.children.push(imageNode);
|
||||
} else {
|
||||
formatted = imageNode;
|
||||
roots.push(imageNode);
|
||||
}
|
||||
}
|
||||
|
||||
// If there are multiple root nodes, then there is at least one branch without shared
|
||||
// ancestry and we use the virtual node. Otherwise, we use the root node found.
|
||||
var root = {
|
||||
'name': '',
|
||||
'children': roots,
|
||||
'virtual': true
|
||||
};
|
||||
|
||||
if (roots.length == 1) {
|
||||
root = roots[0];
|
||||
}
|
||||
|
||||
// Determine the maximum number of nodes at a particular level. This is used to size
|
||||
// the width of the tree properly.
|
||||
var maxChildCount = 0;
|
||||
|
@ -300,14 +317,14 @@ ImageHistoryTree.prototype.buildRoot_ = function() {
|
|||
// section. We only do this if the max width is > 1 (since for a single width tree, no long
|
||||
// chain will hide a branch).
|
||||
if (maxChildCount > 1) {
|
||||
this.collapseNodes_(formatted);
|
||||
this.collapseNodes_(root);
|
||||
}
|
||||
|
||||
// Determine the maximum height of the tree.
|
||||
var maxHeight = this.determineMaximumHeight_(formatted);
|
||||
var maxHeight = this.determineMaximumHeight_(root);
|
||||
|
||||
// Finally, set the root node and return.
|
||||
this.root_ = formatted;
|
||||
this.root_ = root;
|
||||
|
||||
return {
|
||||
'maxWidth': maxChildCount + 1,
|
||||
|
@ -593,6 +610,9 @@ ImageHistoryTree.prototype.update_ = function(source) {
|
|||
if (d.collapsed) {
|
||||
return 'collapsed';
|
||||
}
|
||||
if (d.virtual) {
|
||||
return 'virtual';
|
||||
}
|
||||
if (!currentImage) {
|
||||
return '';
|
||||
}
|
||||
|
|
Reference in a new issue