Get full actions working in the repo changes tab

This commit is contained in:
Joseph Schorr 2015-03-11 17:46:50 -07:00
parent 89e71b75dd
commit a18148b058
9 changed files with 490 additions and 54 deletions

View file

@ -31,7 +31,9 @@ var DEPTH_WIDTH = 140;
/**
* Based off of http://mbostock.github.io/d3/talk/20111018/tree.html by Mike Bostock (@mbostock)
*/
function ImageHistoryTree(namespace, name, images, formatComment, formatTime, formatCommand) {
function ImageHistoryTree(namespace, name, images, formatComment, formatTime, formatCommand,
opt_tagFilter) {
/**
* The namespace of the repo.
*/
@ -62,6 +64,11 @@ function ImageHistoryTree(namespace, name, images, formatComment, formatTime, fo
*/
this.formatCommand_ = formatCommand;
/**
* Method for filtering the tags and image paths displayed in the tree.
*/
this.tagFilter_ = opt_tagFilter || function() { return true; };
/**
* The current tag (if any).
*/
@ -153,7 +160,7 @@ ImageHistoryTree.prototype.updateDimensions_ = function() {
$('#' + container).removeOverscroll();
var viewportHeight = $(window).height();
var boundingBox = document.getElementById(container).getBoundingClientRect();
document.getElementById(container).style.maxHeight = (viewportHeight - boundingBox.top - 150) + 'px';
document.getElementById(container).style.maxHeight = (viewportHeight - boundingBox.top - 100) + 'px';
this.setupOverscroll_();
@ -526,7 +533,14 @@ ImageHistoryTree.prototype.pruneUnreferenced_ = function(node) {
return node.children.length == 0;
}
return (node.children.length == 0 && node.tags.length == 0);
var tags = [];
for (var i = 0; i < node.tags.length; ++i) {
if (this.tagFilter_(node.tags[i])) {
tags.push(node.tags[i]);
}
}
return (node.children.length == 0 && tags.length == 0);
};
@ -554,7 +568,7 @@ ImageHistoryTree.prototype.collapseNodes_ = function(node) {
var current = node;
var previous = node;
var encountered = [];
while (current.children.length == 1) {
while (current.children.length == 1 && current.tags.length == 0) {
encountered.push(current);
previous = current;
current = current.children[0];