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')
|
.direction('e')
|
||||||
.html(function(d) {
|
.html(function(d) {
|
||||||
var html = '';
|
var html = '';
|
||||||
|
if (d.virtual) {
|
||||||
|
return d.name;
|
||||||
|
}
|
||||||
|
|
||||||
if (d.collapsed) {
|
if (d.collapsed) {
|
||||||
for (var i = 1; i < d.encountered.length; ++i) {
|
for (var i = 1; i < d.encountered.length; ++i) {
|
||||||
html += '<span>' + d.encountered[i].image.id.substr(0, 12) + '</span>';
|
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,
|
// For each node, attach it to its immediate parent. If there is no immediate parent,
|
||||||
// then the node is the root.
|
// then the node is the root.
|
||||||
|
var roots = [];
|
||||||
for (var i = 0; i < this.images_.length; ++i) {
|
for (var i = 0; i < this.images_.length; ++i) {
|
||||||
var image = this.images_[i];
|
var image = this.images_[i];
|
||||||
var imageNode = imageByDBID[image.dbid];
|
var imageNode = imageByDBID[image.dbid];
|
||||||
|
@ -283,10 +288,22 @@ ImageHistoryTree.prototype.buildRoot_ = function() {
|
||||||
imageNode.parent = parent;
|
imageNode.parent = parent;
|
||||||
parent.children.push(imageNode);
|
parent.children.push(imageNode);
|
||||||
} else {
|
} 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
|
// Determine the maximum number of nodes at a particular level. This is used to size
|
||||||
// the width of the tree properly.
|
// the width of the tree properly.
|
||||||
var maxChildCount = 0;
|
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
|
// section. We only do this if the max width is > 1 (since for a single width tree, no long
|
||||||
// chain will hide a branch).
|
// chain will hide a branch).
|
||||||
if (maxChildCount > 1) {
|
if (maxChildCount > 1) {
|
||||||
this.collapseNodes_(formatted);
|
this.collapseNodes_(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the maximum height of the tree.
|
// Determine the maximum height of the tree.
|
||||||
var maxHeight = this.determineMaximumHeight_(formatted);
|
var maxHeight = this.determineMaximumHeight_(root);
|
||||||
|
|
||||||
// Finally, set the root node and return.
|
// Finally, set the root node and return.
|
||||||
this.root_ = formatted;
|
this.root_ = root;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'maxWidth': maxChildCount + 1,
|
'maxWidth': maxChildCount + 1,
|
||||||
|
@ -593,6 +610,9 @@ ImageHistoryTree.prototype.update_ = function(source) {
|
||||||
if (d.collapsed) {
|
if (d.collapsed) {
|
||||||
return 'collapsed';
|
return 'collapsed';
|
||||||
}
|
}
|
||||||
|
if (d.virtual) {
|
||||||
|
return 'virtual';
|
||||||
|
}
|
||||||
if (!currentImage) {
|
if (!currentImage) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue