Merge branch 'master' of ssh://bitbucket.org/yackob03/quay
This commit is contained in:
commit
1ffd4b0bfb
2 changed files with 55 additions and 7 deletions
|
@ -748,16 +748,16 @@ function ImageFileChangeTree(image, changes) {
|
||||||
*/
|
*/
|
||||||
ImageFileChangeTree.prototype.calculateDimensions_ = function(container) {
|
ImageFileChangeTree.prototype.calculateDimensions_ = function(container) {
|
||||||
var cw = document.getElementById(container).clientWidth;
|
var cw = document.getElementById(container).clientWidth;
|
||||||
var barWidth = cw * 0.8;
|
|
||||||
|
|
||||||
var barHeight = 20;
|
var barHeight = 20;
|
||||||
var ch = (this.changes_.length * barHeight) + 40;
|
var ch = (this.changes_.length * barHeight) + 40;
|
||||||
|
|
||||||
var margin = { top: 40, right: 20, bottom: 20, left: 40 };
|
var margin = { top: 40, right: 00, bottom: 20, left: 20 };
|
||||||
var m = [margin.top, margin.right, margin.bottom, margin.left];
|
var m = [margin.top, margin.right, margin.bottom, margin.left];
|
||||||
var w = cw - m[1] - m[3];
|
var w = cw - m[1] - m[3];
|
||||||
var h = ch - m[0] - m[2];
|
var h = ch - m[0] - m[2];
|
||||||
|
|
||||||
|
var barWidth = cw * 0.8 - m[1] - m[3];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'w': w,
|
'w': w,
|
||||||
'h': h,
|
'h': h,
|
||||||
|
@ -770,6 +770,45 @@ ImageFileChangeTree.prototype.calculateDimensions_ = function(container) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the dimensions of the tree.
|
||||||
|
*/
|
||||||
|
ImageFileChangeTree.prototype.updateDimensions_ = function() {
|
||||||
|
var container = this.container_;
|
||||||
|
var dimensions = this.calculateDimensions_(container);
|
||||||
|
|
||||||
|
var w = dimensions.w;
|
||||||
|
var h = dimensions.h;
|
||||||
|
var m = dimensions.m;
|
||||||
|
|
||||||
|
// Update the tree.
|
||||||
|
var rootSvg = this.rootSvg_;
|
||||||
|
var tree = this.tree_;
|
||||||
|
var vis = this.vis_;
|
||||||
|
|
||||||
|
rootSvg
|
||||||
|
.attr("width", w + m[1] + m[3])
|
||||||
|
.attr("height", h + m[0] + m[2]);
|
||||||
|
|
||||||
|
tree.size([h, 100]);
|
||||||
|
vis.attr("transform", "translate(" + m[3] + "," + m[0] + ")");
|
||||||
|
|
||||||
|
this.barWidth_ = dimensions.bw;
|
||||||
|
this.barHeight_ = dimensions.bh;
|
||||||
|
|
||||||
|
return dimensions;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redraws the image change tree to fit the new size.
|
||||||
|
*/
|
||||||
|
ImageFileChangeTree.prototype.notifyResized = function() {
|
||||||
|
this.updateDimensions_();
|
||||||
|
this.update_(this.root_);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the tree.
|
* Draws the tree.
|
||||||
*/
|
*/
|
||||||
|
@ -950,6 +989,7 @@ ImageFileChangeTree.prototype.update_ = function(source) {
|
||||||
|
|
||||||
// Enter any new nodes at the parent's previous position.
|
// Enter any new nodes at the parent's previous position.
|
||||||
nodeEnter.append("svg:rect")
|
nodeEnter.append("svg:rect")
|
||||||
|
.attr("class", "main-rect")
|
||||||
.attr("y", -barHeight / 2)
|
.attr("y", -barHeight / 2)
|
||||||
.attr("height", barHeight)
|
.attr("height", barHeight)
|
||||||
.attr("width", barWidth)
|
.attr("width", barWidth)
|
||||||
|
@ -962,8 +1002,7 @@ ImageFileChangeTree.prototype.update_ = function(source) {
|
||||||
.text(function(d) { return d.name; });
|
.text(function(d) { return d.name; });
|
||||||
|
|
||||||
var body = nodeEnter.append('svg:foreignObject')
|
var body = nodeEnter.append('svg:foreignObject')
|
||||||
.attr("x", function(d) { return d.kind ? barWidth - 18 : 0; })
|
.attr("class", "fo")
|
||||||
.attr("y", -10)
|
|
||||||
.attr("width", 18)
|
.attr("width", 18)
|
||||||
.attr("height", barHeight)
|
.attr("height", barHeight)
|
||||||
.append('xhtml:body');
|
.append('xhtml:body');
|
||||||
|
@ -988,6 +1027,15 @@ ImageFileChangeTree.prototype.update_ = function(source) {
|
||||||
// TODO: remove if full animation.
|
// TODO: remove if full animation.
|
||||||
node.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
|
node.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; });
|
||||||
|
|
||||||
|
node.select('.main-rect')
|
||||||
|
.attr("y", -barHeight / 2)
|
||||||
|
.attr("height", barHeight)
|
||||||
|
.attr("width", barWidth)
|
||||||
|
|
||||||
|
node.select('.fo')
|
||||||
|
.attr("x", function(d) { return d.kind ? barWidth - 18 : 0; })
|
||||||
|
.attr("y", -10)
|
||||||
|
|
||||||
node.select('.node-icon')
|
node.select('.node-icon')
|
||||||
.html(function(d) {
|
.html(function(d) {
|
||||||
if (!d.kind) {
|
if (!d.kind) {
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
|
|
||||||
<!-- Tree view -->
|
<!-- Tree view -->
|
||||||
<div class="tab-pane" id="tree">
|
<div class="tab-pane" id="tree">
|
||||||
<div id="changes-tree-container" class="changes-container"></div>
|
<div id="changes-tree-container" class="changes-container" onresize="tree && tree.notifyResized()"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Reference in a new issue